From 0dc3bea686d4b81b4d645365794458cf51def766 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 d9cbc7b7b..8ccc989a8 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-70-g09d2