Fixed bugreport:6407 combos are now properly recalculated when a item is switched. special thanks to emong
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16573 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
337642f4d9
commit
cff0a579e2
53
src/map/pc.c
53
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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user