summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-11-15 03:32:45 -0200
committershennetsind <ind@henn.et>2013-11-15 03:32:45 -0200
commit1f5161a2bd3c7934373146d8cac3c131536758ba (patch)
treee788177258e61e81b5d20dc7eb43c2d7c6cd8ff5 /src/map/itemdb.c
parentcdf6dc90768b1b524c78e3a172c7a844dd88a943 (diff)
downloadhercules-1f5161a2bd3c7934373146d8cac3c131536758ba.tar.gz
hercules-1f5161a2bd3c7934373146d8cac3c131536758ba.tar.bz2
hercules-1f5161a2bd3c7934373146d8cac3c131536758ba.tar.xz
hercules-1f5161a2bd3c7934373146d8cac3c131536758ba.zip
Official Item BindOnEquip Support
Implements the 'BindOnEquip' item db field which determines whether the piece of equipment should bind to the character upon being equipped. When a character tries to equip such a item for the first time a dialog shows up asking the character to confirm whether to equip the item or not, and notifying the character that by equipping the item it will become bound to the character, and therefore unable to be used by another character. Special Thanks to Beret for all the information, Haruna for testing. Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 929a90562..8eb9c0f14 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -1652,6 +1652,7 @@ int itemdb_readdb_sql_sub(Sql *handle, int n, const char *source) {
* `equip_level_max` smallint(5) unsigned DEFAULT NULL
* `refineable` tinyint(1) unsigned DEFAULT NULL
* `view` smallint(3) unsigned DEFAULT NULL
+ * `bindonequip` tinyint(1) unsigned DEFAULT NULL
* `script` text
* `equip_script` text
* `unequip_script` text
@@ -1677,9 +1678,10 @@ int itemdb_readdb_sql_sub(Sql *handle, int n, const char *source) {
SQL->GetData(handle, 18, &data, NULL); id.elvmax = data ? atoi(data) : 0;
SQL->GetData(handle, 19, &data, NULL); id.flag.no_refine = data && atoi(data) ? 0 : 1;
SQL->GetData(handle, 20, &data, NULL); id.look = data ? atoi(data) : 0;
- SQL->GetData(handle, 21, &data, NULL); id.script = *data ? script->parse(data, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS) : NULL;
- SQL->GetData(handle, 22, &data, NULL); id.equip_script = *data ? script->parse(data, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS) : NULL;
- SQL->GetData(handle, 23, &data, NULL); id.unequip_script = *data ? script->parse(data, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS) : NULL;
+ SQL->GetData(handle, 21, &data, NULL); id.flag.bindonequip = data && atoi(data) ? 1 : 0;
+ SQL->GetData(handle, 22, &data, NULL); id.script = *data ? script->parse(data, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS) : NULL;
+ SQL->GetData(handle, 23, &data, NULL); id.equip_script = *data ? script->parse(data, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS) : NULL;
+ SQL->GetData(handle, 24, &data, NULL); id.unequip_script = *data ? script->parse(data, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS) : NULL;
return itemdb->validate_entry(&id, n, source);
}
@@ -1714,6 +1716,7 @@ int itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *source)
* EquipLv: Equip required level
* Refine: Refineable
* View: View ID
+ * BindOnEquip: (true or false)
* Script: <"
* Script
* (it can be multi-line)
@@ -1827,6 +1830,9 @@ int itemdb_readdb_libconfig_sub(config_setting_t *it, int n, const char *source)
if( config_setting_lookup_int(it, "View", &i32) && i32 >= 0 )
id.look = i32;
+ if( (t = config_setting_get_member(it, "BindOnEquip")) )
+ id.flag.bindonequip = config_setting_get_bool(t) ? 1 : 0;
+
if( config_setting_lookup_string(it, "Script", &str) )
id.script = *str ? script->parse(str, source, -id.nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS) : NULL;