From 105ebf13243ec5607273690f634e7fc1608a447d Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Tue, 11 Apr 2017 19:01:03 +0300
Subject: Update to latest hercules.

---
 server/items/item_db.txt           |  1 +
 server/scripts/constants.md        | 25 ++++++++++++
 server/scripts/script_commands.txt | 78 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 104 insertions(+)

diff --git a/server/items/item_db.txt b/server/items/item_db.txt
index 2b0d860..19ed126 100644
--- a/server/items/item_db.txt
+++ b/server/items/item_db.txt
@@ -33,6 +33,7 @@ item_db: (
 	EquipLv: Equip required level (int, defaults to 0)
 	EquipLv: [min, max]           (alternative syntax with min / max level)
 	Refine: Refineable            (boolean, defaults to true)
+	DisableOptions: true/false    (boolean, defaults to false !!for equipments only!!) [Smokexyz]
 	View: View ID                 (int, defaults to 0)
 	BindOnEquip: true/false       (boolean, defaults to false)
 	ForceSerial: true/false       (boolean, defaults to false)
diff --git a/server/scripts/constants.md b/server/scripts/constants.md
index 22d2854..c666512 100644
--- a/server/scripts/constants.md
+++ b/server/scripts/constants.md
@@ -3799,6 +3799,16 @@
 - `EQP_SHADOW_ACC_R`: 1048576
 - `EQP_SHADOW_ACC_L`: 2097152
 
+### Item Option Types
+
+- `IT_OPT_INDEX`: 0
+- `IT_OPT_VALUE`: 1
+- `IT_OPT_PARAM`: 2
+
+### Maximum Item Options
+
+- `MAX_ITEM_OPTIONS`: 5
+
 ### Navigation constants, use with *navigateto*
 
 - `NAV_NONE`: 0
@@ -3810,6 +3820,21 @@
 - `NAV_KAFRA_AND_SCROLL`: 110
 - `NAV_ALL`: 111
 
+### BL types
+
+- `BL_PC`: 1
+- `BL_MOB`: 2
+- `BL_PET`: 4
+- `BL_HOM`: 8
+- `BL_MER`: 16
+- `BL_ITEM`: 32
+- `BL_SKILL`: 64
+- `BL_NPC`: 128
+- `BL_CHAT`: 256
+- `BL_ELEM`: 512
+- `BL_CHAR`: 539
+- `BL_ALL`: 4095
+
 ### Renewal
 
 - `RENEWAL`: 1
diff --git a/server/scripts/script_commands.txt b/server/scripts/script_commands.txt
index 581ec18..e7a8d77 100644
--- a/server/scripts/script_commands.txt
+++ b/server/scripts/script_commands.txt
@@ -3162,6 +3162,50 @@ Check sample in doc/sample/getiteminfo.txt
 
 ---------------------------------------
 
+*getequipisenableopt(<equipment slot>)
+
+This function checks if the equipped item allows the use of bonus options.
+
+Returns 1 if allowed, 0 if not.
+
+---------------------------------------
+
+*getequippedoptioninfo(<info_type>);
+
+This function is to be used with the scripts of contents listed in
+db/item_options.conf only.
+
+Returns the value of the current equipment being parsed.
+If the equip was not found or the type is invalid, -1 is returned.
+
+---------------------------------------
+
+*getequipoptioninfo(<equip_index>,<slot>,<type>);
+
+Gets the option information of an equipment.
+
+<equipment_index> For a list of equipment indexes see getequipid().
+<option_slot> can range from 1 to MAX_ITEM_OPTIONS
+<type> can be IT_OPT_INDEX (the ID of the option bonus, @see "Id" or "Name" in db/item_options.conf)
+       or IT_OPT_VALUE (the value of the bonus script of the equipment, @see "Script" in db_item_options.conf).
+
+returns the value of the slot if exists or -1 for invalid slot, type or slots.
+
+---------------------------------------
+
+*setequipoption(<equip_index>,<slot>,<opt_index>,<value>);
+
+Set an equipment's option index or value for the specified option slot.
+
+<equipment_index> For a list of equipment indexes see getequipid().
+<option_slot> can range from 1 to MAX_ITEM_OPTIONS
+<type> can be IT_OPT_INDEX (the ID of the option bonus, @see "Id" or "Name" in db/item_options.conf)
+<value> The value of the type to be set.
+
+returns 0 if value couldn't be set, 1 on success.
+
+---------------------------------------
+
 *getequipcardid(<equipment slot>, <card slot>)
 
 Returns value for equipped item slot in the indicated slot (0, 1, 2, or 3).
@@ -3229,6 +3273,40 @@ Notice that NPC objects disabled with disablenpc() will still be located.
 
 ---------------------------------------
 
+*getunits(<type>, <variable>, <limit>, "<map>"{, <x1>, <y1>, <x2>, <y2>})
+
+This function searches a whole map or area for units and adds their GID to
+the provided <variable> array. It filters units by <type> and stops searching
+after <limit> units have been found. Set <limit> to false (0) if you wish to
+disable the limit altogether.
+
+Type is the type of unit to search for:
+
+	BL_PC    - Character object
+	BL_MOB   - Monster object
+	BL_PET   - Pet object
+	BL_HOM   - Homunculus object
+	BL_MER   - Mercenary object
+	BL_IEM   - Item object (item drops)
+	BL_SKILL - Skill object (skill fx & sfx)
+	BL_NPC   - NPC object
+	BL_CHAT  - Chat object
+	BL_ELEM  - Elemental object
+	BL_CHAR  - Shorthand for (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM)
+	BL_ALL   - Any kind of object
+
+** Do NOT use UNITTYPE_ constants here, they have different values.
+
+Example:
+
+	.@count = getunits((BL_PC | BL_NPC), .@units, false, "prontera");
+
+The above example would search the map "prontera" for all PC and NPC units and
+add them to the .@units array, while setting .@count to the amount of units
+added to the array (useful in for() loops).
+
+---------------------------------------
+
 *getgmlevel()
 
 This function will return the (GM) level of player group the account to 
-- 
cgit v1.2.3-70-g09d2