Follow-up fc48f92, which is oppsite of r17119. (Euphy's fault :P)
- Config naming changed: 'item_restricted_consumption_type' to 'allow_consume_restricted_item' (conf/battle/items.conf)
- Add 'allow_equip_restricted_item' config to allow/disallow player use item that restricted. Default is yes, restricted item can be equipped but gives no script effect (related r17119) (conf/battle/items.conf)
- Moves item_nouse check to itemdb_isNoEquip
- PC_PERM_USE_ALL_EQUIPMENT is now can be used to bypass item no_equip flag for equipment (also card) to run the item script
- PC_PERM_ITEM_UNCONDITIONAL is now can be used to bypass item no_equip flag for consumable item to run the item script
Fixed typo issue on ef4fd59
(ef4fd59996 (commitcomment-3962459)
)
This commit is contained in:
parent
ef4fd59996
commit
15074d8c37
@ -76,8 +76,16 @@ gtb_sc_immunity: 50
|
||||
// always work independently of each other regardless of setting.
|
||||
autospell_stacking: no
|
||||
|
||||
// Will disabled consumables (disabled by item_noequip.txt) be consumed when trying to use them? (Note 1)
|
||||
item_restricted_consumption_type: yes
|
||||
// Allow to consume usable item that is disabled by item_noequip.txt. (Note 1)
|
||||
// no = will be failed to consume
|
||||
// yes = consumed with no effect
|
||||
allow_consume_restricted_item: yes
|
||||
|
||||
// Allow to equip item that is disabled by item_noequip.txt. (Note 1)
|
||||
// no = can't be equipped and will be unequipped
|
||||
// yes = can be equipped but gives no effect
|
||||
// If the equip compounded with restricted card, it ignores this check but still gives no effect
|
||||
allow_equip_restricted_item: yes
|
||||
|
||||
// Allow changing of equipment while interacting with NPCs? (Note 1)
|
||||
// Default: yes
|
||||
|
@ -52,7 +52,7 @@ help:
|
||||
|
||||
char-server: obj_sql $(CHAR_SQL_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a
|
||||
@echo " LD @OCHR@@EXEEXT@"
|
||||
@@CC@ @LDFLAGS@ -o ../../@OCHR@@EXEEXT@ $(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
|
||||
@@CC@ @LDFLAGS@ -o ../../@OCHR@@EXEEXT@ $(CHAR_SQL_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@
|
||||
|
||||
needs_mysql:
|
||||
@echo "MySQL not found or disabled by the configure script"
|
||||
|
@ -6882,7 +6882,8 @@ static const struct _battle_data {
|
||||
{ "homunculus_S_max_level", &battle_config.hom_S_max_level, 150, 0, MAX_LEVEL, },
|
||||
{ "mob_size_influence", &battle_config.mob_size_influence, 0, 0, 1, },
|
||||
{ "skill_trap_type", &battle_config.skill_trap_type, 0, 0, 1, },
|
||||
{ "item_restricted_consumption_type", &battle_config.item_restricted_consumption_type,1, 0, 1, },
|
||||
{ "allow_consume_restricted_item", &battle_config.allow_consume_restricted_item, 1, 0, 1, },
|
||||
{ "allow_equip_restricted_item", &battle_config.allow_equip_restricted_item, 1, 0, 1, },
|
||||
{ "max_walk_path", &battle_config.max_walk_path, 17, 1, MAX_WALKPATH, },
|
||||
{ "item_enabled_npc", &battle_config.item_enabled_npc, 1, 0, 1, },
|
||||
{ "item_flooritem_check", &battle_config.item_onfloor, 1, 0, 1, },
|
||||
|
@ -488,7 +488,8 @@ extern struct Battle_Config
|
||||
|
||||
int mob_size_influence; // Enable modifications on earned experience, drop rates and monster status depending on monster size. [mkbu95]
|
||||
int skill_trap_type;
|
||||
int item_restricted_consumption_type;
|
||||
int allow_consume_restricted_item;
|
||||
int allow_equip_restricted_item;
|
||||
int max_walk_path;
|
||||
int item_enabled_npc;
|
||||
int item_onfloor; // Whether to drop an undroppable item on the map or destroy it if inventory is full.
|
||||
|
@ -1324,6 +1324,25 @@ int itemdb_uid_load(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Check if the item is restricted by item_noequip.txt (return):
|
||||
* true - can't be used
|
||||
* false - can be used
|
||||
*------------------------------------------*/
|
||||
bool itemdb_isNoEquip(struct item_data *id, uint16 m) {
|
||||
if (!id->flag.no_equip)
|
||||
return false;
|
||||
/* on restricted maps the item is consumed but the effect is not used */
|
||||
if ((!map_flag_vs(m) && id->flag.no_equip&1) || // Normal
|
||||
(map[m].flag.pvp && id->flag.no_equip&2) || // PVP
|
||||
(map_flag_gvg(m) && id->flag.no_equip&4) || // GVG
|
||||
(map[m].flag.battleground && id->flag.no_equip&8) || // Battleground
|
||||
(map[m].flag.restricted && id->flag.no_equip&(8*map[m].zone)) // Zone restriction
|
||||
)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*====================================
|
||||
* read all item-related databases
|
||||
*------------------------------------*/
|
||||
|
@ -239,6 +239,7 @@ int itemdb_isidentified(int);
|
||||
int itemdb_isstackable(int);
|
||||
int itemdb_isstackable2(struct item_data *);
|
||||
uint64 itemdb_unique_id(int8 flag, int64 value); // Unique Item ID
|
||||
bool itemdb_isNoEquip(struct item_data *id, uint16 m);
|
||||
|
||||
void itemdb_reload(void);
|
||||
|
||||
|
27
src/map/pc.c
27
src/map/pc.c
@ -947,14 +947,9 @@ int pc_isequip(struct map_session_data *sd,int n)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* restricted equip */
|
||||
if ((!map_flag_vs(sd->bl.m) && item->flag.no_equip&1) || // Normal
|
||||
(map[sd->bl.m].flag.pvp && item->flag.no_equip&2) || // PVP
|
||||
(map_flag_gvg(sd->bl.m) && item->flag.no_equip&4) || // GVG
|
||||
(map[sd->bl.m].flag.battleground && item->flag.no_equip&8) || // Battleground
|
||||
(map[sd->bl.m].flag.restricted && item->flag.no_equip&(8*map[sd->bl.m].zone)) // Zone restriction
|
||||
)
|
||||
|
||||
//fail to equip if item is restricted
|
||||
if (itemdb_isNoEquip(item, sd->bl.m) && !battle_config.allow_equip_restricted_item)
|
||||
return 0;
|
||||
|
||||
//Not equipable by class. [Skotlex]
|
||||
@ -4463,14 +4458,8 @@ int pc_useitem(struct map_session_data *sd,int n)
|
||||
}
|
||||
|
||||
/* on restricted maps the item is consumed but the effect is not used */
|
||||
if (!pc_has_permission(sd,PC_PERM_ITEM_UNCONDITIONAL) && (
|
||||
(!map_flag_vs(sd->bl.m) && id->flag.no_equip&1) || // Normal
|
||||
(map[sd->bl.m].flag.pvp && id->flag.no_equip&2) || // PVP
|
||||
(map_flag_gvg(sd->bl.m) && id->flag.no_equip&4) || // GVG
|
||||
(map[sd->bl.m].flag.battleground && id->flag.no_equip&8) || // Battleground
|
||||
(map[sd->bl.m].flag.restricted && id->flag.no_equip&(8*map[sd->bl.m].zone)) // Zone restriction
|
||||
)) {
|
||||
if( battle_config.item_restricted_consumption_type ) {
|
||||
if (!pc_has_permission(sd,PC_PERM_ITEM_UNCONDITIONAL) && itemdb_isNoEquip(id,sd->bl.m)) {
|
||||
if( battle_config.allow_consume_restricted_item ) {
|
||||
clif_useitemack(sd,n,item.amount-1,true);
|
||||
pc_delitem(sd,n,1,1,0,LOG_TYPE_CONSUME);
|
||||
}
|
||||
@ -8648,6 +8637,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
|
||||
|
||||
if(battle_config.battle_log)
|
||||
ShowInfo("equip %d(%d) %x:%x\n",sd->status.inventory[n].nameid,n,id?id->equip:0,req_pos);
|
||||
|
||||
if(!pc_isequip(sd,n) || !(pos&req_pos) || sd->status.inventory[n].equip != 0 || sd->status.inventory[n].attribute==1 ) { // [Valaris]
|
||||
// FIXME: pc_isequip: equip level failure uses 2 instead of 0
|
||||
clif_equipitemack(sd,n,0,0); // fail
|
||||
@ -8806,7 +8796,8 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
|
||||
|
||||
//OnEquip script [Skotlex]
|
||||
if (id) {
|
||||
if (id->equip_script)
|
||||
//only run the script if item isn't restricted
|
||||
if (id->equip_script && (!id->flag.no_equip || (id->flag.no_equip && itemdb_isNoEquip(id, sd->bl.m) && pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))))
|
||||
run_script(id->equip_script,0,sd->bl.id,fake_nd->bl.id);
|
||||
if(itemdb_isspecial(sd->status.inventory[n].card[0]))
|
||||
; //No cards
|
||||
@ -8816,7 +8807,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
|
||||
if (!sd->status.inventory[n].card[i])
|
||||
continue;
|
||||
if ( ( data = itemdb_exists(sd->status.inventory[n].card[i]) ) != NULL ) {
|
||||
if( data->equip_script )
|
||||
if( data->equip_script && (!data->flag.no_equip || (data->flag.no_equip && itemdb_isNoEquip(data, sd->bl.m) && pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT))))
|
||||
run_script(data->equip_script,0,sd->bl.id,fake_nd->bl.id);
|
||||
}
|
||||
}
|
||||
|
@ -2461,18 +2461,8 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
|
||||
if(!sd->inventory_data[index])
|
||||
continue;
|
||||
|
||||
if(sd->inventory_data[index]->flag.no_equip) { // Items may be equipped, their effects however are nullified.
|
||||
if(map[sd->bl.m].flag.restricted && sd->inventory_data[index]->flag.no_equip&(8*map[sd->bl.m].zone))
|
||||
continue;
|
||||
if(!map_flag_vs(sd->bl.m) && sd->inventory_data[index]->flag.no_equip&1)
|
||||
continue;
|
||||
if(map[sd->bl.m].flag.pvp && sd->inventory_data[index]->flag.no_equip&2)
|
||||
continue;
|
||||
if(map_flag_gvg(sd->bl.m) && sd->inventory_data[index]->flag.no_equip&4)
|
||||
continue;
|
||||
if(map[sd->bl.m].flag.battleground && sd->inventory_data[index]->flag.no_equip&8)
|
||||
continue;
|
||||
}
|
||||
if(!pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT) && sd->inventory_data[index]->flag.no_equip && itemdb_isNoEquip(sd->inventory_data[index], sd->bl.m)) // Items may be equipped, their effects however are nullified.
|
||||
continue;
|
||||
|
||||
status->def += sd->inventory_data[index]->def;
|
||||
|
||||
@ -2615,18 +2605,8 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
|
||||
}
|
||||
if(!data->script)
|
||||
continue;
|
||||
if(data->flag.no_equip) { //Card restriction checks.
|
||||
if(map[sd->bl.m].flag.restricted && data->flag.no_equip&(8*map[sd->bl.m].zone))
|
||||
continue;
|
||||
if(!map_flag_vs(sd->bl.m) && data->flag.no_equip&1)
|
||||
continue;
|
||||
if(map[sd->bl.m].flag.pvp && data->flag.no_equip&2)
|
||||
continue;
|
||||
if(map_flag_gvg(sd->bl.m) && data->flag.no_equip&4)
|
||||
continue;
|
||||
if(map[sd->bl.m].flag.battleground && data->flag.no_equip&8)
|
||||
continue;
|
||||
}
|
||||
if(!pc_has_permission(sd, PC_PERM_USE_ALL_EQUIPMENT) && data->flag.no_equip && itemdb_isNoEquip(data, sd->bl.m)) //Card restriction checks.
|
||||
continue;
|
||||
if(i == EQI_HAND_L && sd->status.inventory[index].equip == EQP_HAND_L)
|
||||
{ //Left hand status.
|
||||
sd->state.lr_flag = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user