summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-27 15:24:06 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-27 15:24:06 +0000
commit61aacc083393bead3227a049b57fb9e76186c7c5 (patch)
tree5872c3c351086969f539a105906568c1f39183b9 /src
parenta46c1fbcb1b7df32c678af8f0bbfda801d6142dc (diff)
downloadhercules-61aacc083393bead3227a049b57fb9e76186c7c5.tar.gz
hercules-61aacc083393bead3227a049b57fb9e76186c7c5.tar.bz2
hercules-61aacc083393bead3227a049b57fb9e76186c7c5.tar.xz
hercules-61aacc083393bead3227a049b57fb9e76186c7c5.zip
* Loot code using charid's instead of id's in pick priority.
* configure script using svn:eol-style LF and require mysql/pcre when --with-mysql/pcre is used. Added a forgotten file from r11311. (script_commands.txt) Note: charid's are globally unique, id's are equal for characters in the same account. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11312 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/map.c8
-rw-r--r--src/map/map.h4
-rw-r--r--src/map/mob.c26
-rw-r--r--src/map/mob.h2
-rw-r--r--src/map/party.c6
-rw-r--r--src/map/party.h2
-rw-r--r--src/map/pc.c14
-rw-r--r--src/map/pet.c14
8 files changed, 38 insertions, 38 deletions
diff --git a/src/map/map.c b/src/map/map.c
index a60e059b4..668929dfc 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1549,7 +1549,7 @@ int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx
* item_dataはamount以外をcopyする
* type flag: &1 MVP item. &2 do stacking check.
*------------------------------------------*/
-int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,int first_id,int second_id,int third_id,int flags)
+int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,int first_charid,int second_charid,int third_charid,int flags)
{
int r;
struct flooritem_data *fitem=NULL;
@@ -1572,11 +1572,11 @@ int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,int fir
return 0;
}
- fitem->first_get_id = first_id;
+ fitem->first_get_charid = first_charid;
fitem->first_get_tick = gettick() + (flags&1 ? battle_config.mvp_item_first_get_time : battle_config.item_first_get_time);
- fitem->second_get_id = second_id;
+ fitem->second_get_charid = second_charid;
fitem->second_get_tick = fitem->first_get_tick + (flags&1 ? battle_config.mvp_item_second_get_time : battle_config.item_second_get_time);
- fitem->third_get_id = third_id;
+ fitem->third_get_charid = third_charid;
fitem->third_get_tick = fitem->second_get_tick + (flags&1 ? battle_config.mvp_item_third_get_time : battle_config.item_third_get_time);
memcpy(&fitem->item_data,item_data,sizeof(*item_data));
diff --git a/src/map/map.h b/src/map/map.h
index cdae79a78..d894dffa9 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1127,7 +1127,7 @@ struct flooritem_data {
struct block_list bl;
unsigned char subx,suby;
int cleartimer;
- int first_get_id,second_get_id,third_get_id;
+ int first_get_charid,second_get_charid,third_get_charid;
unsigned int first_get_tick,second_get_tick,third_get_tick;
struct item item_data;
};
@@ -1325,7 +1325,7 @@ int map_addnpc(int,struct npc_data *);
int map_clearflooritem_timer(int,unsigned int,int,int);
int map_removemobs_timer(int,unsigned int,int,int);
#define map_clearflooritem(id) map_clearflooritem_timer(0,0,id,1)
-int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,int first_id,int second_id,int third_id,int flags);
+int map_addflooritem(struct item *item_data,int amount,int m,int x,int y,int first_charid,int second_charid,int third_charid,int flags);
// キャラid=>キャラ名 変換関連
void map_addnickdb(int charid, const char* nick);
diff --git a/src/map/mob.c b/src/map/mob.c
index 07fc2db22..8f45a1fc1 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1502,7 +1502,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_id,list->second_id,list->third_id,0);
+ list->first_charid,list->second_charid,list->third_charid,0);
ditem_prev = ditem;
ditem = ditem->next;
ers_free(item_drop_ers, ditem_prev);
@@ -1528,16 +1528,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);
}
- sd = map_id2sd(dlist->first_id);
- if( sd == NULL ) sd = map_id2sd(dlist->second_id);
- if( sd == NULL ) sd = map_id2sd(dlist->third_id);
+ sd = map_charid2sd(dlist->first_charid);
+ if( sd == NULL ) sd = map_charid2sd(dlist->second_charid);
+ if( sd == NULL ) sd = map_charid2sd(dlist->third_charid);
if( sd && drop_rate <= sd->state.autoloot
#ifdef AUTOLOOT_DISTANCE
&& check_distance_blxy(&sd->bl, dlist->x, dlist->y, AUTOLOOT_DISTANCE)
#endif
) { //Autoloot.
if (party_share_loot(party_search(sd->status.party_id),
- sd, &ditem->item_data, sd->bl.id) == 0
+ sd, &ditem->item_data, sd->status.char_id) == 0
) {
ers_free(item_drop_ers, ditem);
return;
@@ -1986,11 +1986,11 @@ 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_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->first_charid = (mvp_sd ? mvp_sd->status.char_id : 0);
+ dlist->second_charid = (second_sd ? second_sd->status.char_id : 0);
+ dlist->third_charid = (third_sd ? third_sd->status.char_id : 0);
dlist->item = NULL;
-
+
for (i = 0; i < MAX_MOB_DROP; i++)
{
if (md->db->dropitem[i].nameid <= 0)
@@ -2094,9 +2094,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_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->first_charid = (mvp_sd ? mvp_sd->status.char_id : 0);
+ dlist->second_charid = (second_sd ? second_sd->status.char_id : 0);
+ dlist->third_charid = (third_sd ? third_sd->status.char_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);
@@ -2163,7 +2163,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->bl.id,(second_sd?second_sd->bl.id:0),(third_sd?third_sd->bl.id:0),1);
+ map_addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1);
}
if(log_config.enable_logs&0x200) {//Logs items, MVP prizes [Lupus]
diff --git a/src/map/mob.h b/src/map/mob.h
index a3b589964..367640e07 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -143,7 +143,7 @@ struct item_drop {
};
struct item_drop_list {
int m, x, y; // coordinates
- int first_id, second_id, third_id; // id's of players with higher pickup priority
+ int first_charid, second_charid, third_charid; // charid's of players with higher pickup priority
struct item_drop* item; // linked list of drops
};
diff --git a/src/map/party.c b/src/map/party.c
index 020d02e22..3cac19240 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -763,12 +763,12 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b
return 0;
}
-//Does party loot. first holds the id of the player who has time priority to take the item.
-int party_share_loot(struct party_data* p, struct map_session_data* sd, struct item* item_data, int first)
+//Does party loot. first_charid holds the charid of the player who has time priority to take the item.
+int party_share_loot(struct party_data* p, struct map_session_data* sd, struct item* item_data, int first_charid)
{
TBL_PC* target = NULL;
int i;
- if (p && p->party.item&2 && (first || !(battle_config.party_share_type&1)))
+ if (p && p->party.item&2 && (first_charid || !(battle_config.party_share_type&1)))
{
//item distribution to party members.
if (battle_config.party_share_type&2)
diff --git a/src/map/party.h b/src/map/party.h
index cb38c9d10..b3a5b9a4c 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -44,7 +44,7 @@ int party_check_conflict(struct map_session_data *sd);
int party_skill_check(struct map_session_data *sd, int party_id, int skillid, int skilllv);
int party_send_xy_clear(struct party_data *p);
int party_exp_share(struct party_data *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny);
-int party_share_loot(struct party_data* p, struct map_session_data* sd, struct item* item_data, int first);
+int party_share_loot(struct party_data* p, struct map_session_data* sd, struct item* item_data, int first_charid);
int party_send_dot_remove(struct map_session_data *sd);
int party_sub_count(struct block_list *bl, va_list ap);
int party_foreachsamemap(int (*func)(struct block_list *,va_list),struct map_session_data *sd,int type,...);
diff --git a/src/map/pc.c b/src/map/pc.c
index 185641915..aafc2260b 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2919,9 +2919,9 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
if (sd->status.party_id)
p = party_search(sd->status.party_id);
- if(fitem->first_get_id > 0 && fitem->first_get_id != sd->bl.id)
+ if(fitem->first_get_charid > 0 && fitem->first_get_charid != sd->status.char_id)
{
- first_sd = map_id2sd(fitem->first_get_id);
+ first_sd = map_charid2sd(fitem->first_get_charid);
if(DIFF_TICK(tick,fitem->first_get_tick) < 0) {
if (!(p && p->party.item&1 &&
first_sd && first_sd->status.party_id == sd->status.party_id
@@ -2929,9 +2929,9 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
return 0;
}
else
- if(fitem->second_get_id > 0 && fitem->second_get_id != sd->bl.id)
+ if(fitem->second_get_charid > 0 && fitem->second_get_charid != sd->status.char_id)
{
- second_sd = map_id2sd(fitem->second_get_id);
+ second_sd = map_charid2sd(fitem->second_get_charid);
if(DIFF_TICK(tick, fitem->second_get_tick) < 0) {
if(!(p && p->party.item&1 &&
((first_sd && first_sd->status.party_id == sd->status.party_id) ||
@@ -2940,9 +2940,9 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
return 0;
}
else
- if(fitem->third_get_id > 0 && fitem->third_get_id != sd->bl.id)
+ if(fitem->third_get_charid > 0 && fitem->third_get_charid != sd->status.char_id)
{
- third_sd = map_id2sd(fitem->third_get_id);
+ third_sd = map_charid2sd(fitem->third_get_charid);
if(DIFF_TICK(tick,fitem->third_get_tick) < 0) {
if(!(p && p->party.item&1 &&
((first_sd && first_sd->status.party_id == sd->status.party_id) ||
@@ -2956,7 +2956,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
}
//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, fitem->first_get_id))) {
+ if ((flag = party_share_loot(p,sd,&fitem->item_data, fitem->first_get_charid))) {
clif_additem(sd,0,0,flag);
return 1;
}
diff --git a/src/map/pet.c b/src/map/pet.c
index ac369bff5..0b7da5da2 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -997,14 +997,14 @@ static int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap)
struct pet_data* pd;
struct flooritem_data *fitem = (struct flooritem_data *)bl;
struct block_list **target;
- int sd_id =0;
+ int sd_charid =0;
pd=va_arg(ap,struct pet_data *);
target=va_arg(ap,struct block_list**);
- sd_id = fitem->first_get_id;
+ sd_charid = fitem->first_get_charid;
- if(sd_id && sd_id != pd->msd->bl.id)
+ if(sd_charid && sd_charid != pd->msd->status.char_id)
return 0;
if(unit_can_reach_bl(&pd->bl,bl, pd->db->range2, 1, NULL, NULL) &&
@@ -1028,7 +1028,7 @@ static int pet_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_id,list->second_id,list->third_id,0);
+ list->first_charid,list->second_charid,list->third_charid,0);
ditem_prev = ditem;
ditem = ditem->next;
ers_free(item_drop_ers, ditem_prev);
@@ -1049,9 +1049,9 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
dlist->m = pd->bl.m;
dlist->x = pd->bl.x;
dlist->y = pd->bl.y;
- dlist->first_id = 0;
- dlist->second_id = 0;
- dlist->third_id = 0;
+ dlist->first_charid = 0;
+ dlist->second_charid = 0;
+ dlist->third_charid = 0;
dlist->item = NULL;
for(i=0;i<pd->loot->count;i++) {