From c4440e3c08e160324b0ca14c3b0c91179d8da85c Mon Sep 17 00:00:00 2001 From: Kenpachi Developer Date: Sun, 23 Feb 2020 07:26:11 +0100 Subject: 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. --- src/map/pc.c | 35 ++++++++++++++++++----------------- 1 file 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; } -- cgit v1.2.3-60-g2f50