diff options
author | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-08-04 04:22:55 +0000 |
---|---|---|
committer | shennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-08-04 04:22:55 +0000 |
commit | edb5d96b78eeef3ba06d92f57e737974f50550ba (patch) | |
tree | 7b2b234482f3f48efe9aff517335f8bece9ff602 /src/map/pc.c | |
parent | ad447d52486b0ce14082b689569ac5b2f23873a1 (diff) | |
download | hercules-edb5d96b78eeef3ba06d92f57e737974f50550ba.tar.gz hercules-edb5d96b78eeef3ba06d92f57e737974f50550ba.tar.bz2 hercules-edb5d96b78eeef3ba06d92f57e737974f50550ba.tar.xz hercules-edb5d96b78eeef3ba06d92f57e737974f50550ba.zip |
Fixed bugreport:6407 combos are now properly recalculated when a item is switched. special thanks to emong
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16573 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index e3c7840ef..7683166b6 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -7954,11 +7954,11 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) { } /* called when a item with combo is removed */ -void pc_removecombo(struct map_session_data *sd, struct item_data *data ) { - int i; +int pc_removecombo(struct map_session_data *sd, struct item_data *data ) { + int i, retval = 0; if( sd->combos.bonus == NULL ) - return;/* nothing to do here, player has no combos */ + return 0;/* nothing to do here, player has no combos */ for( i = 0; i < data->combos_count; i++ ) { /* check if this combo exists in this user */ int x = 0, cursor = 0, j; @@ -7969,7 +7969,7 @@ void pc_removecombo(struct map_session_data *sd, struct item_data *data ) { sd->combos.bonus[x] = NULL; sd->combos.id[x] = 0; - + retval++; for( j = 0, cursor = 0; j < sd->combos.count; j++ ) { if( sd->combos.bonus[j] == NULL ) continue; @@ -7988,11 +7988,12 @@ void pc_removecombo(struct map_session_data *sd, struct item_data *data ) { aFree(sd->combos.id); sd->combos.bonus = NULL; sd->combos.id = NULL; - return; /* we also can return at this point for we have no more combos to check */ + return retval; /* we also can return at this point for we have no more combos to check */ } } + return retval; } int pc_load_combo(struct map_session_data *sd) { int i, ret = 0; @@ -8226,9 +8227,9 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) * 1 - calculate status after unequipping * 2 - force unequip *------------------------------------------*/ -int pc_unequipitem(struct map_session_data *sd,int n,int flag) -{ +int pc_unequipitem(struct map_session_data *sd,int n,int flag) { int i; + bool status_cacl = false; nullpo_ret(sd); if( n < 0 || n >= MAX_INVENTORY ) { @@ -8327,28 +8328,30 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) sd->status.inventory[n].equip=0; - if(flag&1) { - - /* check for combos (MUST be before status_calc_pc) */ - if ( sd->inventory_data[n] ) { - struct item_data *data; - - if( sd->inventory_data[n]->combos_count ) - pc_removecombo(sd,sd->inventory_data[n]); - if(itemdb_isspecial(sd->status.inventory[n].card[0])) - ; //No cards - else { - for( i = 0; i < sd->inventory_data[n]->slot; i++ ) { - if (!sd->status.inventory[n].card[i]) - continue; - if ( ( data = itemdb_exists(sd->status.inventory[n].card[i]) ) != NULL ) { - if( data->combos_count ) - pc_removecombo(sd,data); + /* check for combos (MUST be before status_calc_pc) */ + if ( sd->inventory_data[n] ) { + struct item_data *data; + + if( sd->inventory_data[n]->combos_count ) { + if( pc_removecombo(sd,sd->inventory_data[n]) ) + status_cacl = true; + } if(itemdb_isspecial(sd->status.inventory[n].card[0])) + ; //No cards + else { + for( i = 0; i < sd->inventory_data[n]->slot; i++ ) { + if (!sd->status.inventory[n].card[i]) + continue; + if ( ( data = itemdb_exists(sd->status.inventory[n].card[i]) ) != NULL ) { + if( data->combos_count ) { + if( pc_removecombo(sd,data) ) + status_cacl = true; } } } } - + } + + if(flag&1 || status_cacl) { pc_checkallowskill(sd); status_calc_pc(sd,0); } |