summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-23 03:14:57 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-23 03:14:57 +0000
commit7d10ecf3d159a3d4765b65a1eb1bd11399b0ef37 (patch)
tree32d69f53bacb7597d55e5a27839dde6d952aca77 /src/map/mob.c
parenta278eb2e074ce0cb0c9c68e372c66b87f84577a1 (diff)
downloadhercules-7d10ecf3d159a3d4765b65a1eb1bd11399b0ef37.tar.gz
hercules-7d10ecf3d159a3d4765b65a1eb1bd11399b0ef37.tar.bz2
hercules-7d10ecf3d159a3d4765b65a1eb1bd11399b0ef37.tar.xz
hercules-7d10ecf3d159a3d4765b65a1eb1bd11399b0ef37.zip
* map_addflooritem and struct item_drop_list using id's instead of struct map_session_data's (fixes bugreport:36).
* Fixed buildin_escape_sql not properly escaping in sql servers. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11279 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index b5c83413c..f8be3806b 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1498,7 +1498,7 @@ static int mob_delay_item_drop(int tid, unsigned int tick, int id, int data)
while (ditem) {
map_addflooritem(&ditem->item_data,ditem->item_data.amount,
list->m,list->x,list->y,
- list->first_sd,list->second_sd,list->third_sd,0);
+ list->first_id,list->second_id,list->third_id,0);
ditem_prev = ditem;
ditem = ditem->next;
ers_free(item_drop_ers, ditem_prev);
@@ -1514,6 +1514,8 @@ static int mob_delay_item_drop(int tid, unsigned int tick, int id, int data)
*------------------------------------------*/
static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, struct item_drop *ditem, int loot, int drop_rate)
{
+ TBL_PC* sd;
+
if(log_config.enable_logs&0x10)
{ //Logs items, dropped by mobs [Lupus]
if (loot)
@@ -1522,14 +1524,16 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
log_pick_mob(md, "M", ditem->item_data.nameid, -ditem->item_data.amount, NULL);
}
- if (dlist->first_sd && dlist->first_sd->state.autoloot &&
- drop_rate <= dlist->first_sd->state.autoloot
+ sd = map_id2sd(dlist->first_id);
+ if( sd == NULL ) sd = map_id2sd(dlist->second_id);
+ if( sd == NULL ) sd = map_id2sd(dlist->third_id);
+ if( sd && drop_rate <= sd->state.autoloot
#ifdef AUTOLOOT_DISTANCE
- && check_distance_blxy(&dlist->first_sd->bl, dlist->x, dlist->y, AUTOLOOT_DISTANCE)
+ && check_distance_blxy(&sd->bl, dlist->x, dlist->y, AUTOLOOT_DISTANCE)
#endif
) { //Autoloot.
- if (party_share_loot(party_search(dlist->first_sd->status.party_id),
- dlist->first_sd, &ditem->item_data, dlist->first_sd->bl.id) == 0
+ if (party_share_loot(party_search(sd->status.party_id),
+ sd, &ditem->item_data, sd->bl.id) == 0
) {
ers_free(item_drop_ers, ditem);
return;
@@ -1978,9 +1982,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
dlist->m = md->bl.m;
dlist->x = md->bl.x;
dlist->y = md->bl.y;
- dlist->first_sd = mvp_sd;
- dlist->second_sd = second_sd;
- dlist->third_sd = third_sd;
+ dlist->first_id = (mvp_sd ? mvp_sd->bl.id : 0);
+ dlist->second_id = (second_sd ? second_sd->bl.id : 0);
+ dlist->third_id = (third_sd ? third_sd->bl.id : 0);
dlist->item = NULL;
for (i = 0; i < MAX_MOB_DROP; i++)
@@ -2086,9 +2090,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
dlist->m = md->bl.m;
dlist->x = md->bl.x;
dlist->y = md->bl.y;
- dlist->first_sd = mvp_sd;
- dlist->second_sd = second_sd;
- dlist->third_sd = third_sd;
+ dlist->first_id = (mvp_sd ? mvp_sd->bl.id : 0);
+ dlist->second_id = (second_sd ? second_sd->bl.id : 0);
+ dlist->third_id = (third_sd ? third_sd->bl.id : 0);
dlist->item = NULL;
for(i = 0; i < md->lootitem_count; i++)
mob_item_drop(md, dlist, mob_setlootitem(&md->lootitem[i]), 1, 10000);
@@ -2155,7 +2159,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if((temp = pc_additem(mvp_sd,&item,1)) != 0) {
clif_additem(sd,0,0,temp);
- map_addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd,second_sd,third_sd,1);
+ map_addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->bl.id,(second_sd?second_sd->bl.id:0),(third_sd?third_sd->bl.id:0),1);
}
if(log_config.enable_logs&0x200) {//Logs items, MVP prizes [Lupus]