diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-02-23 07:26:11 +0100 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-02-15 17:25:22 -0300 |
commit | c4440e3c08e160324b0ca14c3b0c91179d8da85c (patch) | |
tree | cf2efc49fa9376be97d3c259b4eba4123865b7d7 | |
parent | 9a9435bba174c0652d88aac7619add73ef918ac1 (diff) | |
download | hercules-c4440e3c08e160324b0ca14c3b0c91179d8da85c.tar.gz hercules-c4440e3c08e160324b0ca14c3b0c91179d8da85c.tar.bz2 hercules-c4440e3c08e160324b0ca14c3b0c91179d8da85c.tar.xz hercules-c4440e3c08e160324b0ca14c3b0c91179d8da85c.zip |
Change execution order in pc_isequip() function
Validating, if the item is disabled by the map's zone, should be done prior to the validation of the character's status changes.
If not, equipment, enabled by Super Novice Spirit, is able to bypass the map zone restriction.
-rw-r--r-- | src/map/pc.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index b34c927a2..f862a739d 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1051,6 +1051,24 @@ static int pc_isequip(struct map_session_data *sd, int n) return 0; } } + + if ( battle_config.unequip_restricted_equipment & 1 ) { + int i; + for ( i = 0; i < map->list[sd->bl.m].zone->disabled_items_count; i++ ) + if ( map->list[sd->bl.m].zone->disabled_items[i] == sd->status.inventory[n].nameid ) + return 0; + } + + if ( battle_config.unequip_restricted_equipment & 2 ) { + if ( !itemdb_isspecial( sd->status.inventory[n].card[0] ) ) { + int i, slot; + for ( slot = 0; slot < MAX_SLOTS; slot++ ) + for ( i = 0; i < map->list[sd->bl.m].zone->disabled_items_count; i++ ) + if ( map->list[sd->bl.m].zone->disabled_items[i] == sd->status.inventory[n].card[slot] ) + return 0; + } + } + if (sd->sc.count) { if(item->equip & EQP_ARMS && item->type == IT_WEAPON && sd->sc.data[SC_NOEQUIPWEAPON]) // Also works with left-hand weapons [DracoRPG] @@ -1106,23 +1124,6 @@ static int pc_isequip(struct map_session_data *sd, int n) return 0; } - if ( battle_config.unequip_restricted_equipment & 1 ) { - int i; - for ( i = 0; i < map->list[sd->bl.m].zone->disabled_items_count; i++ ) - if ( map->list[sd->bl.m].zone->disabled_items[i] == sd->status.inventory[n].nameid ) - return 0; - } - - if ( battle_config.unequip_restricted_equipment & 2 ) { - if ( !itemdb_isspecial( sd->status.inventory[n].card[0] ) ) { - int i, slot; - for ( slot = 0; slot < MAX_SLOTS; slot++ ) - for ( i = 0; i < map->list[sd->bl.m].zone->disabled_items_count; i++ ) - if ( map->list[sd->bl.m].zone->disabled_items[i] == sd->status.inventory[n].card[slot] ) - return 0; - } - } - return 1; } |