conf/battle/items.conf | 7 +++++++ src/map/battle.c | 1 + src/map/battle.h | 1 + src/map/clif.c | 27 +++++++++++++++++++++++++++ src/map/pc.c | 34 ++++++++++++++++------------------ 5 files changed, 52 insertions(+), 18 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/clif.c b/src/map/clif.c index c61a725..b8023e9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9493,6 +9493,33 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) { clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF); } + if ( battle_config.unequip_restricted_equipment & 1 ) { + int i, j, n; + for ( i = 0; i < EQI_MAX; i++ ) { + if ( sd->equip_index[i] >= 0 ) { + n = sd->equip_index[i]; + 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[n].nameid ) + pc->unequipitem( sd, n, 2 ); + } + } + } + + if ( battle_config.unequip_restricted_equipment & 2 ) { + int i, j, n, slot; + for ( i = 0; i < EQI_MAX; i++ ) { + if ( sd->equip_index[i] >= 0 ) { + n = sd->equip_index[i]; + if ( !itemdb_isspecial( sd->status.inventory[n].card[0] ) ) { + 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[n].card[slot] ) + pc->unequipitem( sd, n, 2 ); + } + } + } + } + map->iwall_get(sd); // Updates Walls Info on this Map to Client status_calc_pc(sd, SCO_NONE);/* some conditions are map-dependent so we must recalculate */ sd->state.changemap = false; diff --git a/src/map/pc.c b/src/map/pc.c index 87f14bc..b4f8800 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) { @@ -8654,6 +8636,22 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) return 0; } + if ( battle_config.unequip_restricted_equipment & 1 ) { + 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 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; + } + } + /* won't fail from this point onwards */ if( id->flag.bindonequip && !sd->status.inventory[n].bound ) { sd->status.inventory[n].bound = (unsigned char)IBT_CHARACTER;