summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-02-23 07:26:11 +0100
committerKenpachi Developer <Kenpachi.Developer@gmx.de>2020-03-07 02:05:51 +0100
commit0dc3bea686d4b81b4d645365794458cf51def766 (patch)
tree810e089faff7e95c2b398697e57bd426d5561054 /src/map/pc.c
parent3780c36cddcf5e745c800482f92e163da7a14896 (diff)
downloadhercules-0dc3bea686d4b81b4d645365794458cf51def766.tar.gz
hercules-0dc3bea686d4b81b4d645365794458cf51def766.tar.bz2
hercules-0dc3bea686d4b81b4d645365794458cf51def766.tar.xz
hercules-0dc3bea686d4b81b4d645365794458cf51def766.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.
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c35
1 files 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;
}