Skip to content

Commit

Permalink
Resolved enchants not executing unequip script (#2676)
Browse files Browse the repository at this point in the history
* Fixes #2668.
* Fixes enchant items not properly calling the unequip item script.
Thanks to @admkakaroto and @mrjnumber1!
  • Loading branch information
aleos89 committed Dec 15, 2017
1 parent 377ca75 commit b3e67d2
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/map/pc.cpp
Expand Up @@ -9856,7 +9856,7 @@ bool pc_equipitem(struct map_session_data *sd,short n,int req_pos)
if(itemdb_isspecial(sd->inventory.u.items_inventory[n].card[0]))
; //No cards
else {
for( i = 0; i < id->slot; i++ ) {
for( i = 0; i < MAX_SLOTS; i++ ) {
struct item_data *data;
if (!sd->inventory.u.items_inventory[n].card[i])
continue;
Expand All @@ -9879,7 +9879,7 @@ bool pc_equipitem(struct map_session_data *sd,short n,int req_pos)
if(itemdb_isspecial(sd->inventory.u.items_inventory[n].card[0]))
; //No cards
else {
for( i = 0; i < id->slot; i++ ) {
for( i = 0; i < MAX_SLOTS; i++ ) {
struct item_data *data;
if (!sd->inventory.u.items_inventory[n].card[i])
continue;
Expand All @@ -9905,7 +9905,7 @@ bool pc_equipitem(struct map_session_data *sd,short n,int req_pos)
*------------------------------------------*/
bool pc_unequipitem(struct map_session_data *sd, int n, int flag) {
int i, iflag;
bool status_cacl = false;
bool status_calc = false;

nullpo_retr(false,sd);

Expand Down Expand Up @@ -9993,26 +9993,27 @@ bool pc_unequipitem(struct map_session_data *sd, int n, int flag) {
if ( sd->inventory_data[n] ) {
if( sd->inventory_data[n]->combos_count ) {
if( pc_removecombo(sd,sd->inventory_data[n]) )
status_cacl = true;
} if(itemdb_isspecial(sd->inventory.u.items_inventory[n].card[0]))
status_calc = true;
}
if(itemdb_isspecial(sd->inventory.u.items_inventory[n].card[0]))
; //No cards
else {
for( i = 0; i < sd->inventory_data[n]->slot; i++ ) {
for( i = 0; i < MAX_SLOTS; i++ ) {
struct item_data *data;

if (!sd->inventory.u.items_inventory[n].card[i])
continue;
if ( ( data = itemdb_exists(sd->inventory.u.items_inventory[n].card[i]) ) != NULL ) {
if( data->combos_count ) {
if( pc_removecombo(sd,data) )
status_cacl = true;
status_calc = true;
}
}
}
}
}

if(flag&1 || status_cacl) {
if(flag&1 || status_calc) {
pc_checkallowskill(sd);
status_calc_pc(sd,SCO_NONE);
}
Expand All @@ -10027,7 +10028,7 @@ bool pc_unequipitem(struct map_session_data *sd, int n, int flag) {
if(itemdb_isspecial(sd->inventory.u.items_inventory[n].card[0]))
; //No cards
else {
for( i = 0; i < sd->inventory_data[n]->slot; i++ ) {
for( i = 0; i < MAX_SLOTS; i++ ) {
struct item_data *data;
if (!sd->inventory.u.items_inventory[n].card[i])
continue;
Expand Down

0 comments on commit b3e67d2

Please sign in to comment.