summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2014-12-02 12:12:33 +0100
committerHaruna <haru@dotalux.com>2014-12-02 12:12:33 +0100
commitd4e0689858b294260c610e77c27812797bbf26c0 (patch)
tree4cd261b49621a864fcb72723960ca2b24980bab9
parent274aaebe2bad43a8196e3ff39ede344da8ce4d64 (diff)
parent40a239fcdaa1c6669868f06136b62a95c183e68c (diff)
downloadhercules-d4e0689858b294260c610e77c27812797bbf26c0.tar.gz
hercules-d4e0689858b294260c610e77c27812797bbf26c0.tar.bz2
hercules-d4e0689858b294260c610e77c27812797bbf26c0.tar.xz
hercules-d4e0689858b294260c610e77c27812797bbf26c0.zip
Merge pull request #397 from 4144/nodelonuse
Add item attribute what prevent item removing on use.
-rw-r--r--db/re/item_db.conf1
-rw-r--r--doc/item_db.txt1
-rw-r--r--src/map/itemdb.c5
-rw-r--r--src/map/itemdb.h1
-rw-r--r--src/map/pc.c2
5 files changed, 8 insertions, 2 deletions
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index 211fd5d63..f36ea3527 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -31,6 +31,7 @@ item_db: (
BindOnEquip: true/false (boolean, defaults to false)
BuyingStore: true/false (boolean, defaults to false)
Delay: Delay to use item (int, defaults to 0)
+ KeepAfterUse: true/false (boolean, defaults to false)
Trade: { (defaults to no restrictions)
override: GroupID (int, defaults to 100)
nodrop: true/false (boolean, defaults to false)
diff --git a/doc/item_db.txt b/doc/item_db.txt
index ce2a248ca..6b34b8daf 100644
--- a/doc/item_db.txt
+++ b/doc/item_db.txt
@@ -36,6 +36,7 @@ item_db: (
BindOnEquip: true/false (boolean, defaults to false)
BuyingStore: true/false (boolean, defaults to false)
Delay: Delay to use item (int, defaults to 0)
+ KeepAfterUse: true/false (boolean, defaults to false)
Trade: { (defaults to no restrictions)
override: GroupID (int, defaults to 100)
nodrop: true/false (boolean, defaults to false)
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 67aab7a18..508a0ccec 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1787,9 +1787,12 @@ int itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *source)
if ( (t = libconfig->setting_get_member(it, "BuyingStore")) )
id.flag.buyingstore = libconfig->setting_get_bool(t) ? 1 : 0;
+ if ((t = libconfig->setting_get_member(it, "KeepAfterUse")))
+ id.flag.keepafteruse = libconfig->setting_get_bool(t) ? 1 : 0;
+
if (libconfig->setting_lookup_int(it, "Delay", &i32) && i32 >= 0)
id.delay = i32;
-
+
if ( (t = libconfig->setting_get_member(it, "Trade")) ) {
if (config_setting_is_group(t)) {
config_setting_t *tt = NULL;
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index a1c4d1053..5504d72d9 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -414,6 +414,7 @@ struct item_data {
unsigned autoequip: 1;
unsigned buyingstore : 1;
unsigned bindonequip : 1;
+ unsigned keepafteruse : 1;
} flag;
struct {// item stacking limitation
unsigned short amount;
diff --git a/src/map/pc.c b/src/map/pc.c
index 6ba06c82b..9af5ee5ff 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4519,7 +4519,7 @@ int pc_useitem(struct map_session_data *sd,int n) {
if( sd->inventory_data[n]->flag.delay_consume )
clif->useitemack(sd,n,amount,true);
else {
- if( sd->status.inventory[n].expire_time == 0 ) {
+ if (sd->status.inventory[n].expire_time == 0 && !(sd->inventory_data[n]->flag.keepafteruse)) {
clif->useitemack(sd,n,amount-1,true);
pc->delitem(sd,n,1,1,0,LOG_TYPE_CONSUME); // Rental Usable Items are not deleted until expiration
} else