* 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://svn.code.sf.net/p/rathena/svn/trunk@11312 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
FlavioJS 2007-09-27 15:24:06 +00:00
parent 0498cb19c0
commit a8d7143d0e
12 changed files with 88 additions and 61 deletions

View File

@ -4,9 +4,12 @@ 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.
2007/09/27
* 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.
* Reimplemented mmo_char_fromsql using sql statements. (fixes bugreport:93)
* Fixed buildin_gethominfo not being included in the script engine. (bugreport:124)
* homunculus_evolution -> homevolution in script_commands.txt. (bugreport:125)
* homunculus_evolution -> homevolution in script_commands.txt.
* Deleted item DEFAULT from item_db.txt and regenerated item_db.sql. (bugreport:103)
* Skip empty lines and give more feedback (for invalid lines) when reading
item_db.txt/item_db2.txt. [FlavioJS]

36
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Revision: 11259 .
# From configure.in Revision: 11312 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61.
#
@ -1713,15 +1713,16 @@ if test "${with_mysql+set}" = set; then
withval=$with_mysql;
if test "$withval" = "no" ; then
want_mysql="no"
elif test "$withval" = "yes" ; then
want_mysql="yes"
else
want_mysql="yes"
MYSQL_CONFIG_HOME="$withval"
require_mysql="yes"
if test "$withval" != "yes" ; then
MYSQL_CONFIG_HOME="$withval"
fi
fi
else
want_mysql="yes"
want_mysql="yes" require_mysql="no"
fi
@ -1736,15 +1737,16 @@ if test "${with_pcre+set}" = set; then
withval=$with_pcre;
if test "$withval" = "no" ; then
want_pcre="no"
elif test "$withval" = "yes" ; then
want_pcre="yes"
else
want_pcre="yes"
PCRE_HOME="$withval"
require_pcre="yes"
if test "$withval" != "yes" ; then
PCRE_HOME="$withval"
fi
fi
else
want_pcre="yes"
want_pcre="yes" require_pcre="no"
fi
@ -3861,8 +3863,14 @@ echo "$as_me: error: $MYSQL_CONFIG_HOME reported that MySQL was compiled in 64bi
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
{ echo "$as_me:$LINENO: disabling MySQL (optional)" >&5
if test "$require_mysql" = "yes" ; then
{ { echo "$as_me:$LINENO: error: MySQL not found (requested)" >&5
echo "$as_me: error: MySQL not found (requested)" >&2;}
{ (exit 1); exit 1; }; }
else
{ echo "$as_me:$LINENO: disabling MySQL (optional)" >&5
echo "$as_me: disabling MySQL (optional)" >&6;}
fi
fi
fi
@ -4034,8 +4042,14 @@ echo "${ECHO_T}yes" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
{ echo "$as_me:$LINENO: disabling PCRE (optional)" >&5
if test "$require_pcre" = "yes" ; then
{ { echo "$as_me:$LINENO: error: PCRE not found (requested)" >&5
echo "$as_me: error: PCRE not found (requested)" >&2;}
{ (exit 1); exit 1; }; }
else
{ echo "$as_me:$LINENO: disabling PCRE (optional)" >&5
echo "$as_me: disabling PCRE (optional)" >&6;}
fi
fi
fi

View File

@ -23,14 +23,15 @@ AC_ARG_WITH(
[
if test "$withval" = "no" ; then
want_mysql="no"
elif test "$withval" = "yes" ; then
want_mysql="yes"
else
want_mysql="yes"
MYSQL_CONFIG_HOME="$withval"
require_mysql="yes"
if test "$withval" != "yes" ; then
MYSQL_CONFIG_HOME="$withval"
fi
fi
],
[want_mysql="yes"]
[want_mysql="yes" require_mysql="no"]
)
@ -46,14 +47,15 @@ AC_ARG_WITH(
[
if test "$withval" = "no" ; then
want_pcre="no"
elif test "$withval" = "yes" ; then
want_pcre="yes"
else
want_pcre="yes"
PCRE_HOME="$withval"
require_pcre="yes"
if test "$withval" != "yes" ; then
PCRE_HOME="$withval"
fi
fi
],
[want_pcre="yes"]
[want_pcre="yes" require_pcre="no"]
)
@ -176,7 +178,11 @@ else
fi
else
AC_MSG_RESULT([no])
AC_MSG_NOTICE([disabling MySQL (optional)])
if test "$require_mysql" = "yes" ; then
AC_MSG_ERROR([MySQL not found (requested)])
else
AC_MSG_NOTICE([disabling MySQL (optional)])
fi
fi
fi
@ -219,7 +225,11 @@ else
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_NOTICE([disabling PCRE (optional)])
if test "$require_pcre" = "yes" ; then
AC_MSG_ERROR([PCRE not found (requested)])
else
AC_MSG_NOTICE([disabling PCRE (optional)])
fi
fi
fi

View File

@ -4590,7 +4590,7 @@ summon "--ja--",-1;
---------------------------------------
* homunculus_evolution;
*homevolution;
This command will try to evolve the current player's homunculus.
If it doesn't work, the /swt emoticon is shown.

View File

@ -1549,7 +1549,7 @@ int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx
* item_dataÍamountˆÈŠOð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));

View File

@ -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);

View File

@ -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]

View File

@ -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
};

View File

@ -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)

View File

@ -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,...);

View File

@ -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;
}

View File

@ -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++) {