- char_family now returns the char_id of the children when previously it would return true.

- Expanded the family check to work as it should, exp-share-range is respected, and the child is not considered for it (thanks to TheUltraMage for the investigation)


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9049 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-10-23 18:21:49 +00:00
parent 8b37134bc7
commit 70f2fde6ac
5 changed files with 42 additions and 29 deletions

View File

@ -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. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/10/23 2006/10/23
* Expanded the family check to work as it should, exp-share-range is
respected, and the child is not considered for it (thanks to TheUltraMage
for the investigation) [Skotlex]
* Double Casting will no longer fail when used. [Skotlex] * Double Casting will no longer fail when used. [Skotlex]
* Modified SC_STONE so that the duration of the "petrifying" time is 5 secs * Modified SC_STONE so that the duration of the "petrifying" time is 5 secs
reduced by your natural resistance to petrify (which is mdef%) [Skotlex] reduced by your natural resistance to petrify (which is mdef%) [Skotlex]

View File

@ -1792,15 +1792,15 @@ int char_family(int cid1, int cid2, int cid3) {
//we could do a lot more checks and force cross-reference integrity. //we could do a lot more checks and force cross-reference integrity.
if(char_dat[idx1].status.partner_id == cid2 && if(char_dat[idx1].status.partner_id == cid2 &&
char_dat[idx1].status.child == cid3) char_dat[idx1].status.child == cid3)
return 1; //cid1/cid2 parents. cid3 child. return cid3; //cid1/cid2 parents. cid3 child.
if(char_dat[idx1].status.partner_id == cid3 && if(char_dat[idx1].status.partner_id == cid3 &&
char_dat[idx1].status.child == cid2) char_dat[idx1].status.child == cid2)
return 1; //cid1/cid3 parents. cid2 child. return cid2; //cid1/cid3 parents. cid2 child.
if(char_dat[idx2].status.partner_id == cid3 && if(char_dat[idx2].status.partner_id == cid3 &&
char_dat[idx2].status.child == cid1) char_dat[idx2].status.child == cid1)
return 1; //cid2/cid3 parents. cid1 child. return cid1; //cid2/cid3 parents. cid1 child.
return 0; return 0;
} }

View File

@ -20,8 +20,8 @@ char party_txt[1024] = "save/party.txt";
struct party_data { struct party_data {
struct party party; struct party party;
unsigned int min_lv, max_lv; unsigned int min_lv, max_lv;
int family; //Is this party a family? if so, this holds the child id.
unsigned char size; //Total size of party. unsigned char size; //Total size of party.
unsigned family :1; //Is this party a family?
}; };
static struct dbt *party_db; static struct dbt *party_db;
@ -67,18 +67,13 @@ static void int_party_calc_state(struct party_data *p)
p->size = p->size =
p->family = 0; p->family = 0;
//Check party size, max/min levels. //Check party size.
for(i=0;i<MAX_PARTY;i++){ for(i=0;i<MAX_PARTY;i++){
lv=p->party.member[i].lv; if (!p->party.member[i].lv) continue;
if (!lv) continue;
p->size++; p->size++;
if(p->party.member[i].online) if(p->party.member[i].online)
{
if( lv < p->min_lv ) p->min_lv=lv;
if( p->max_lv < lv ) p->max_lv=lv;
p->party.count++; p->party.count++;
} }
}
if(p->size == 3) { if(p->size == 3) {
//Check Family State. //Check Family State.
p->family = char_family( p->family = char_family(
@ -87,6 +82,18 @@ static void int_party_calc_state(struct party_data *p)
p->party.member[2].char_id p->party.member[2].char_id
); );
} }
//max/min levels.
for(i=0;i<MAX_PARTY;i++){
lv=p->party.member[i].lv;
if (!lv) continue;
if(p->party.member[i].online &&
//On families, the kid is not counted towards exp share rules.
p->party.member[i].char_id != p->family)
{
if( lv < p->min_lv ) p->min_lv=lv;
if( p->max_lv < lv ) p->max_lv=lv;
}
}
if (p->party.exp && !party_check_exp_share(p)) { if (p->party.exp && !party_check_exp_share(p)) {
p->party.exp = 0; //Set off even share. p->party.exp = 0; //Set off even share.
@ -257,11 +264,9 @@ struct party_data* search_partyname(char *str) {
return p; return p;
} }
// EXP公平分配できるかチェック // Returns whether this party can keep having exp share or not.
int party_check_exp_share(struct party_data *p) { int party_check_exp_share(struct party_data *p) {
return (p->party.count == 0 || //If noone is online, don't mess with the share type. return (p->party.count < 2|| p->max_lv - p->min_lv <= party_share_level);
(p->family && p->party.count == 3) || //All 3 MUST be online for share to trigger.
p->max_lv - p->min_lv <= party_share_level);
} }
// パ?ティが空かどうかチェック // パ?ティが空かどうかチェック

View File

@ -4384,7 +4384,7 @@ int char_family(int pl1,int pl2,int pl3) {
(pl3 == partnerid && pl2 == childid) (pl3 == partnerid && pl2 == childid)
) { ) {
mysql_free_result (sql_res); mysql_free_result (sql_res);
return 1; return childid;
} }
} }
if(charid == pl2) { if(charid == pl2) {
@ -4392,7 +4392,7 @@ int char_family(int pl1,int pl2,int pl3) {
(pl3 == partnerid && pl1 == childid) (pl3 == partnerid && pl1 == childid)
) { ) {
mysql_free_result (sql_res); mysql_free_result (sql_res);
return 1; return childid;
} }
} }
if(charid == pl3) { if(charid == pl3) {
@ -4400,7 +4400,7 @@ int char_family(int pl1,int pl2,int pl3) {
(pl2 == partnerid && pl1 == childid) (pl2 == partnerid && pl1 == childid)
) { ) {
mysql_free_result (sql_res); mysql_free_result (sql_res);
return 1; return childid;
} }
} }
} }

View File

@ -18,8 +18,8 @@
struct party_data { struct party_data {
struct party party; struct party party;
unsigned int min_lv, max_lv; unsigned int min_lv, max_lv;
int family; //Is this party a family? if so, this holds the child id.
unsigned char size; //Total size of party. unsigned char size; //Total size of party.
unsigned family :1; //Is this party a family?
}; };
static struct party_data *party_pt; static struct party_data *party_pt;
@ -74,18 +74,13 @@ static void int_party_calc_state(struct party_data *p)
p->size = p->size =
p->family = 0; p->family = 0;
//Check party size, max/min levels. //Check party size
for(i=0;i<MAX_PARTY;i++){ for(i=0;i<MAX_PARTY;i++){
lv=p->party.member[i].lv; if (!p->party.member[i].lv) continue;
if (!lv) continue;
p->size++; p->size++;
if(p->party.member[i].online) if(p->party.member[i].online)
{
if( lv < p->min_lv ) p->min_lv=lv;
if( p->max_lv < lv ) p->max_lv=lv;
p->party.count++; p->party.count++;
} }
}
if(p->size == 3) { if(p->size == 3) {
//Check Family State. //Check Family State.
p->family = char_family( p->family = char_family(
@ -94,6 +89,18 @@ static void int_party_calc_state(struct party_data *p)
p->party.member[2].char_id p->party.member[2].char_id
); );
} }
//max/min levels.
for(i=0;i<MAX_PARTY;i++){
lv=p->party.member[i].lv;
if (!lv) continue;
if(p->party.member[i].online &&
//On families, the kid is not counted towards exp share rules.
p->party.member[i].char_id != p->family)
{
if( lv < p->min_lv ) p->min_lv=lv;
if( p->max_lv < lv ) p->max_lv=lv;
}
}
if (p->party.exp && !party_check_exp_share(p)) { if (p->party.exp && !party_check_exp_share(p)) {
p->party.exp = 0; //Set off even share. p->party.exp = 0; //Set off even share.
@ -346,9 +353,7 @@ struct party_data* search_partyname(char *str)
// Returns whether this party can keep having exp share or not. // Returns whether this party can keep having exp share or not.
int party_check_exp_share(struct party_data *p) int party_check_exp_share(struct party_data *p)
{ {
return (p->party.count == 0 || //If noone is online, don't mess with the share type. return (p->party.count < 2 || p->max_lv - p->min_lv <= party_share_level);
(p->family && p->party.count == 3) || //All 3 MUST be online for share to trigger.
p->max_lv - p->min_lv <= party_share_level);
} }
// Is there any member in the party? // Is there any member in the party?