summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-02-03 18:31:21 -0200
committershennetsind <ind@henn.et>2013-02-03 18:31:21 -0200
commitcc8e005f27f3be0d7bcf8916cb40b2dd0e6a3ae1 (patch)
treeb422b4aa329582a2b54f2008ac3519b54637cfef /src
parent453d6cebeb3cde5fc58ed95c574e3a325d59b289 (diff)
downloadhercules-cc8e005f27f3be0d7bcf8916cb40b2dd0e6a3ae1.tar.gz
hercules-cc8e005f27f3be0d7bcf8916cb40b2dd0e6a3ae1.tar.bz2
hercules-cc8e005f27f3be0d7bcf8916cb40b2dd0e6a3ae1.tar.xz
hercules-cc8e005f27f3be0d7bcf8916cb40b2dd0e6a3ae1.zip
item_noequip overhaul / Fixed Bug #7048
Items are no longer unequipped when disabled by item_noequip.txt, instead their effects are nullified -- however cards in them, unless also disabled, wont have its effect nullified. Consumables will be consumed even while disabled, unless you modify the new config item_restricted_consumption_type http://hercules.ws/board/tracker/issue-7048-requestreport-regarding-to-item-noequiptxt/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/pc.c55
-rw-r--r--src/map/status.c14
4 files changed, 32 insertions, 39 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 4505b6a63..0506f2fe9 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -5867,6 +5867,7 @@ static const struct _battle_data {
* Hercules
**/
{ "skill_trap_type", &battle_config.skill_trap_type, 0, 0, 1, },
+ { "item_restricted_consumption_type", &battle_config.item_restricted_consumption_type,1, 0, 1, },
};
#ifndef STATS_OPT_OUT
/**
diff --git a/src/map/battle.h b/src/map/battle.h
index 0943b1aa3..c5ca19b90 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -484,6 +484,7 @@ 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;
} battle_config;
void do_init_battle(void);
diff --git a/src/map/pc.c b/src/map/pc.c
index 49b905c0d..6f608cd49 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -861,20 +861,6 @@ int pc_isequip(struct map_session_data *sd,int n)
#endif
if(item->sex != 2 && sd->status.sex != item->sex)
return 0;
- if(!map_flag_vs(sd->bl.m) && ((item->flag.no_equip&1)))
- return 0;
- if(map[sd->bl.m].flag.pvp && ((item->flag.no_equip&2)))
- return 0;
- if(map_flag_gvg(sd->bl.m) && ((item->flag.no_equip&4)))
- return 0;
- if(map[sd->bl.m].flag.battleground && ((item->flag.no_equip&8)))
- return 0;
- if(map[sd->bl.m].flag.restricted)
- {
- int flag =8*map[sd->bl.m].zone;
- if (item->flag.no_equip&flag)
- return 0;
- }
if (sd->sc.count) {
@@ -4134,16 +4120,6 @@ int pc_isUseitem(struct map_session_data *sd,int n)
else if( itemdb_is_poison(nameid) && (sd->class_&MAPID_THIRDMASK) != MAPID_GUILLOTINE_CROSS )
return 0;
- //added item_noequip.txt items check by Maya&[Lupus]
- 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
- )
- return 0;
-
//Gender check
if(item->sex != 2 && sd->status.sex != item->sex)
return 0;
@@ -4222,7 +4198,7 @@ int pc_useitem(struct map_session_data *sd,int n)
(itemdb_iscashfood(nameid) && DIFF_TICK(sd->canusecashfood_tick, tick) > 0)
)
return 0;
-
+
/* Items with delayed consume are not meant to work while in mounts except reins of mount(12622) */
if( sd->inventory_data[n]->flag.delay_consume ) {
if( nameid != ITEMID_REINS_OF_MOUNT && sd->sc.option&OPTION_MOUNTING )
@@ -4273,6 +4249,21 @@ int pc_useitem(struct map_session_data *sd,int n)
}
}
+ /* on restricted maps the item is consumed but the effect is not used */
+ if (
+ (!map_flag_vs(sd->bl.m) && sd->inventory_data[n]->flag.no_equip&1) || // Normal
+ (map[sd->bl.m].flag.pvp && sd->inventory_data[n]->flag.no_equip&2) || // PVP
+ (map_flag_gvg(sd->bl.m) && sd->inventory_data[n]->flag.no_equip&4) || // GVG
+ (map[sd->bl.m].flag.battleground && sd->inventory_data[n]->flag.no_equip&8) || // Battleground
+ (map[sd->bl.m].flag.restricted && sd->inventory_data[n]->flag.no_equip&(8*map[sd->bl.m].zone)) // Zone restriction
+ ) {
+ if( battle_config.item_restricted_consumption_type ) {
+ clif_useitemack(sd,n,sd->status.inventory[n].amount-1,true);
+ pc_delitem(sd,n,1,1,0,LOG_TYPE_CONSUME);
+ }
+ return 0;/* regardless, effect is not run */
+ }
+
sd->itemid = sd->status.inventory[n].nameid;
sd->itemindex = n;
if(sd->catch_target_class != -1) //Abort pet catching.
@@ -8612,7 +8603,6 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) {
int pc_checkitem(struct map_session_data *sd)
{
int i,id,calc_flag = 0;
- struct item_data *it=NULL;
nullpo_ret(sd);
@@ -8640,7 +8630,6 @@ int pc_checkitem(struct map_session_data *sd)
}
for( i = 0; i < MAX_INVENTORY; i++) {
- it = sd->inventory_data[i];
if( sd->status.inventory[i].nameid == 0 )
continue;
@@ -8654,18 +8643,6 @@ int pc_checkitem(struct map_session_data *sd)
continue;
}
- if( it ) { // check for forbiden items.
- int flag =
- (map[sd->bl.m].flag.restricted?(8*map[sd->bl.m].zone):0)
- | (!map_flag_vs(sd->bl.m)?1:0)
- | (map[sd->bl.m].flag.pvp?2:0)
- | (map_flag_gvg(sd->bl.m)?4:0)
- | (map[sd->bl.m].flag.battleground?8:0);
- if( flag && (it->flag.no_equip&flag) ) {
- pc_unequipitem(sd, i, 2);
- calc_flag = 1;
- }
- }
}
if( calc_flag && sd->state.active ) {
diff --git a/src/map/status.c b/src/map/status.c
index ce792cd75..7840a7a7f 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2443,6 +2443,20 @@ 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;
+ }
+
+
status->def += sd->inventory_data[index]->def;
if(first && sd->inventory_data[index]->equip_script)