Quellcode durchsuchen

- Fixed item pickup not picking anything unless you were in a party with item distribution set o.O

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5423 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex vor 19 Jahren
Ursprung
Commit
bb7a50a009
4 geänderte Dateien mit 16 neuen und 11 gelöschten Zeilen
  1. 3 0
      Changelog-Trunk.txt
  2. 3 1
      src/map/mob.c
  3. 6 10
      src/map/pc.c
  4. 4 0
      src/map/script.c

+ 3 - 0
Changelog-Trunk.txt

@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.  EVERYTHING ELSE
 GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
 
+2006/03/02
+	* Fixed item pickup not picking anything unless you were in a party with
+	  item distribution set [Skotlex]
 2006/03/01
 	* Made it so players that are at the max level do not receive EXP.
 	  This makes it so a player at the max level (ie - 99) cannot join a party

+ 3 - 1
src/map/mob.c

@@ -2079,7 +2079,9 @@ static void mob_item_drop(struct mob_data *md, unsigned int tick, struct delay_i
 		ditem->first_sd->state.autoloot >= 10000) //Fetch 100% drops
 	) {	//Autoloot.
 		if (party_share_loot(
-			party_search(ditem->first_sd->status.party_id),
+			ditem->first_sd->status.party_id?
+				party_search(ditem->first_sd->status.party_id):
+				NULL,
 			ditem->first_sd,&ditem->item_data)
 		) {
 			aFree(ditem);

+ 6 - 10
src/map/pc.c

@@ -2591,16 +2591,12 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
 		}
 	}
 	first_sd = NULL; //First_sd will store who picked up the item.
-	if (p && p->item&2) { //item distribution to party members.
-		if ((flag = party_share_loot(p,sd,&fitem->item_data))) {
-			clif_additem(sd,0,0,flag);
-			return 1;
-		}
-		first_sd = sd;
-	} else
-	if(log_config.pick) //Logs items, taken by (P)layers [Lupus]
-		log_pick(first_sd, "P", 0, fitem->item_data.nameid, fitem->item_data.amount, (struct item*)&fitem->item_data);
-
+	//This function takes care of giving the item to whoever should have it
+	//considering party-share options.
+	if ((flag = party_share_loot(p,sd,&fitem->item_data))) {
+		clif_additem(sd,0,0,flag);
+		return 1;
+	}
 
 	//Display pickup animation.
 	if(sd->attacktimer != -1)

+ 4 - 0
src/map/script.c

@@ -4365,6 +4365,10 @@ int buildin_strcharinfo(struct script_state *st)
 	int num;
 
 	sd=script_rid2sd(st);
+	if (!sd) { //Avoid crashing....
+		push_str(st->stack,C_CONSTSTR,(unsigned char *) "");
+		return 0;
+	}
 	num=conv_num(st,& (st->stack->stack_data[st->start+2]));
 	if(sd){
 		switch(num){