diff options
author | Michieru <Michieru@users.noreply.github.com> | 2014-08-30 10:38:33 +0200 |
---|---|---|
committer | Michieru <Michieru@users.noreply.github.com> | 2014-08-30 10:38:33 +0200 |
commit | 4e68ad05a1ac9b586e58d89e8eaa2e9f8dd6614b (patch) | |
tree | a5bb47ceedaf4d182cd2fed1b95272f5c7eed06b /src/map | |
parent | f60c9bf671bf20885684e0146d6e51c72e9f1329 (diff) | |
parent | 33a43ec41542e25ee180bda430a3de4654a46b10 (diff) | |
download | hercules-4e68ad05a1ac9b586e58d89e8eaa2e9f8dd6614b.tar.gz hercules-4e68ad05a1ac9b586e58d89e8eaa2e9f8dd6614b.tar.bz2 hercules-4e68ad05a1ac9b586e58d89e8eaa2e9f8dd6614b.tar.xz hercules-4e68ad05a1ac9b586e58d89e8eaa2e9f8dd6614b.zip |
Merge pull request #330 from AnnieRuru/request_1
New Optional Configuration for unequipped disabled equipments
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/battle.c | 1 | ||||
-rw-r--r-- | src/map/battle.h | 1 | ||||
-rw-r--r-- | src/map/pc.c | 61 |
3 files changed, 44 insertions, 19 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index b869ad47c..e3b8bb40e 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6758,6 +6758,7 @@ static const struct battle_data { **/ { "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 dfa156796..8d1a3cd39 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -455,6 +455,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 a6619fad2..2372d3105 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -756,24 +756,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) { @@ -962,6 +944,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; } @@ -9238,8 +9237,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); |