Skip to content

Commit

Permalink
Suggestion added for disabling equipment & card effects
Browse files Browse the repository at this point in the history
- Suggestion:
http://hercules.ws/board/topic/334-suggestion-for-restricted-equipment-m
aking-a-new-conf-for-it/
- This can unequip an equipment; nullify the card’s effects
- Special thanks to AnnieRuru!
  • Loading branch information
FlippAcademy committed Mar 9, 2014
1 parent d659deb commit e3ca253
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 18 deletions.
7 changes: 7 additions & 0 deletions conf/battle/items.conf
Expand Up @@ -86,3 +86,10 @@ item_restricted_consumption_type:1
// 1 : yes(official)
// 0 : no
item_enabled_npc:1

// Unequip equipments that have been disabled inside map_zone_db.conf?
// 0 : disabled equipments and cards are nullified (official)
// 1 : disabled equipments are unequipped, disabled cards are nullified
// 2 : disabled equipments are nullified, disabled cards will cause the equipment to unequip
// 3 : disabled equipments are unequipped, disabled cards will cause the equipment to unequip (1+2)
unequip_restricted_equipment: 0
1 change: 1 addition & 0 deletions src/map/battle.c
Expand Up @@ -6721,6 +6721,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, },
Expand Down
1 change: 1 addition & 0 deletions src/map/battle.h
Expand Up @@ -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;
Expand Down
59 changes: 41 additions & 18 deletions src/map/pc.c
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -9074,6 +9073,30 @@ 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 ) {
Expand Down

0 comments on commit e3ca253

Please sign in to comment.