summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJedzkie <jedzkie13@rocketmail.com>2017-10-22 01:38:01 +0800
committerHaru <haru@dotalux.com>2018-04-07 15:57:56 +0200
commit408982006d7e5695405b043142989a2ecdb9ffbd (patch)
tree77d6e12809290f7c0b54bf2e403b863303368a1b
parentb2f92713a6f0449d4ca319ab178d6391c021f57c (diff)
downloadhercules-408982006d7e5695405b043142989a2ecdb9ffbd.tar.gz
hercules-408982006d7e5695405b043142989a2ecdb9ffbd.tar.bz2
hercules-408982006d7e5695405b043142989a2ecdb9ffbd.tar.xz
hercules-408982006d7e5695405b043142989a2ecdb9ffbd.zip
Add an option to prevent item usage when storage is open
In official servers, you can't open boxes and use usable/consumables items when the storage is open. Fixes #1806
-rw-r--r--conf/map/battle/items.conf4
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/pc.c10
4 files changed, 12 insertions, 5 deletions
diff --git a/conf/map/battle/items.conf b/conf/map/battle/items.conf
index f7ffd3f32..135df7107 100644
--- a/conf/map/battle/items.conf
+++ b/conf/map/battle/items.conf
@@ -119,3 +119,7 @@ bow_unequip_arrow: true
// How much should rental mounts increase a player's movement speed? (Note 2)
// Official: 25 (Default)
boarding_halter_speed: 25
+
+// Allow to use items when the storage is open?
+// Official: false (Default)
+storage_use_item: false
diff --git a/src/map/battle.c b/src/map/battle.c
index bd7e31d05..8c0beede2 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -7319,6 +7319,7 @@ static const struct battle_data {
{ "features/rodex", &battle_config.feature_rodex, 1, 0, 1, },
{ "features/rodex_use_accountmail", &battle_config.feature_rodex_use_accountmail, 0, 0, 1, },
{ "features/enable_homun_autofeed", &battle_config.feature_enable_homun_autofeed, 1, 0, 1, },
+ { "storage_use_item", &battle_config.storage_use_item, 0, 0, 1, },
};
#ifndef STATS_OPT_OUT
/**
diff --git a/src/map/battle.h b/src/map/battle.h
index 8b7fea29f..b4a404657 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -562,6 +562,8 @@ struct Battle_Config {
int feature_rodex_use_accountmail;
int feature_enable_homun_autofeed;
+
+ int storage_use_item;
};
/* criteria for battle_config.idletime_critera */
diff --git a/src/map/pc.c b/src/map/pc.c
index 4404101b9..dd9a7126f 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4902,11 +4902,6 @@ int pc_isUseitem(struct map_session_data *sd,int n)
return 0; // You cannot use this item while sitting.
}
- if (sd->state.storage_flag != STORAGE_FLAG_CLOSED && item->type != IT_CASH) {
- clif->messagecolor_self(sd->fd, COLOR_RED, msg_sd(sd,1475));
- return 0; // You cannot use this item while storage is open.
- }
-
switch( nameid ) { // TODO: Is there no better way to handle this, other than hardcoding item IDs?
case ITEMID_ANODYNE:
if (map_flag_gvg2(sd->bl.m))
@@ -5093,6 +5088,11 @@ int pc_useitem(struct map_session_data *sd,int n) {
return 0;
}
+ if (battle_config.storage_use_item == 1 && sd->state.storage_flag != STORAGE_FLAG_CLOSED) {
+ clif->messagecolor_self(sd->fd, COLOR_RED, msg_sd(sd, 1475));
+ return 0; // You cannot use this item while storage is open.
+ }
+
if( sd->status.inventory[n].nameid <= 0 || sd->status.inventory[n].amount <= 0 )
return 0;