From ba7eef71e7c161c13be53f484261eb9b6f69f74d Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Mon, 19 Aug 2019 20:26:29 +0300
Subject: Update from hercules

---
 server/gm/atcommands.txt           |  45 +++++-
 server/scripts/constants.md        |   2 +
 server/scripts/script_commands.txt | 305 +++++++++++++++++++++----------------
 3 files changed, 214 insertions(+), 138 deletions(-)

diff --git a/server/gm/atcommands.txt b/server/gm/atcommands.txt
index dd8ad09..1392959 100644
--- a/server/gm/atcommands.txt
+++ b/server/gm/atcommands.txt
@@ -584,6 +584,12 @@ Opens the Identification window if any unappraised items are in your inventory.
 
 ---------------------------------------
 
+@identifyall
+
+Identifies all unappraised items in your inventory.
+
+---------------------------------------
+
 @trade <player name>
 
 Opens the trade window with the specified player.
@@ -672,17 +678,30 @@ Example:
 @refine <equip position> <+/- amount>
 
 Refines an equipped item by the specified amount.
-0: All Equipment
-1: Lower Headgear
-2: Right Hand
+-3: Refine All Equip (Shadow)
+-2: Refine All Equip (Costume)
+-1: Refine All Equip (General)
+1: Headgear (Low)
+2: Hand (Right)
 4: Garment
-8: Left Accessory
+8: Accessory (Left)
 16: Body Armor
-32: Left Hand
+32: Hand (Left)
 64: Shoes
-128: Right Accessory
-256: Top Headgear
-512: Mid Headgear
+128: Accessory (Right)
+256: Headgear (Top)
+256: Headgear (Mid)
+1024: Costume Headgear (Top)
+2048: Costume Headgear (Mid)
+4096: Costume Headgear (Low)
+8192: Costume Garment
+65536: Shadow Armor
+131072: Shadow Weapon
+262144: Shadow Shield
+524288: Shadow Shoes
+1048576: Shadow Accessory (Right)
+2097152: Shadow Accessory (Left)
+2097152: Shadow Accessory (Left)
 
 ---------------------------------------
 
@@ -1260,6 +1279,16 @@ Example:
 
 ---------------------------------------
 
+@reloadnpc <path>
+
+Unloads all NPCs in a file and reload it again.
+Note: Be aware that mapflags and monsters spawned directly are not removed.
+
+Example:
+@reloadnpc npc/custom/jobmaster.txt
+
+---------------------------------------
+
 =====================
 | 6. Party Commands |
 =====================
diff --git a/server/scripts/constants.md b/server/scripts/constants.md
index 4856457..4c2be54 100644
--- a/server/scripts/constants.md
+++ b/server/scripts/constants.md
@@ -1442,6 +1442,7 @@
 - `MOB_ELEMENT`: 20
 - `MOB_MODE`: 21
 - `MOB_MVPEXP`: 22
+- `MOB_DMG_TAKEN_RATE`: 23
 
 ### mercenary guilds
 
@@ -4460,6 +4461,7 @@
 - `UDT_ROBE`: 55
 - `UDT_BODY2`: 56
 - `UDT_GROUP`: 57
+- `UDT_DAMAGE_TAKEN_RATE`: 58
 
 ### getguildonline types
 
diff --git a/server/scripts/script_commands.txt b/server/scripts/script_commands.txt
index a08d8a7..bab4287 100644
--- a/server/scripts/script_commands.txt
+++ b/server/scripts/script_commands.txt
@@ -3207,6 +3207,30 @@ runs of getcartinventorylist().
 
 ---------------------------------------
 
+*setfavoriteitemidx(<idx>, <flag>)
+
+This function will set an item in inventory as favorite or not.
+If its favorite item, it will be moved to favorite tab, else move out from favorite tab.
+Note: Cant change favorite flag of an equipped item.
+
+Valid Parameters: 
+	<idx>    - inventory index, refer *getinventorylist()
+	<flag>   - true/false (true = favorite item, false = otherwise)
+
+---------------------------------------
+
+*autofavoriteitem(<item_id>, <flag>)
+
+This function will auto set an item as favorite when <item_id> is obtained. 
+If its favorite item, it will be auto moved to favorite tab, else move out from favorite tab.
+This setting affect not only attached player, but also everyone player globally.
+
+Valid Parameters: 
+	<item_id> - item ID
+	<flag>    - true/false (true = favorite item, false = otherwise)
+
+---------------------------------------
+
 *cardscnt()
 
 This function will return the number of cards inserted into the weapon
@@ -3344,6 +3368,24 @@ cards or if it's signed.
 This will set a Hat Effect onto the player. The state field allows you to
 enable (true) or disable (false) the effect on the player.
 
+---------------------------------------
+
+*identify(<Item ID>)
+
+This function identifies the first <Item ID> item in attached player's inventory.
+
+Returns -2 if an error happens, -1 if no unidentified <Item ID> was found.
+Otherwise, returns the idx of the identified item.
+
+---------------------------------------
+
+*identifyidx(<Inventory Index>)
+
+This will identify item at attached player's <Inventory Index> inventory index.
+
+Returns true if the item was identified, false otherwise.
+Note: If the item was already identified, it returns false.
+
 ---------------------------------------
 //=====================================
 2.1 - End of Item-Related Commands
@@ -3927,29 +3969,30 @@ It will return -1 if there is no such monster (or the type value is
 invalid), or "null" if you requested the monster's name.
 
 Valid types are listed in doc/constants.md:
-	MOB_NAME		0
-	MOB_LV			1
-	MOB_MAXHP		2
-	MOB_BASEEXP		3
-	MOB_JOBEXP		4
-	MOB_ATK1		5
-	MOB_ATK2		6
-	MOB_DEF			7
-	MOB_MDEF		8
-	MOB_STR			9
-	MOB_AGI			10
-	MOB_VIT			11
-	MOB_INT			12
-	MOB_DEX			13
-	MOB_LUK			14
-	MOB_RANGE		15
-	MOB_RANGE2		16
-	MOB_RANGE3		17
-	MOB_SIZE		18
-	MOB_RACE		19
-	MOB_ELEMENT		20
-	MOB_MODE		21
-	MOB_MVPEXP		22
+	MOB_NAME               0
+	MOB_LV                 1
+	MOB_MAXHP              2
+	MOB_BASEEXP            3
+	MOB_JOBEXP             4
+	MOB_ATK1               5
+	MOB_ATK2               6
+	MOB_DEF                7
+	MOB_MDEF               8
+	MOB_STR                9
+	MOB_AGI               10
+	MOB_VIT               11
+	MOB_INT               12
+	MOB_DEX               13
+	MOB_LUK               14
+	MOB_RANGE             15
+	MOB_RANGE2            16
+	MOB_RANGE3            17
+	MOB_SIZE              18
+	MOB_RACE              19
+	MOB_ELEMENT           20
+	MOB_MODE              21
+	MOB_MVPEXP            22
+	MOB_DMG_TAKEN_RATE    23
 
 Check sample in doc/sample/getmonsterinfo.txt
 
@@ -10198,60 +10241,61 @@ Sets or alters the data in real-time for game objects of the following types -
 NPCs, Pets, Monsters, Homunuculus', Mercenaries, Elementals.
 
 Applicable Data Types (available as constants) -
-	Data Types          Description (parameter type)
-	UDT_SIZE:           Unit Size
-	UDT_LEVEL:          Level
-	UDT_HP:             Current HP
-	UDT_MAXHP:          Max HP
-	UDT_SP:             SP
-	UDT_MAXSP:          MAX SP
-	UDT_MASTERAID:      Master Account ID (for Summons)
-	UDT_MASTERCID:      Master Char ID (for Summons)
-	UDT_SPEED:          Unit Speed.
-	UDT_MODE:           Mode (Mobs only)
-	UDT_AI:             Unit AI Type (see doc/constants.md for Unit AI Types)
-	UDT_SCOPTION:       Status Options. (see doc/constants.md for Unit Option Types)
-	UDT_SEX:            Gender of the unit. (see doc/constants.md for Genders)
-	UDT_CLASS:          Class of the unit. (Monster ID)
-	UDT_HAIRSTYLE:      Hair Style ID.
-	UDT_HAIRCOLOR:      Hair Color ID.
-	UDT_HEADBOTTOM:     Headgear Bottom Sprite ID.
-	UDT_HEADMIDDLE:     Headgear Middle Sprite ID.
-	UDT_HEADTOP:        Headgear Top Sprite ID.
-	UDT_CLOTHCOLOR:     Cloth Color ID.
-	UDT_SHIELD:         Shield Sprite ID.
-	UDT_WEAPON:         Weapon Sprite ID.
-	UDT_LOOKDIR:        Face direction.
-	UDT_CANMOVETICK:    Stop a unit from move for n seconds.
-	UDT_STR:            Unit STR.
-	UDT_AGI:            Unit AGI.
-	UDT_VIT:            Unit VIT.
-	UDT_INT:            Unit INT.
-	UDT_DEX:            Unit DEX.
-	UDT_LUK:            Unit LUK.
-	UDT_ATKRANGE:       Attack range of a unit.
-	UDT_ATKMIN:         Min Atk of a unit.
-	UDT_ATKMAX:         Max Atk of a unit.
-	UDT_MATKMIN:        Min MATK of a unit.
-	UDT_MATKMAX:        Max MATK of a unit.
-	UDT_DEF:            DEF.
-	UDT_MDEF:           MDEF.
-	UDT_HIT:            HIT.
-	UDT_FLEE:           FLEE.
-	UDT_PDODGE:         Perfect Dodge.
-	UDT_CRIT:           Critical Rate.
-	UDT_RACE:           Race. (Eg. constants RC_DemiHuman or Integer 7).
-	UDT_ELETYPE:        Element. (Eg. constants Ele_Neutral or Integer 0).
-	UDT_ELELEVEL:       Element Level.
-	UDT_AMOTION:        AMotion Rate.
-	UDT_ADELAY:         ADelay Rate.
-	UDT_DMOTION:        DMotion Rate.
-	UDT_HUNGER:         Hunger Rate - for summons.
-	UDT_INTIMACY:       Intimacy Rate - for summons.
-	UDT_LIFETIME:       LifeTime - for summons.
-	UDT_MERC_KILLCOUNT: Kill count for mercenaries
-	UDT_STATADD:        Status Points - for NPCs.
-	UDT_GROUP:          group id
+	Data Types                Description (parameter type)
+	UDT_SIZE:                 Unit Size
+	UDT_LEVEL:                Level
+	UDT_HP:                   Current HP
+	UDT_MAXHP:                Max HP
+	UDT_SP:                   SP
+	UDT_MAXSP:                MAX SP
+	UDT_MASTERAID:            Master Account ID (for Summons)
+	UDT_MASTERCID:            Master Char ID (for Summons)
+	UDT_SPEED:                Unit Speed.
+	UDT_MODE:                 Mode (Mobs only)
+	UDT_AI:                   Unit AI Type (see doc/constants.md for Unit AI Types)
+	UDT_SCOPTION:             Status Options. (see doc/constants.md for Unit Option Types)
+	UDT_SEX:                  Gender of the unit. (see doc/constants.md for Genders)
+	UDT_CLASS:                Class of the unit. (Monster ID)
+	UDT_HAIRSTYLE:            Hair Style ID.
+	UDT_HAIRCOLOR:            Hair Color ID.
+	UDT_HEADBOTTOM:           Headgear Bottom Sprite ID.
+	UDT_HEADMIDDLE:           Headgear Middle Sprite ID.
+	UDT_HEADTOP:              Headgear Top Sprite ID.
+	UDT_CLOTHCOLOR:           Cloth Color ID.
+	UDT_SHIELD:               Shield Sprite ID.
+	UDT_WEAPON:               Weapon Sprite ID.
+	UDT_LOOKDIR:              Face direction.
+	UDT_CANMOVETICK:          Stop a unit from move for n seconds.
+	UDT_STR:                  Unit STR.
+	UDT_AGI:                  Unit AGI.
+	UDT_VIT:                  Unit VIT.
+	UDT_INT:                  Unit INT.
+	UDT_DEX:                  Unit DEX.
+	UDT_LUK:                  Unit LUK.
+	UDT_ATKRANGE:             Attack range of a unit.
+	UDT_ATKMIN:               Min Atk of a unit.
+	UDT_ATKMAX:               Max Atk of a unit.
+	UDT_MATKMIN:              Min MATK of a unit.
+	UDT_MATKMAX:              Max MATK of a unit.
+	UDT_DEF:                  DEF.
+	UDT_MDEF:                 MDEF.
+	UDT_HIT:                  HIT.
+	UDT_FLEE:                 FLEE.
+	UDT_PDODGE:               Perfect Dodge.
+	UDT_CRIT:                 Critical Rate.
+	UDT_RACE:                 Race. (Eg. constants RC_DemiHuman or Integer 7).
+	UDT_ELETYPE:              Element. (Eg. constants Ele_Neutral or Integer 0).
+	UDT_ELELEVEL:             Element Level.
+	UDT_AMOTION:              AMotion Rate.
+	UDT_ADELAY:               ADelay Rate.
+	UDT_DMOTION:              DMotion Rate.
+	UDT_HUNGER:               Hunger Rate - for summons.
+	UDT_INTIMACY:             Intimacy Rate - for summons.
+	UDT_LIFETIME:             LifeTime - for summons.
+	UDT_MERC_KILLCOUNT:       Kill count for mercenaries
+	UDT_STATADD:              Status Points - for NPCs.
+	UDT_GROUP:                group id
+	UDT_DAMAGE_TAKEN_RATE:    damage taken rate of a unit.
 
 returns 0 if value could not be set, 1 if successful.
 
@@ -10262,59 +10306,60 @@ returns 0 if value could not be set, 1 if successful.
 Retrieves real-time data of a game object.
 
 Applicable Data types (available as constants) -
-	Data Types          Description (return type)
-	UDT_SIZE:           Unit Size
-	UDT_LEVEL:          Level
-	UDT_HP:             Current HP
-	UDT_MAXHP:          Max HP
-	UDT_SP:             SP
-	UDT_MAXSP:          MAX SP
-	UDT_MASTERAID:      Master Account ID (for Summons)
-	UDT_MASTERCID:      Master Char ID (for Summons)
-	UDT_SPEED:          Unit Speed.
-	UDT_MODE:           Mode (Mobs only)
-	UDT_AI:             Unit AI Type (see doc/constants.md for Unit AI Types)
-	UDT_SCOPTION:       Status Options. (see doc/constants.md for Unit Option Types)
-	UDT_SEX:            Gender of the unit. (see doc/constants.md for Genders)
-	UDT_CLASS:          Class of the unit. (Monster ID)
-	UDT_HAIRSTYLE:      Hair Style ID.
-	UDT_HAIRCOLOR:      Hair Color ID.
-	UDT_HEADBOTTOM:     Headgear Bottom Sprite ID.
-	UDT_HEADMIDDLE:     Headgear Middle Sprite ID.
-	UDT_HEADTOP:        Headgear Top Sprite ID.
-	UDT_CLOTHCOLOR:     Cloth Color ID.
-	UDT_SHIELD:         Shield Sprite ID.
-	UDT_WEAPON:         Weapon Sprite ID.
-	UDT_LOOKDIR:        Face direction.
-	UDT_CANMOVETICK:    Stop a unit from move for n seconds.
-	UDT_STR:            Unit STR.
-	UDT_AGI:            Unit AGI.
-	UDT_VIT:            Unit VIT.
-	UDT_INT:            Unit INT.
-	UDT_DEX:            Unit DEX.
-	UDT_LUK:            Unit LUK.
-	UDT_ATKRANGE:       Attack range of a unit.
-	UDT_ATKMIN:         Min Atk of a unit.
-	UDT_ATKMAX:         Max Atk of a unit.
-	UDT_MATKMIN:        Min MATK of a unit.
-	UDT_MATKMAX:        Max MATK of a unit.
-	UDT_DEF:            DEF.
-	UDT_MDEF:           MDEF.
-	UDT_HIT:            HIT.
-	UDT_FLEE:           FLEE.
-	UDT_PDODGE:         Perfect Dodge.
-	UDT_CRIT:           Critical Rate.
-	UDT_RACE:           Race. (Eg. constants RC_DemiHuman or Integer 7).
-	UDT_ELETYPE:        Element. (Eg. constants Ele_Neutral or Integer 0).
-	UDT_ELELEVEL:       Element Level.
-	UDT_AMOTION:        AMotion Rate.
-	UDT_ADELAY:         ADelay Rate.
-	UDT_DMOTION:        DMotion Rate.
-	UDT_HUNGER:         Hunger Rate - for summons.
-	UDT_INTIMACY:       Intimacy Rate - for summons.
-	UDT_LIFETIME:       LifeTime - for summons.
-	UDT_MERC_KILLCOUNT: Kill count for mercenaries.
-	UDT_GROUP:          group id
+	Data Types                Description (return type)
+	UDT_SIZE:                 Unit Size
+	UDT_LEVEL:                Level
+	UDT_HP:                   Current HP
+	UDT_MAXHP:                Max HP
+	UDT_SP:                   SP
+	UDT_MAXSP:                MAX SP
+	UDT_MASTERAID:            Master Account ID (for Summons)
+	UDT_MASTERCID:            Master Char ID (for Summons)
+	UDT_SPEED:                Unit Speed.
+	UDT_MODE:                 Mode (Mobs only)
+	UDT_AI:                   Unit AI Type (see doc/constants.md for Unit AI Types)
+	UDT_SCOPTION:             Status Options. (see doc/constants.md for Unit Option Types)
+	UDT_SEX:                  Gender of the unit. (see doc/constants.md for Genders)
+	UDT_CLASS:                Class of the unit. (Monster ID)
+	UDT_HAIRSTYLE:            Hair Style ID.
+	UDT_HAIRCOLOR:            Hair Color ID.
+	UDT_HEADBOTTOM:           Headgear Bottom Sprite ID.
+	UDT_HEADMIDDLE:           Headgear Middle Sprite ID.
+	UDT_HEADTOP:              Headgear Top Sprite ID.
+	UDT_CLOTHCOLOR:           Cloth Color ID.
+	UDT_SHIELD:               Shield Sprite ID.
+	UDT_WEAPON:               Weapon Sprite ID.
+	UDT_LOOKDIR:              Face direction.
+	UDT_CANMOVETICK:          Stop a unit from move for n seconds.
+	UDT_STR:                  Unit STR.
+	UDT_AGI:                  Unit AGI.
+	UDT_VIT:                  Unit VIT.
+	UDT_INT:                  Unit INT.
+	UDT_DEX:                  Unit DEX.
+	UDT_LUK:                  Unit LUK.
+	UDT_ATKRANGE:             Attack range of a unit.
+	UDT_ATKMIN:               Min Atk of a unit.
+	UDT_ATKMAX:               Max Atk of a unit.
+	UDT_MATKMIN:              Min MATK of a unit.
+	UDT_MATKMAX:              Max MATK of a unit.
+	UDT_DEF:                  DEF.
+	UDT_MDEF:                 MDEF.
+	UDT_HIT:                  HIT.
+	UDT_FLEE:                 FLEE.
+	UDT_PDODGE:               Perfect Dodge.
+	UDT_CRIT:                 Critical Rate.
+	UDT_RACE:                 Race. (Eg. constants RC_DemiHuman or Integer 7).
+	UDT_ELETYPE:              Element. (Eg. constants Ele_Neutral or Integer 0).
+	UDT_ELELEVEL:             Element Level.
+	UDT_AMOTION:              AMotion Rate.
+	UDT_ADELAY:               ADelay Rate.
+	UDT_DMOTION:              DMotion Rate.
+	UDT_HUNGER:               Hunger Rate - for summons.
+	UDT_INTIMACY:             Intimacy Rate - for summons.
+	UDT_LIFETIME:             LifeTime - for summons.
+	UDT_MERC_KILLCOUNT:       Kill count for mercenaries.
+	UDT_GROUP:                group id
+	UDT_DAMAGE_TAKEN_RATE:    damage taken rate of a unit.
 
 returns -1 if value could not be retrieved.
 
-- 
cgit v1.2.3-70-g09d2