viewing paste topic/334- unequip_restricted2 | Diff

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
 conf/battle/items.conf |  7 ++++++
 src/map/battle.c       |  1 +
 src/map/battle.h       |  1 +
 src/map/pc.c           | 61 ++++++++++++++++++++++++++++++++++----------------
 4 files changed, 51 insertions(+), 19 deletions(-)
 
diff --git a/conf/battle/items.conf b/conf/battle/items.conf
index 3a4eb80..dc2374b 100644
--- a/conf/battle/items.conf
+++ b/conf/battle/items.conf
@@ -86,3 +86,10 @@ item_restricted_consumption_type:1
 // 1 : yes(official)
 // 0 : no
 item_enabled_npc:1
+
+// Unequip the equipments that has disabled by map_zone_db.conf ?
+// 0 : disabled equipments and cards are nullify (official)
+// 1 : disabled equipments are unequip, disabled cards are nullify
+// 2 : disabled equipments are nullify, disabled cards will caused the equipment to unequip
+// 3 : disabled equipments are unequip, disabled cards will caused the equipment to unequip (1+2)
+unequip_restricted_equipment: 0
\ No newline at end of file
diff --git a/src/map/battle.c b/src/map/battle.c
index 40f3d24..a300dae 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -6720,6 +6720,7 @@ bool battle_check_range(struct block_list *src, struct block_list *bl, int range
     **/
    { "skill_trap_type",                    &battle_config.skill_trap_type,                 0,      0,      1,              },
    { "item_restricted_consumption_type",   &battle_config.item_restricted_consumption_type,1,      0,      1,              },
+   { "unequip_restricted_equipment",       &battle_config.unequip_restricted_equipment,    0,      0,      3,              },
    { "max_walk_path",                      &battle_config.max_walk_path,                   17,     1,      MAX_WALKPATH,   },
    { "item_enabled_npc",                   &battle_config.item_enabled_npc,                1,      0,      1,              },
    { "gm_ignore_warpable_area",            &battle_config.gm_ignore_warpable_area,         0,      2,      100,            },
diff --git a/src/map/battle.h b/src/map/battle.h
index b57476c..955a26d 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -452,6 +452,7 @@ struct Battle_Config {
    /** Hercules **/
    int skill_trap_type;
    int item_restricted_consumption_type;
+   int unequip_restricted_equipment;
    int max_walk_path;
    int item_enabled_npc;
    int packet_obfuscation;
diff --git a/src/map/pc.c b/src/map/pc.c
index 87f14bc..485413b 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -752,24 +752,6 @@ int pc_setequipindex(struct map_session_data *sd)
 
    return 0;
 }
-//static int pc_isAllowedCardOn(struct map_session_data *sd,int s,int eqindex,int flag)
-//{
-// int i;
-// struct item *item = &sd->status.inventory[eqindex];
-// struct item_data *data;
-//
-// //Crafted/made/hatched items.
-// if (itemdb_isspecial(item->card[0]))
-//     return 1;
-//
-// /* scan for enchant armor gems */
-// if( item->card[MAX_SLOTS - 1] && s < MAX_SLOTS - 1 )
-//     s = MAX_SLOTS - 1;
-//
-// ARR_FIND( 0, s, i, item->card[i] && (data = itemdb->exists(item->card[i])) != NULL && data->flag.no_equip&flag );
-// return( i < s ) ? 0 : 1;
-//}
-
 
 bool pc_isequipped(struct map_session_data *sd, int nameid)
 {
@@ -958,6 +940,23 @@ 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;
 }
 
@@ -9074,8 +9073,32 @@ int pc_checkitem(struct map_session_data *sd)
            continue;
        }
 
+       if ( battle_config.unequip_restricted_equipment & 1 ) {
+           int j;
+           for ( j = 0; j < map->list[sd->bl.m].zone->disabled_items_count; j++ ) {
+               if ( map->list[sd->bl.m].zone->disabled_items[j] == sd->status.inventory[i].nameid ) {
+                   pc_unequipitem( sd, i, 2 );
+                   calc_flag = 1;
+               }
+           }
+       }
+
+       if ( battle_config.unequip_restricted_equipment & 2 ) {
+           if ( !itemdb_isspecial( sd->status.inventory[i].card[0] ) ) {
+               int j, slot;
+               for ( slot = 0; slot < MAX_SLOTS; slot++ ) {
+                   for ( j = 0; j < map->list[sd->bl.m].zone->disabled_items_count; j++ ) {
+                       if ( map->list[sd->bl.m].zone->disabled_items[j] == sd->status.inventory[i].card[slot] ) {
+                           pc_unequipitem( sd, i, 2 );
+                           calc_flag = 1;
+                       }
+                   }
+               }
+           }
+       }
+
    }
-       
+
    if( calc_flag && sd->state.active ) {
        pc->checkallowskill(sd);
        status_calc_pc(sd,SCO_NONE);
 
Viewed 1621 times, submitted by AnnieRuru.