Browse Source

Merge branch 'master' into feature/blocking_play

Aleos 4 years ago
parent
commit
55cef01a39
100 changed files with 6659 additions and 4223 deletions
  1. 5 0
      conf/battle/client.conf
  2. 17 12
      conf/battle/player.conf
  3. 4 0
      conf/battle/skill.conf
  4. 12 12
      conf/msg_conf/map_msg.conf
  5. 6 6
      conf/msg_conf/map_msg_chn.conf
  6. 6 6
      conf/msg_conf/map_msg_frn.conf
  7. 3 3
      conf/msg_conf/map_msg_grm.conf
  8. 11 11
      conf/msg_conf/map_msg_idn.conf
  9. 11 11
      conf/msg_conf/map_msg_por.conf
  10. 6 6
      conf/msg_conf/map_msg_rus.conf
  11. 11 11
      conf/msg_conf/map_msg_spn.conf
  12. 6 6
      conf/msg_conf/map_msg_tha.conf
  13. 30 0
      db/pre-re/skill_db.yml
  14. 56 38
      db/re/item_db.txt
  15. 10 0
      db/re/item_flag.txt
  16. 23 23
      db/re/mob_db.txt
  17. 23 56
      db/re/mob_skill_db.txt
  18. 6 6
      db/re/produce_db.txt
  19. 4 3
      db/re/quest_db.yml
  20. 123 121
      db/re/skill_db.yml
  21. 12 12
      db/re/skill_tree.txt
  22. 12 33
      db/re/spellbook_db.yml
  23. 3 2
      doc/script_commands.txt
  24. 2 1
      npc/jobs/2-1/assassin.txt
  25. 2 1
      npc/jobs/2-1/knight.txt
  26. 2 1
      npc/jobs/2-2/crusader.txt
  27. 2 1
      npc/jobs/2-2/sage.txt
  28. 51 51
      npc/quests/counteragent_mixture.txt
  29. 2 1
      npc/re/jobs/3-1/warlock.txt
  30. 14 0
      npc/re/kafras/cool_event_corp.txt
  31. 1 1
      npc/re/merchants/ticket_refiner.txt
  32. 143 1323
      npc/re/quests/quests_15_1.txt
  33. 3817 954
      npc/re/quests/quests_15_2.txt
  34. 1 0
      npc/re/scripts_athena.conf
  35. 23 93
      npc/re/warps/other/un_myst.txt
  36. 698 128
      npc/re/warps/other/verus.txt
  37. 1 1
      sql-files/item_cash_db.sql
  38. 1 1
      sql-files/item_cash_db2.sql
  39. 1 1
      sql-files/item_db.sql
  40. 1 1
      sql-files/item_db2.sql
  41. 1 1
      sql-files/item_db2_re.sql
  42. 54 39
      sql-files/item_db_re.sql
  43. 7 7
      sql-files/logs.sql
  44. 40 40
      sql-files/main.sql
  45. 13 13
      sql-files/mob_db.sql
  46. 13 13
      sql-files/mob_db2.sql
  47. 13 13
      sql-files/mob_db2_re.sql
  48. 36 36
      sql-files/mob_db_re.sql
  49. 23 56
      sql-files/mob_skill_db_re.sql
  50. 7 7
      sql-files/upgrades/premium_storage.sql
  51. 11 0
      sql-files/upgrades/upgrade_20200505.sql
  52. 139 0
      sql-files/upgrades/upgrade_20200808.sql
  53. 12 0
      sql-files/upgrades/upgrade_20200808_logs.sql
  54. 21 0
      sql-files/upgrades/upgrade_20200811.sql
  55. 17 16
      src/char/char.cpp
  56. 2 2
      src/char/int_achievement.cpp
  57. 6 6
      src/char/int_auction.cpp
  58. 4 4
      src/char/int_mail.cpp
  59. 7 7
      src/char/int_pet.cpp
  60. 2 2
      src/char/int_storage.cpp
  61. 4 4
      src/char/inter.cpp
  62. 12 8
      src/common/mmo.hpp
  63. 5 5
      src/map/achievement.cpp
  64. 2 1
      src/map/achievement.hpp
  65. 39 31
      src/map/atcommand.cpp
  66. 82 79
      src/map/battle.cpp
  67. 2 0
      src/map/battle.hpp
  68. 6 6
      src/map/buyingstore.cpp
  69. 3 3
      src/map/buyingstore.hpp
  70. 15 15
      src/map/cashshop.cpp
  71. 8 6
      src/map/cashshop.hpp
  72. 108 120
      src/map/clif.cpp
  73. 11 13
      src/map/clif.hpp
  74. 19 24
      src/map/clif_packetdb.hpp
  75. 38 38
      src/map/intif.cpp
  76. 3 3
      src/map/intif.hpp
  77. 61 56
      src/map/itemdb.cpp
  78. 24 23
      src/map/itemdb.hpp
  79. 11 11
      src/map/log.cpp
  80. 3 2
      src/map/log.hpp
  81. 2 2
      src/map/map.cpp
  82. 28 26
      src/map/mob.cpp
  83. 1 1
      src/map/mob.hpp
  84. 33 31
      src/map/npc.cpp
  85. 4 4
      src/map/npc.hpp
  86. 11 0
      src/map/packets.hpp
  87. 53 48
      src/map/pc.cpp
  88. 29 24
      src/map/pc.hpp
  89. 18 9
      src/map/pet.cpp
  90. 6 6
      src/map/pet.hpp
  91. 1 0
      src/map/quest.cpp
  92. 1 1
      src/map/quest.hpp
  93. 141 122
      src/map/script.cpp
  94. 1 0
      src/map/script_constants.hpp
  95. 6 6
      src/map/searchstore.cpp
  96. 4 4
      src/map/searchstore.hpp
  97. 226 258
      src/map/skill.cpp
  98. 27 21
      src/map/skill.hpp
  99. 17 7
      src/map/status.cpp
  100. 4 6
      src/map/status.hpp

+ 5 - 0
conf/battle/client.conf

@@ -149,3 +149,8 @@ ping_time: 20
 // Show skill scale for clients 2015-12-23 and newer? (Note 1)
 // Show skill scale for clients 2015-12-23 and newer? (Note 1)
 // Official: yes
 // Official: yes
 show_skill_scale: yes
 show_skill_scale: yes
+
+// Should the connection be dropped on server side after a player disconnection request was received? (Note 1)
+// Note: Enabling this is known to cause problems on clients that make use of REST API calls.
+// Official: no
+drop_connection_on_quit: no

+ 17 - 12
conf/battle/player.conf

@@ -256,20 +256,25 @@ fame_pharmacy_7: 10
 fame_pharmacy_10: 50
 fame_pharmacy_10: 50
 
 
 // How the server should measure the character's idle time? (Note 3)
 // How the server should measure the character's idle time? (Note 3)
-// 0x001 - Walk Request
-// 0x002 - UseSkillToID Request (Targetted skill use attempt)
-// 0x004 - UseSkillToPos Request (AoE skill use attempt)
-// 0x008 - UseItem Request (Including equip/unequip)
-// 0x010 - Attack Request
-// 0x020 - Chat Request (Whisper, Party, Guild, Battlegrounds, etc)
-// 0x040 - Sit/Standup Request
-// 0x080 - Emotion Request
-// 0x100 - DropItem Request
-// 0x200 - @/#Command Request
+// 0x0001 - Walk Request
+// 0x0002 - UseSkillToID Request (Targetted skill use attempt)
+// 0x0004 - UseSkillToPos Request (AoE skill use attempt)
+// 0x0008 - UseItem Request (Including equip/unequip)
+// 0x0010 - Attack Request
+// 0x0020 - Chat Request (Whisper, Party, Guild, Battlegrounds, etc)
+// 0x0040 - Sit/Standup Request
+// 0x0080 - Emotion Request
+// 0x0100 - DropItem Request
+// 0x0200 - @/#Command Request
+// 0x0400 - Closing a NPC window
+// 0x0800 - Providing input to a NPC
+// 0x1000 - Choosing a NPC menu option
+// 0x2000 - Clicking the next button of a NPC
+// 0x4000 - Finishing for a NPC progress bar
 // Please note that at least 1 option has to be enabled.
 // Please note that at least 1 option has to be enabled.
 // Be mindful that the more options used, the easier it becomes to cheat features that rely on idletime (e.g. checkidle()).
 // Be mindful that the more options used, the easier it becomes to cheat features that rely on idletime (e.g. checkidle()).
-// Default: walk (0x1) + useskilltoid (0x2) + useskilltopos (0x4) + useitem (0x8) + attack (0x10) = 0x1F
-idletime_option: 0x1F
+// Default: walk (0x1) + useskilltoid (0x2) + useskilltopos (0x4) + useitem (0x8) + attack (0x10) + any npc interaction(0x400,0x800,0x1000,0x2000,0x4000) = 0x7C1F
+idletime_option: 0x7C1F
 
 
 // Adjust the summoner class' special traits.
 // Adjust the summoner class' special traits.
 // - Summoners belong to brute race category. They have their own race RC_PLAYER_DORAM (11) to be differentiated from monster race RC_BRUTE (2).
 // - Summoners belong to brute race category. They have their own race RC_PLAYER_DORAM (11) to be differentiated from monster race RC_BRUTE (2).

+ 4 - 0
conf/battle/skill.conf

@@ -355,6 +355,10 @@ default_fixed_castrate: 20
 // Note: Brandish Spear will always use this algorithm due to its special damage behavior.
 // Note: Brandish Spear will always use this algorithm due to its special damage behavior.
 skill_eightpath_algorithm: yes
 skill_eightpath_algorithm: yes
 
 
+// Should skills that use skill_eightpath_algorithm include targets in the caster's cell?
+// Official: yes
+skill_eightpath_same_cell: yes
+
 // Can damage skill units like icewall and traps (Note 3)
 // Can damage skill units like icewall and traps (Note 3)
 // On official servers, players can damage icewalls and some traps with skills. When monsters use skills, damage
 // On official servers, players can damage icewalls and some traps with skills. When monsters use skills, damage
 // will show on the icewalls and traps, but it is not actually substracted from the durability.
 // will show on the icewalls and traps, but it is not actually substracted from the durability.

+ 12 - 12
conf/msg_conf/map_msg.conf

@@ -92,7 +92,7 @@
 75: War of Emperium is currently not in progress.
 75: War of Emperium is currently not in progress.
 76: All skills have been added to your skill tree.
 76: All skills have been added to your skill tree.
 77: The reference result of '%s' (name: id):
 77: The reference result of '%s' (name: id):
-78: - %s: %d
+78: - %s: %u
 79: It is %d affair above.
 79: It is %d affair above.
 80: Give the display name or monster name/id please.
 80: Give the display name or monster name/id please.
 81: Your GM level doesn't authorize you to perform this action on the specified player.
 81: Your GM level doesn't authorize you to perform this action on the specified player.
@@ -179,7 +179,7 @@
 166: No item has been refined.
 166: No item has been refined.
 167: 1 item has been refined.
 167: 1 item has been refined.
 168: %d items have been refined.
 168: %d items have been refined.
-169: The item (%hu: '%s') is not equipable.
+169: The item (%u: '%s') is not equipable.
 170: The item is not equipable.
 170: The item is not equipable.
 171: %d - void
 171: %d - void
 //172: You replace previous memo position %d - %s (%d,%d).
 //172: You replace previous memo position %d - %s (%d,%d).
@@ -551,7 +551,7 @@
 
 
 // Trade Spoof Messages
 // Trade Spoof Messages
 538: Hack on trade: character '%s' (account: %d) try to trade more items that he has.
 538: Hack on trade: character '%s' (account: %d) try to trade more items that he has.
-539: This player has %d of a kind of item (id: %hu), and tried to trade %d of them.
+539: This player has %d of a kind of item (id: %u), and tried to trade %d of them.
 540: This player has been definitivly blocked.
 540: This player has been definitivly blocked.
 
 
 // Rare Items Drop/Steal announce
 // Rare Items Drop/Steal announce
@@ -739,14 +739,14 @@
 707: You are VIP until: %s
 707: You are VIP until: %s
 708: The player is now VIP until: %s
 708: The player is now VIP until: %s
 
 
-709: Item %hu has been removed from your inventory.
-710: Item %hu has been removed from your cart.
-711: Item %hu has been removed from your storage.
+709: Item %u has been removed from your inventory.
+710: Item %u has been removed from your cart.
+711: Item %u has been removed from your storage.
 
 
 // Item shop
 // Item shop
-712: You do not have enough %s (%hu).
+712: You do not have enough %s (%u).
 713: You do not have enough '%s'.
 713: You do not have enough '%s'.
-714: Item Shop List: %s (%hu)
+714: Item Shop List: %s (%u)
 715: Point Shop List: '%s'
 715: Point Shop List: '%s'
 716: Your '%s' is now: %d
 716: Your '%s' is now: %d
 
 
@@ -1235,9 +1235,9 @@
 1189: Item not found.
 1189: Item not found.
 1190: You're already autolooting this item.
 1190: You're already autolooting this item.
 1191: Your autolootitem list is full. Remove some items first with @autolootid -<item name or ID>.
 1191: Your autolootitem list is full. Remove some items first with @autolootid -<item name or ID>.
-1192: Autolooting item: '%s'/'%s' {%hu}
+1192: Autolooting item: '%s'/'%s' {%u}
 1193: You're currently not autolooting this item.
 1193: You're currently not autolooting this item.
-1194: Removed item: '%s'/'%s' {%hu} from your autolootitem list.
+1194: Removed item: '%s'/'%s' {%u} from your autolootitem list.
 1195: You can have %d items on your autolootitem list.
 1195: You can have %d items on your autolootitem list.
 1196: To add an item to the list, use "@alootid +<item name or ID>". To remove an item, use "@alootid -<item name or ID>".
 1196: To add an item to the list, use "@alootid +<item name or ID>". To remove an item, use "@alootid -<item name or ID>".
 1197: "@alootid reset" will clear your autolootitem list.
 1197: "@alootid reset" will clear your autolootitem list.
@@ -1386,7 +1386,7 @@
 
 
 // @iteminfo
 // @iteminfo
 1276: Please enter an item name/ID (usage: @ii/@iteminfo <item name/ID>).
 1276: Please enter an item name/ID (usage: @ii/@iteminfo <item name/ID>).
-1277: Item: '%s'/'%s'[%d] (%hu) Type: %s | Extra Effect: %s
+1277: Item: '%s'/'%s'[%d] (%u) Type: %s | Extra Effect: %s
 1278: None
 1278: None
 1279: With script
 1279: With script
 1280: NPC Buy:%dz, Sell:%dz | Weight: %.1f
 1280: NPC Buy:%dz, Sell:%dz | Weight: %.1f
@@ -1396,7 +1396,7 @@
 
 
 // @whodrops
 // @whodrops
 1284: Please enter item name/ID (usage: @whodrops <item name/ID>).
 1284: Please enter item name/ID (usage: @whodrops <item name/ID>).
-1285: Item: '%s'[%d] (ID:%hu)
+1285: Item: '%s'[%d] (ID: %u)
 1286:  - Item is not dropped by mobs.
 1286:  - Item is not dropped by mobs.
 1287:  - Common mobs with highest drop chance (only max %d are listed):
 1287:  - Common mobs with highest drop chance (only max %d are listed):
 
 

+ 6 - 6
conf/msg_conf/map_msg_chn.conf

@@ -96,7 +96,7 @@
 75: 公會戰還沒開始
 75: 公會戰還沒開始
 76: 您學會了所有技能
 76: 您學會了所有技能
 77: 委託 '%s' (名字: 編號):
 77: 委託 '%s' (名字: 編號):
-78: %s: %d
+78: %s: %u
 79: 查詢到 %d 個符合條件的結果
 79: 查詢到 %d 個符合條件的結果
 80: 重新讀取任務資料庫
 80: 重新讀取任務資料庫
 81: 您的GM 等級並沒有權限在這位玩家上執行這個動作
 81: 您的GM 等級並沒有權限在這位玩家上執行這個動作
@@ -183,7 +183,7 @@
 166: 沒有道具被精練
 166: 沒有道具被精練
 167: 1 個道具已被精練
 167: 1 個道具已被精練
 168: %d 個道具已被精練
 168: %d 個道具已被精練
-169: 此物品 (%d '%s')不是裝備
+169: 此物品 (%u: '%s')不是裝備
 170: 此物品不是裝備
 170: 此物品不是裝備
 171: %d - 無
 171: %d - 無
 //172: You replace previous memo position %d - %s (%d,%d).
 //172: You replace previous memo position %d - %s (%d,%d).
@@ -500,7 +500,7 @@
 537: 玩家'%s' (account: %d) 試圖使用外掛(它試圖偵測假的怪物)
 537: 玩家'%s' (account: %d) 試圖使用外掛(它試圖偵測假的怪物)
 // Trade Spoof Messages
 // Trade Spoof Messages
 538: 危險交易: 玩家 '%s' (account: %d) 嘗試交易超過他所有的數量
 538: 危險交易: 玩家 '%s' (account: %d) 嘗試交易超過他所有的數量
-539: 這個使用者有%d 個物品(物品id: %d), 嘗試交易%d 個
+539: 這個使用者有%d 個物品(物品id: %u), 嘗試交易%d 個
 540: 這個使用者已經被伺服器屏蔽
 540: 這個使用者已經被伺服器屏蔽
 // Rare Items Drop/Steal announce
 // Rare Items Drop/Steal announce
 541: '%s' 取得 %s's %s (機率為: %%%0.02f)
 541: '%s' 取得 %s's %s (機率為: %%%0.02f)
@@ -1042,9 +1042,9 @@
 1189: 未找到此道具。
 1189: 未找到此道具。
 1190: 此道具已在自動檢取列表中了。
 1190: 此道具已在自動檢取列表中了。
 1191: 自動檢取列表已經滿了,移除某些道具方法 @autolootid -<道具名稱或ID>。
 1191: 自動檢取列表已經滿了,移除某些道具方法 @autolootid -<道具名稱或ID>。
-1192: 自動檢取的道具為: '%s'/'%s' {%d}。
+1192: 自動檢取的道具為: '%s'/'%s' {%u}。
 1193: 目前你尚未將此道具列入自動檢取項目中。
 1193: 目前你尚未將此道具列入自動檢取項目中。
-1194: 已從自動檢取列表中移除道具: '%s'/'%s' {%d}。
+1194: 已從自動檢取列表中移除道具: '%s'/'%s' {%u}。
 1195: 在自動檢取列表你最多能有 %d 個檢取的項目。
 1195: 在自動檢取列表你最多能有 %d 個檢取的項目。
 1196: 如要在自動檢取項目列表增加檢取道具,使用 "@alootid +<道具名稱或ID>", 如要從列表移除道具 "@alootid -<道具名稱或ID>"。
 1196: 如要在自動檢取項目列表增加檢取道具,使用 "@alootid +<道具名稱或ID>", 如要從列表移除道具 "@alootid -<道具名稱或ID>"。
 1197: "@alootid reset" 將會清空所有自動檢取項目列表。
 1197: "@alootid reset" 將會清空所有自動檢取項目列表。
@@ -1193,7 +1193,7 @@
 
 
 // @iteminfo
 // @iteminfo
 1276: 請輸入 物品名稱/ID (用法: @ii/@iteminfo <物品名稱/ID>).
 1276: 請輸入 物品名稱/ID (用法: @ii/@iteminfo <物品名稱/ID>).
-1277: 物品: '%s'/'%s'[%d] (%d) 類型: %s | 額外效果: %s
+1277: 物品: '%s'/'%s'[%d] (%u) 類型: %s | 額外效果: %s
 1278: None
 1278: None
 1279: With script
 1279: With script
 1280: NPC 買價:%dz, 賣價:%dz | 重量: %.1f 
 1280: NPC 買價:%dz, 賣價:%dz | 重量: %.1f 

+ 6 - 6
conf/msg_conf/map_msg_frn.conf

@@ -96,7 +96,7 @@
 75: La War of Emperium n'est pas en cours.
 75: La War of Emperium n'est pas en cours.
 76: Toutes les compétences sont ajoutées à votre arbre de compétence.
 76: Toutes les compétences sont ajoutées à votre arbre de compétence.
 77: Résultat de '%s' (nom: id):
 77: Résultat de '%s' (nom: id):
-78: %s: %d
+78: %s: %u
 79: %d résultats sont affichés.
 79: %d résultats sont affichés.
 80: Veuillez donner le nom/id du montre.
 80: Veuillez donner le nom/id du montre.
 81: Votre niveau de GM ne vous autorise pas à effectuer cette action sur le Joueur spécifié.
 81: Votre niveau de GM ne vous autorise pas à effectuer cette action sur le Joueur spécifié.
@@ -183,7 +183,7 @@
 166: Aucun équipement n'a été raffiné.
 166: Aucun équipement n'a été raffiné.
 167: 1 objet raffiné.
 167: 1 objet raffiné.
 168: %d objets raffinés.
 168: %d objets raffinés.
-169: L'objet (%hu: '%s') ne peut pas s'équiper.
+169: L'objet (%u: '%s') ne peut pas s'équiper.
 170: L'objet ne peut pas s'équiper.
 170: L'objet ne peut pas s'équiper.
 171: %d - void
 171: %d - void
 //172: You replace previous memo position %d - %s (%d,%d).
 //172: You replace previous memo position %d - %s (%d,%d).
@@ -512,7 +512,7 @@
 537: Personnage '%s' (compte: %d) essaie d'utiliser un bot (il essaie de détecter un faux mob).
 537: Personnage '%s' (compte: %d) essaie d'utiliser un bot (il essaie de détecter un faux mob).
 // Trade Spoof Messages
 // Trade Spoof Messages
 538: Hack sur échange: Personnage '%s' (account: %d) essaie d'échanger plus d'Objets qu'il ne possède.
 538: Hack sur échange: Personnage '%s' (account: %d) essaie d'échanger plus d'Objets qu'il ne possède.
-539: Ce Joueur a %d d'une sorte d'Objet (id: %hu), et tente d'en échanger %d.
+539: Ce Joueur a %d d'une sorte d'Objet (id: %u), et tente d'en échanger %d.
 540: Joueur définitivement bloqué.
 540: Joueur définitivement bloqué.
 // Rare Items Drop/Steal announce
 // Rare Items Drop/Steal announce
 541: '%s' obtient de %s l'Objet %s (chance: %0.02f%%)
 541: '%s' obtient de %s l'Objet %s (chance: %0.02f%%)
@@ -1055,9 +1055,9 @@
 1189: Objet trouvable.
 1189: Objet trouvable.
 1190: Vous ramasser déjà automatiquement cet Objet.
 1190: Vous ramasser déjà automatiquement cet Objet.
 1191: Votre liste d'Objet à ramasser est pleine. Supprimez des Objets avec @autolootid -<nom_ou_ID_Objet>.
 1191: Votre liste d'Objet à ramasser est pleine. Supprimez des Objets avec @autolootid -<nom_ou_ID_Objet>.
-1192: Ramassage automatique de: '%s'/'%s' {%hu}
+1192: Ramassage automatique de: '%s'/'%s' {%u}
 1193: Actuellement vous ne ramassez pas automatiquement cet Objet.
 1193: Actuellement vous ne ramassez pas automatiquement cet Objet.
-1194: Onjet supprimé: '%s'/'%s' {%hu} de votre liste de 'autolootitem'.
+1194: Onjet supprimé: '%s'/'%s' {%u} de votre liste de 'autolootitem'.
 1195: Vous pouvez avoir %d Objets dans votre liste d'Objets ramassés automatiquement avec 'autolootitem'.
 1195: Vous pouvez avoir %d Objets dans votre liste d'Objets ramassés automatiquement avec 'autolootitem'.
 1196: Pour ajouter un Objet à votre liste, utilisez "@alootid +<nom_ou_ID_Objet>". Pour supprimer un Objet de la liste, utilisez "@alootid -<nom_ou_ID_Objet>".
 1196: Pour ajouter un Objet à votre liste, utilisez "@alootid +<nom_ou_ID_Objet>". Pour supprimer un Objet de la liste, utilisez "@alootid -<nom_ou_ID_Objet>".
 1197: "@alootid reset" videra votre liste d'Objets ramassés automatiquement avec 'autolootitem'.
 1197: "@alootid reset" videra votre liste d'Objets ramassés automatiquement avec 'autolootitem'.
@@ -1206,7 +1206,7 @@
 
 
 // @iteminfo
 // @iteminfo
 1276: Entrez un nom/ID d'objet (usage: @ii/@iteminfo <nom/ID>).
 1276: Entrez un nom/ID d'objet (usage: @ii/@iteminfo <nom/ID>).
-1277: Item: '%s'/'%s'[%d] (%hu) Type: %s | Extra Effect: %s
+1277: Item: '%s'/'%s'[%d] (%u) Type: %s | Extra Effect: %s
 1278: Aucun
 1278: Aucun
 1279: Avec script
 1279: Avec script
 1280: NPC Acheté:%dz, Vendu:%dz | Poids: %.1f 
 1280: NPC Acheté:%dz, Vendu:%dz | Poids: %.1f 

+ 3 - 3
conf/msg_conf/map_msg_grm.conf

@@ -95,7 +95,7 @@
 75: War of Emperium ist zur Zeit nicht im Gange.
 75: War of Emperium ist zur Zeit nicht im Gange.
 76: Alle Fähigkeiten wurden deinem Fähigkeitenbaum hinzugefügt.
 76: Alle Fähigkeiten wurden deinem Fähigkeitenbaum hinzugefügt.
 77: Das Ergebnis der Suche nach '%s' lautet (Name: ID):
 77: Das Ergebnis der Suche nach '%s' lautet (Name: ID):
-78: %s: %d
+78: %s: %u
 79: Es wurden %d Gegenstände gefunden.
 79: Es wurden %d Gegenstände gefunden.
 80: Gib bitte den Anzeige-Namen oder die Monster-ID an.
 80: Gib bitte den Anzeige-Namen oder die Monster-ID an.
 81: Dein GM-Level berechtigt dich nicht, diese Aktion auf dem angegebenen Spieler auszuführen.
 81: Dein GM-Level berechtigt dich nicht, diese Aktion auf dem angegebenen Spieler auszuführen.
@@ -182,7 +182,7 @@
 166: Kein Items sind refined.
 166: Kein Items sind refined.
 167: 1 Item ist refined.
 167: 1 Item ist refined.
 168: %d Items sind refined.
 168: %d Items sind refined.
-169: Das Item (%d: '%s') ist nicht ausrüstbar.
+169: Das Item (%u: '%s') ist nicht ausrüstbar.
 170: Das Item ist nicht ausrüstbar.
 170: Das Item ist nicht ausrüstbar.
 171: %d - ungültig
 171: %d - ungültig
 //172: You replace previous memo position %d - %s (%d,%d).
 //172: You replace previous memo position %d - %s (%d,%d).
@@ -438,7 +438,7 @@
 537: Charakter '%s' (account: %d) Versucht einen Bot zu benutzen (Es versucht einen fake Mob zu entlarven).
 537: Charakter '%s' (account: %d) Versucht einen Bot zu benutzen (Es versucht einen fake Mob zu entlarven).
 // Trade Spoof Messages
 // Trade Spoof Messages
 538: Hack bei Handel: Charakter '%s' (account: %d) versucht mit mehr Items zu Handeln als er besitzt.
 538: Hack bei Handel: Charakter '%s' (account: %d) versucht mit mehr Items zu Handeln als er besitzt.
-539: Dieser Spieler hat %d vom folgendem Item (id: %d), und versuchte %d von ihnen zu Handeln.
+539: Dieser Spieler hat %d vom folgendem Item (id: %u), und versuchte %d von ihnen zu Handeln.
 540: Dieser Spieler wurde definitiv blockiert.
 540: Dieser Spieler wurde definitiv blockiert.
 // Rare Items Drop/Steal announce
 // Rare Items Drop/Steal announce
 541: '%s' got %s's %s (chance: %0.02f%%)
 541: '%s' got %s's %s (chance: %0.02f%%)

+ 11 - 11
conf/msg_conf/map_msg_idn.conf

@@ -92,7 +92,7 @@
 75: War of Emperium saat ini tidak sedang berjalan.
 75: War of Emperium saat ini tidak sedang berjalan.
 76: Semua skill telah ditambahkan ke skill tree.
 76: Semua skill telah ditambahkan ke skill tree.
 77: Hasil referensi dari '%s' (nama: id):
 77: Hasil referensi dari '%s' (nama: id):
-78: - %s: %d
+78: - %s: %u
 79: Terdapat %d hal di atas.
 79: Terdapat %d hal di atas.
 80: Harap berikan nama tampilan atau nama/id monster.
 80: Harap berikan nama tampilan atau nama/id monster.
 81: Level GM kamu tidak diizinkan untuk untuk melakukan aksi ini pada pemain tertentu.
 81: Level GM kamu tidak diizinkan untuk untuk melakukan aksi ini pada pemain tertentu.
@@ -179,7 +179,7 @@
 166: Tidak ada item yang ditempa.
 166: Tidak ada item yang ditempa.
 167: 1 item berhasil ditempa.
 167: 1 item berhasil ditempa.
 168: %d item berhasil ditempa.
 168: %d item berhasil ditempa.
-169: Item (%hu: '%s') tidak bisa dipakai.
+169: Item (%u: '%s') tidak bisa dipakai.
 170: Item ini tidak bisa dipakai.
 170: Item ini tidak bisa dipakai.
 171: %d - sudah habis
 171: %d - sudah habis
 //172: Kamu sudah mengganti posisi memo %d - %s (%d,%d).
 //172: Kamu sudah mengganti posisi memo %d - %s (%d,%d).
@@ -544,7 +544,7 @@
 
 
 // Pesan tentang pelanggaran transaksi.
 // Pesan tentang pelanggaran transaksi.
 538: Hack pada transaksi: Karakter '%s' (akun: %d) sedang mencoba mentransaksikan item lebih dari yang dia punya.
 538: Hack pada transaksi: Karakter '%s' (akun: %d) sedang mencoba mentransaksikan item lebih dari yang dia punya.
-539: Pemain ini memiliki %d jenis item (id: %hu), dan sedang mencoba untuk mentransaksikan %d item.
+539: Pemain ini memiliki %d jenis item (id: %u), dan sedang mencoba untuk mentransaksikan %d item.
 540: Pemain ini sudah diblok.
 540: Pemain ini sudah diblok.
 
 
 // Pesan tentang item langka yang berhasil didapatkan atau dicuri.
 // Pesan tentang item langka yang berhasil didapatkan atau dicuri.
@@ -732,14 +732,14 @@
 707: VIP anda berlaku hingga: %s
 707: VIP anda berlaku hingga: %s
 708: Status VIP pemain aktif hingga: %s
 708: Status VIP pemain aktif hingga: %s
 
 
-709: Item %hu telah dihapus dari inventory-mu.
-710: Item %hu telah dihapus dari cart-mu.
-711: Item %hu telah dihapus dari storage-mu.
+709: Item %u telah dihapus dari inventory-mu.
+710: Item %u telah dihapus dari cart-mu.
+711: Item %u telah dihapus dari storage-mu.
 
 
 //Item shop
 //Item shop
-712: %s (%hu) yang kamu miliki tidak cukup.
+712: %s (%u) yang kamu miliki tidak cukup.
 713: '%s' yang kamu miliki tidak cukup.
 713: '%s' yang kamu miliki tidak cukup.
-714: Item Shop: %s (%hu)
+714: Item Shop: %s (%u)
 715: Point Shop: '%s'
 715: Point Shop: '%s'
 716: '%s' milikmu saat ini: %d
 716: '%s' milikmu saat ini: %d
 
 
@@ -1146,9 +1146,9 @@
 1189: Item tidak ditemukan.
 1189: Item tidak ditemukan.
 1190: Kamu sudah mengambil secara otomatis item ini.
 1190: Kamu sudah mengambil secara otomatis item ini.
 1191: Daftar autolooitem penuh. Hilangkan sebagian terlebih dahulu dengan @autolootid -<nama/ID item>.
 1191: Daftar autolooitem penuh. Hilangkan sebagian terlebih dahulu dengan @autolootid -<nama/ID item>.
-1192: Mengambil item secara otomatis: '%s'/'%s' {%hu}
+1192: Mengambil item secara otomatis: '%s'/'%s' {%u}
 1193: Kamu saat ini sedang tidak mengambil item ini secara otomatis.
 1193: Kamu saat ini sedang tidak mengambil item ini secara otomatis.
-1194: Item dihilangkan: '%s'/'%s' {%hu} dari daftar pengambilan otomatismu.
+1194: Item dihilangkan: '%s'/'%s' {%u} dari daftar pengambilan otomatismu.
 1195: Kamu hanya memiliki item %d di daftarmu.
 1195: Kamu hanya memiliki item %d di daftarmu.
 1196: Untuk menambahkan item ke daftar, gunakan \"@alootid +<ID atau nama item>\". Untuk menghilangkannya, gunakan \"@alootid -<ID atau nama item>\".
 1196: Untuk menambahkan item ke daftar, gunakan \"@alootid +<ID atau nama item>\". Untuk menghilangkannya, gunakan \"@alootid -<ID atau nama item>\".
 1197: \"@alootid reset\" akan membersihkan daftar autolootitem.
 1197: \"@alootid reset\" akan membersihkan daftar autolootitem.
@@ -1297,7 +1297,7 @@
 
 
 // @iteminfo
 // @iteminfo
 1276: Harap masukkan nama/ID item. (Penggunaan: @ii/@iteminfo <nama/ID item>).
 1276: Harap masukkan nama/ID item. (Penggunaan: @ii/@iteminfo <nama/ID item>).
-1277: Item: '%s'/'%s'[%d] (%hu) Jenis: %s | Efek tambahan: %s
+1277: Item: '%s'/'%s'[%d] (%u) Jenis: %s | Efek tambahan: %s
 1278: Tidak ada
 1278: Tidak ada
 1279: Dengan script.
 1279: Dengan script.
 1280: NPC Harga Beli:%dz, Harga jual:%dz | Berat: %.1f 
 1280: NPC Harga Beli:%dz, Harga jual:%dz | Berat: %.1f 

+ 11 - 11
conf/msg_conf/map_msg_por.conf

@@ -102,7 +102,7 @@
 75: A Guerra do Emperium ainda não foi iniciada.
 75: A Guerra do Emperium ainda não foi iniciada.
 76: Todas as habilidades foram adicionadas à sua árvore de habilidades.
 76: Todas as habilidades foram adicionadas à sua árvore de habilidades.
 77: O resultado da referência à '%s' (nome: id):
 77: O resultado da referência à '%s' (nome: id):
-78: %s: %d
+78: %s: %u
 79: Encontrado %d acima.
 79: Encontrado %d acima.
 80: Entre com o nome de exibição ou nome/id do monstro.
 80: Entre com o nome de exibição ou nome/id do monstro.
 81: Seu nível de Game Master não autoriza a realização desta ação neste personagem.
 81: Seu nível de Game Master não autoriza a realização desta ação neste personagem.
@@ -189,7 +189,7 @@
 166: Nenhum item foi refinado.
 166: Nenhum item foi refinado.
 167: 1 item foi refinado.
 167: 1 item foi refinado.
 168: %d itens foram refinados.
 168: %d itens foram refinados.
-169: O item (%hu: '%s') não é equipável.
+169: O item (%u: '%s') não é equipável.
 170: O item não é equipável.
 170: O item não é equipável.
 171: %d - vazio
 171: %d - vazio
 //172: Você substituiu o ponto de memorização %d - %s (%d,%d).
 //172: Você substituiu o ponto de memorização %d - %s (%d,%d).
@@ -555,7 +555,7 @@
 
 
 // Mensagens de tentativa de Spoof em Negociações
 // Mensagens de tentativa de Spoof em Negociações
 538: Hack em negociação: personagem '%s' (account: %d) tentou negociar mais itens que possuía.
 538: Hack em negociação: personagem '%s' (account: %d) tentou negociar mais itens que possuía.
-539: Este jogador possui %d unidades de um item (id: %hu), e tentou negociar %d destes.
+539: Este jogador possui %d unidades de um item (id: %u), e tentou negociar %d destes.
 540: Este jogador foi bloqueado indefinidamente.
 540: Este jogador foi bloqueado indefinidamente.
 
 
 // Anúncio de drop de Itens Raros/Furtar
 // Anúncio de drop de Itens Raros/Furtar
@@ -744,14 +744,14 @@
 707: Você é VIP até: %s
 707: Você é VIP até: %s
 708: O jogador agora é VIP até: %s
 708: O jogador agora é VIP até: %s
 
 
-709: Item %hu foi removido do seu inventário.
-710: Item %hu foi removido do seu carrinho.
-711: Item %hu foi removido do seu armazém.
+709: Item %u foi removido do seu inventário.
+710: Item %u foi removido do seu carrinho.
+711: Item %u foi removido do seu armazém.
 
 
 // Item shop
 // Item shop
-712: Você não possui %s suficiente (%hu).
+712: Você não possui %s suficiente (%u).
 713: Você não tem '%s' suficiente.
 713: Você não tem '%s' suficiente.
-714: Lista de Loja de Itens: %s (%hu)
+714: Lista de Loja de Itens: %s (%u)
 715: Lista de loja de pontos: '%s'
 715: Lista de loja de pontos: '%s'
 716: Seu '%s' agora é: %d
 716: Seu '%s' agora é: %d
 // MVP EXP reward message
 // MVP EXP reward message
@@ -1225,9 +1225,9 @@
 1189: Item não encontrado.
 1189: Item não encontrado.
 1190: Você já está autorrecolhendo este item.
 1190: Você já está autorrecolhendo este item.
 1191: Sua lista de autorrecolhimento está cheia. Remova alguns itens com @autolootid -<nome ou ID do item>.
 1191: Sua lista de autorrecolhimento está cheia. Remova alguns itens com @autolootid -<nome ou ID do item>.
-1192: Autorrecolhendo item: '%s'/'%s' {%hu}
+1192: Autorrecolhendo item: '%s'/'%s' {%u}
 1193: Você atualmente não está autorrecolhendo este item.
 1193: Você atualmente não está autorrecolhendo este item.
-1194: Removido item: '%s'/'%s' {%hu} da sua lista de autorrecolhimento.
+1194: Removido item: '%s'/'%s' {%u} da sua lista de autorrecolhimento.
 1195: Você pode possuir %d itens na sua lista de autorrecolhimento.
 1195: Você pode possuir %d itens na sua lista de autorrecolhimento.
 1196: Para adicionar um item a lista, use "@alootid +<nome ou ID do item>". Para remover um item, use "@alootid -<nome ou ID do item>".
 1196: Para adicionar um item a lista, use "@alootid +<nome ou ID do item>". Para remover um item, use "@alootid -<nome ou ID do item>".
 1197: "@alootid reset" irá limpar a sua lista de autorrecolhimento.
 1197: "@alootid reset" irá limpar a sua lista de autorrecolhimento.
@@ -1376,7 +1376,7 @@
 
 
 // @iteminfo
 // @iteminfo
 1276: Digite o nome/ID de um item (uso: @ii/@iteminfo <nome do item/ID>).
 1276: Digite o nome/ID de um item (uso: @ii/@iteminfo <nome do item/ID>).
-1277: Item: '%s'/'%s'[%d] (%hu) Tipo: %s | Efeito Extra: %s
+1277: Item: '%s'/'%s'[%d] (%u) Tipo: %s | Efeito Extra: %s
 1278: Nenhum
 1278: Nenhum
 1279: Com script
 1279: Com script
 1280: NPC Compra:%dz, Venda:%dz | Peso: %.1f 
 1280: NPC Compra:%dz, Venda:%dz | Peso: %.1f 

+ 6 - 6
conf/msg_conf/map_msg_rus.conf

@@ -94,7 +94,7 @@
 75: Война за Империум в настоящее время не идёт.
 75: Война за Империум в настоящее время не идёт.
 76: Все навыки добавлены в дерево умений.
 76: Все навыки добавлены в дерево умений.
 77: Результаты поиска '%s' (название: ID):
 77: Результаты поиска '%s' (название: ID):
-78: %s: %d
+78: %s: %u
 79: Всего найдено %d результатов.
 79: Всего найдено %d результатов.
 80: Введите отображаемое имя или ID/название монстра.
 80: Введите отображаемое имя или ID/название монстра.
 81: Ваши права Администратора не позволяют выполнять данное действие на указанного игрока.
 81: Ваши права Администратора не позволяют выполнять данное действие на указанного игрока.
@@ -181,7 +181,7 @@
 166: Ни один предмет не был заточен.
 166: Ни один предмет не был заточен.
 167: 1 предмет заточен.
 167: 1 предмет заточен.
 168: %d предметов заточено.
 168: %d предметов заточено.
-169: Предмет (%hu: '%s') невозможно надеть.
+169: Предмет (%u: '%s') невозможно надеть.
 170: Предмет невозможно надеть.
 170: Предмет невозможно надеть.
 171: %d - пусто
 171: %d - пусто
 //172: НЕ ИСПОЛЬЗУЕТСЯ
 //172: НЕ ИСПОЛЬЗУЕТСЯ
@@ -512,7 +512,7 @@
 537: Персонаж '%s' (account: %d) пытается использовать бота (попытка определения поддельного монстра).
 537: Персонаж '%s' (account: %d) пытается использовать бота (попытка определения поддельного монстра).
 // Сообщения о хаках при торгах
 // Сообщения о хаках при торгах
 538: Хак при торге: персонаж '%s' (account: %d) попытался выменять больше предметов чем у него есть.
 538: Хак при торге: персонаж '%s' (account: %d) попытался выменять больше предметов чем у него есть.
-539: У игрока есть %d штук (id: %hu), и пытался выменять %d из них.
+539: У игрока есть %d штук (id: %u), и пытался выменять %d из них.
 540: Этот игрок был навсегда заблокирован.
 540: Этот игрок был навсегда заблокирован.
 // Объявления о выбивании/краже редких предметов
 // Объявления о выбивании/краже редких предметов
 541: '%s' выбил %s's %s (шанс: %0.02f%%)
 541: '%s' выбил %s's %s (шанс: %0.02f%%)
@@ -1055,9 +1055,9 @@
 1189: Предмет не найден.
 1189: Предмет не найден.
 1190: Этот предмет вы уже собираете автоматически.
 1190: Этот предмет вы уже собираете автоматически.
 1191: Список автоматической сборки полон. Удалите некоторые предметы через команду @autolootid -<ID/название предмета>.
 1191: Список автоматической сборки полон. Удалите некоторые предметы через команду @autolootid -<ID/название предмета>.
-1192: Автоматическое поднятие предмета: '%s'/'%s' {%hu}
+1192: Автоматическое поднятие предмета: '%s'/'%s' {%u}
 1193: Этот предмет вы не собираете автоматически.
 1193: Этот предмет вы не собираете автоматически.
-1194: Предмет: '%s'/'%s' {%hu} удалён из списка автоматической сборки предметов.
+1194: Предмет: '%s'/'%s' {%u} удалён из списка автоматической сборки предметов.
 1195: Вы можете иметь %d предметов в списке автоматической сборки предметов.
 1195: Вы можете иметь %d предметов в списке автоматической сборки предметов.
 1196: Чтобы добавить предмет в список используйте "@alootid +<ID/название предмета>". Чтобы удалить предмет из списка: "@alootid -<ID/название предмета>".
 1196: Чтобы добавить предмет в список используйте "@alootid +<ID/название предмета>". Чтобы удалить предмет из списка: "@alootid -<ID/название предмета>".
 1197: Команда "@alootid reset" очистит список.
 1197: Команда "@alootid reset" очистит список.
@@ -1206,7 +1206,7 @@
 
 
 // @iteminfo
 // @iteminfo
 1276: Введите ID/название предмета (Использование: @ii/@iteminfo <ID/название предмета>).
 1276: Введите ID/название предмета (Использование: @ii/@iteminfo <ID/название предмета>).
-1277: Предмет: '%s'/'%s'[%d] (%hu) Тип: %s | Доп. эффект: %s
+1277: Предмет: '%s'/'%s'[%d] (%u) Тип: %s | Доп. эффект: %s
 1278: Пусто
 1278: Пусто
 1279: Скрипт
 1279: Скрипт
 1280: НИП покупка:%d зени, продажа:%d зени | Вес: %.1f 
 1280: НИП покупка:%d зени, продажа:%d зени | Вес: %.1f 

+ 11 - 11
conf/msg_conf/map_msg_spn.conf

@@ -92,7 +92,7 @@
 75: En estos momentos no hay ninguna guerra de clanes.
 75: En estos momentos no hay ninguna guerra de clanes.
 76: Se han añadido todas las habilidades a tu árbol de habilidades.
 76: Se han añadido todas las habilidades a tu árbol de habilidades.
 77: Estos son los resultados de la búsqueda de '%s' (nombre: ID):
 77: Estos son los resultados de la búsqueda de '%s' (nombre: ID):
-78: %s: %d
+78: %s: %u
 79: Total de resultados: %d
 79: Total de resultados: %d
 80: Debes introducir el nombre del monstruo o su ID.
 80: Debes introducir el nombre del monstruo o su ID.
 81: Tu nivel de GM no te permite utilizar este comando en ese jugador.
 81: Tu nivel de GM no te permite utilizar este comando en ese jugador.
@@ -179,7 +179,7 @@
 166: No se ha refinado ningún objeto.
 166: No se ha refinado ningún objeto.
 167: Se ha refinado 1 objeto.
 167: Se ha refinado 1 objeto.
 168: Se han refinado %d objetos.
 168: Se han refinado %d objetos.
-169: El objeto (%hu: '%s') no puede ser equipado.
+169: El objeto (%u: '%s') no puede ser equipado.
 170: No puedes equiparte ese objeto.
 170: No puedes equiparte ese objeto.
 171: %d - vacío
 171: %d - vacío
 //172: Has reemplazado tu lugar memorizado %d - %s (%d,%d).
 //172: Has reemplazado tu lugar memorizado %d - %s (%d,%d).
@@ -545,7 +545,7 @@
 
 
 // Mensajes del sistema de intercambio de objetos
 // Mensajes del sistema de intercambio de objetos
 538: Se ha detectado una irregularidad en el intercambio de objetos del personaje '%s' (cuenta: %d), está intentando intercambiar más de lo que tiene.
 538: Se ha detectado una irregularidad en el intercambio de objetos del personaje '%s' (cuenta: %d), está intentando intercambiar más de lo que tiene.
-539: Ese jugador tiene %d unidades del objeto (id: %hu), pero ha intentado intercambiar %d.
+539: Ese jugador tiene %d unidades del objeto (id: %u), pero ha intentado intercambiar %d.
 540: Ese jugador ha sido bloqueado.
 540: Ese jugador ha sido bloqueado.
 
 
 // Anuncios de consecución de objetos poco comunes y robos de objetos.
 // Anuncios de consecución de objetos poco comunes y robos de objetos.
@@ -733,14 +733,14 @@
 707: Serás VIP hasta: %s
 707: Serás VIP hasta: %s
 708: El jugador será VIP hasta: %s
 708: El jugador será VIP hasta: %s
 
 
-709: El objeto %hu ha sido eliminado de tu inventario.
-710: El objeto %hu ha sido eliminado de tu carro.
-711: El objeto %hu ha sido eliminado de tu almacén.
+709: El objeto %u ha sido eliminado de tu inventario.
+710: El objeto %u ha sido eliminado de tu carro.
+711: El objeto %u ha sido eliminado de tu almacén.
 
 
 // Item shop
 // Item shop
-712: No tienes suficientes %s (%hu).
+712: No tienes suficientes %s (%u).
 713: No tienes suficientes '%s'.
 713: No tienes suficientes '%s'.
-714: Listado de la tienda de objetos: %s (%hu)
+714: Listado de la tienda de objetos: %s (%u)
 715: Listado de puntos de la tienda: '%s'
 715: Listado de puntos de la tienda: '%s'
 716: Tu '%s' ahora es: %d
 716: Tu '%s' ahora es: %d
 
 
@@ -1194,9 +1194,9 @@
 1189: Ese objeto no existe.
 1189: Ese objeto no existe.
 1190: Ese objeto ya estaba programado para ser recogido automáticamente.
 1190: Ese objeto ya estaba programado para ser recogido automáticamente.
 1191: Tu lista de recogida de objetos de forma automática está llena. Elimina alguno de esos objetos con @autolootid <nombre/ID del objeto>.
 1191: Tu lista de recogida de objetos de forma automática está llena. Elimina alguno de esos objetos con @autolootid <nombre/ID del objeto>.
-1192: Recogiendo: '%s'/'%s' {%hu}
+1192: Recogiendo: '%s'/'%s' {%u}
 1193: No estás recogiendo ese objeto.
 1193: No estás recogiendo ese objeto.
-1194: Has eliminado '%s'/'%s' {%hu} de tu lista de recogida de objetos.
+1194: Has eliminado '%s'/'%s' {%u} de tu lista de recogida de objetos.
 1195: Puedes almacenar %d objetos en tu lista de recogida de objetos.
 1195: Puedes almacenar %d objetos en tu lista de recogida de objetos.
 1196: Para añadir un nuevo objeto a la lista utiliza @alootid +<nombre/ID del objeto>. Para eliminar un objeto utiliza @alootid -<nombre/ID del objeto>.
 1196: Para añadir un nuevo objeto a la lista utiliza @alootid +<nombre/ID del objeto>. Para eliminar un objeto utiliza @alootid -<nombre/ID del objeto>.
 1197: "@alootid reset" reiniciará tu lista de recogida de objetos.
 1197: "@alootid reset" reiniciará tu lista de recogida de objetos.
@@ -1345,7 +1345,7 @@
 
 
 // @iteminfo
 // @iteminfo
 1276: Introduce el nombre/ID de un objeto (instrucciones: @ii/@iteminfo <nombre/ID del objeto>).
 1276: Introduce el nombre/ID de un objeto (instrucciones: @ii/@iteminfo <nombre/ID del objeto>).
-1277: Objeto: '%s'/'%s'[%d] (%hu) Tipo: %s | Efecto: %s
+1277: Objeto: '%s'/'%s'[%d] (%u) Tipo: %s | Efecto: %s
 1278: Ninguno
 1278: Ninguno
 1279: Contiene código
 1279: Contiene código
 1280: Compra en NPC:%dz, Venta:%dz | Peso: %.1f
 1280: Compra en NPC:%dz, Venta:%dz | Peso: %.1f

+ 6 - 6
conf/msg_conf/map_msg_tha.conf

@@ -96,7 +96,7 @@
 75: War of Emperium äÁèä´é·Ó§Ò¹ÍÂÙèã¹¢³Ð¹Õé.
 75: War of Emperium äÁèä´é·Ó§Ò¹ÍÂÙèã¹¢³Ð¹Õé.
 76: ·Ø¡ Skill ä´é¶Ù¡à¾ÔèÁº¹µÑÇÅФäسàÃÕºÃéÍÂáÅéÇ.
 76: ·Ø¡ Skill ä´é¶Ù¡à¾ÔèÁº¹µÑÇÅФäسàÃÕºÃéÍÂáÅéÇ.
 77: ¼ÅÅѾ¸ì¡Òäé¹ËÒâ´ÂÍéÒ§ÍÔ§¨Ò¡ '%s' (ª×èÍ: ÃËÑÊ):
 77: ¼ÅÅѾ¸ì¡Òäé¹ËÒâ´ÂÍéÒ§ÍÔ§¨Ò¡ '%s' (ª×èÍ: ÃËÑÊ):
-78: %s: %d
+78: %s: %u
 79: ¼ÅÅѾ¸ì %d ¢éÒ§µé¹.
 79: ¼ÅÅѾ¸ì %d ¢éÒ§µé¹.
 80: ¡ÃسÒÃкت×èÍ Monster ËÃ×Í ÃËÑÊ Monster.
 80: ¡ÃسÒÃкت×èÍ Monster ËÃ×Í ÃËÑÊ Monster.
 81: ÃдѺ GM ¢Í§¤Ø³ äÁèä´éÃѺ͹حҵãË館³ÊÒÁÒö´Óà¹Ô¹¡ÒáѺµÑÇÅФ÷ÕèÃкØä´é.
 81: ÃдѺ GM ¢Í§¤Ø³ äÁèä´éÃѺ͹حҵãË館³ÊÒÁÒö´Óà¹Ô¹¡ÒáѺµÑÇÅФ÷ÕèÃкØä´é.
@@ -183,7 +183,7 @@
 166: äÁèÁÕ Item ·Õèä´éÃѺ¡ÒÃÍѾà¡Ãµ.
 166: äÁèÁÕ Item ·Õèä´éÃѺ¡ÒÃÍѾà¡Ãµ.
 167: ÁÕ 1 Item ·Õèä´éÃѺ¡ÒÃÍѾà¡Ãµ.
 167: ÁÕ 1 Item ·Õèä´éÃѺ¡ÒÃÍѾà¡Ãµ.
 168: ÁÕ %d Item ·Õèä´éÃѺ¡ÒÃÍѾà¡Ãµ.
 168: ÁÕ %d Item ·Õèä´éÃѺ¡ÒÃÍѾà¡Ãµ.
-169: Item (%hu: '%s') ¹ÕéäÁèãªèÍØ»¡Ã³ìÊÇÁãÊè.
+169: Item (%u: '%s') ¹ÕéäÁèãªèÍØ»¡Ã³ìÊÇÁãÊè.
 170: äÁ辺 Item ªÔé¹¹Õéã¹°Ò¹¢éÍÁÙÅ.
 170: äÁ辺 Item ªÔé¹¹Õéã¹°Ò¹¢éÍÁÙÅ.
 171: %d - ÇèÒ§
 171: %d - ÇèÒ§
 //172: You replace previous memo position %d - %s (%d,%d).
 //172: You replace previous memo position %d - %s (%d,%d).
@@ -506,7 +506,7 @@
 537: µÑÇÅФà '%s' (account: %d) ¾ÂÒÂÒÁ·Õè¨Ðãªé bot (Áѹ¾ÂÒÂÒÁ·Õè¨ÐµÃǨ¾º monster »ÅÍÁ).
 537: µÑÇÅФà '%s' (account: %d) ¾ÂÒÂÒÁ·Õè¨Ðãªé bot (Áѹ¾ÂÒÂÒÁ·Õè¨ÐµÃǨ¾º monster »ÅÍÁ).
 // Trade Spoof Messages
 // Trade Spoof Messages
 538: Hack on trade: µÑÇÅФà '%s' (account: %d) ¾ÂÒÂÒÁ·Õè¨ÐáÅ¡à»ÅÕè¹ item ¨Ó¹Ç¹ÁÒ¡¡ÇèÒ·ÕèÁÕÍÂÙè.
 538: Hack on trade: µÑÇÅФà '%s' (account: %d) ¾ÂÒÂÒÁ·Õè¨ÐáÅ¡à»ÅÕè¹ item ¨Ó¹Ç¹ÁÒ¡¡ÇèÒ·ÕèÁÕÍÂÙè.
-539: ¼ÙéàÅè¹ÁÕ item ¨Ó¹Ç¹ %d (id: %hu), áÅоÂÒÂÒÁ¨ÐáÅ¡à»ÅÕè¹㹨ӹǹ %d.
+539: ¼ÙéàÅè¹ÁÕ item ¨Ó¹Ç¹ %d (id: %u), áÅоÂÒÂÒÁ¨ÐáÅ¡à»ÅÕè¹㹨ӹǹ %d.
 540: ¼ÙéàÅè¹¹Õé¶Ù¡ËéÒÁáÅ¡à»ÅÕè¹.
 540: ¼ÙéàÅè¹¹Õé¶Ù¡ËéÒÁáÅ¡à»ÅÕè¹.
 // Rare Items Drop/Steal announce
 // Rare Items Drop/Steal announce
 541: '%s' à¡çº %s's %s (âÍ¡ÒÊ: %0.02f%%)
 541: '%s' à¡çº %s's %s (âÍ¡ÒÊ: %0.02f%%)
@@ -1048,9 +1048,9 @@
 1189: äÁ辺 Item ´Ñ§¡ÅèÒÇ.
 1189: äÁ辺 Item ´Ñ§¡ÅèÒÇ.
 1190: ¤Ø³ä´éºÑ¹·Ö¡ item ¹Õéŧã¹ÃÒ¡ÒÃä»àÃÕºÃéÍÂáÅéÇ.
 1190: ¤Ø³ä´éºÑ¹·Ö¡ item ¹Õéŧã¹ÃÒ¡ÒÃä»àÃÕºÃéÍÂáÅéÇ.
 1191: ÃÒ¡Òà autolootitem ¢Í§¤Ø³àµçÁáÅéÇ. ź item ºÒ§ÃÒ¡ÒÃÍÍ¡¡è͹´éÇ @autolootid -<ª×èÍ/ID item>.
 1191: ÃÒ¡Òà autolootitem ¢Í§¤Ø³àµçÁáÅéÇ. ź item ºÒ§ÃÒ¡ÒÃÍÍ¡¡è͹´éÇ @autolootid -<ª×èÍ/ID item>.
-1192: ºÑ¹·Ö¡ item : '%s'/'%s' {%hu} ŧÃÒ¡Òà autolootitem ¢Í§¤Ø³.
+1192: ºÑ¹·Ö¡ item : '%s'/'%s' {%u} ŧÃÒ¡Òà autolootitem ¢Í§¤Ø³.
 1193: ¤Ø³äÁèä´éºÑ¹·Ö¡ item ¹Õéŧã¹ÃÒ¡ÒÃÍÂÙèáÅéÇ.
 1193: ¤Ø³äÁèä´éºÑ¹·Ö¡ item ¹Õéŧã¹ÃÒ¡ÒÃÍÂÙèáÅéÇ.
-1194: ź item : '%s'/'%s' {%hu} ¨Ò¡ÃÒ¡Òà autolootitem ¢Í§¤Ø³.
+1194: ź item : '%s'/'%s' {%u} ¨Ò¡ÃÒ¡Òà autolootitem ¢Í§¤Ø³.
 1195: ¤Ø³ÊÒÁÒöºÑ¹·Ö¡ä´é %d item 㹡ÒÃÃÒ¡Òà autolootitem.
 1195: ¤Ø³ÊÒÁÒöºÑ¹·Ö¡ä´é %d item 㹡ÒÃÃÒ¡Òà autolootitem.
 1196: 㹡ÒÃà¾ÔèÁÃÒ¡ÒÃ, ãªé "@alootid +<ª×èÍ/ID item>". 㹡ÒÃźÃÒ¡ÒÃ, ãªé "@alootid -<ª×èÍ/ID item>".
 1196: 㹡ÒÃà¾ÔèÁÃÒ¡ÒÃ, ãªé "@alootid +<ª×èÍ/ID item>". 㹡ÒÃźÃÒ¡ÒÃ, ãªé "@alootid -<ª×èÍ/ID item>".
 1197: "@alootid reset" 㹡ÒÃÅéÒ§ÃÒ¡Òà autolootitem ¢Í§¤Ø³.
 1197: "@alootid reset" 㹡ÒÃÅéÒ§ÃÒ¡Òà autolootitem ¢Í§¤Ø³.
@@ -1199,7 +1199,7 @@
 
 
 // @iteminfo
 // @iteminfo
 1276: â»Ã´Ãкت×èÍ/ID item (ÇÔ¸Õãªé: @ii/@iteminfo <ª×èÍ/ID item>).
 1276: â»Ã´Ãкت×èÍ/ID item (ÇÔ¸Õãªé: @ii/@iteminfo <ª×èÍ/ID item>).
-1277: Item: '%s'/'%s'[%d] (%hu) Type: %s | Extra Effect: %s
+1277: Item: '%s'/'%s'[%d] (%u) Type: %s | Extra Effect: %s
 1278: None
 1278: None
 1279: With script
 1279: With script
 1280: NPC Buy:%dz, Sell:%dz | Weight: %.1f
 1280: NPC Buy:%dz, Sell:%dz | Weight: %.1f

+ 30 - 0
db/pre-re/skill_db.yml

@@ -15307,10 +15307,12 @@ Body:
     DamageFlags:
     DamageFlags:
       Splash: true
       Splash: true
       SplashSplit: true
       SplashSplit: true
+      IgnoreDefense: true
     Flags:
     Flags:
       IsNpc: true
       IsNpc: true
       TargetTrap: true
       TargetTrap: true
       ShowScale: true
       ShowScale: true
+      IgnoreLandProtector: true
     Hit: Multi_Hit
     Hit: Multi_Hit
     HitCount: 1
     HitCount: 1
     SplashArea:
     SplashArea:
@@ -15334,6 +15336,34 @@ Body:
         Area: 11
         Area: 11
       - Level: 10
       - Level: 10
         Area: 13
         Area: 13
+    Duration1: 910
+    Unit:
+      Id: Earthquake
+      Range:
+        - Level: 1
+          Size: 5
+        - Level: 2
+          Size: 7
+        - Level: 3
+          Size: 9
+        - Level: 4
+          Size: 11
+        - Level: 5
+          Size: 13
+        - Level: 6
+          Size: 5
+        - Level: 7
+          Size: 7
+        - Level: 8
+          Size: 9
+        - Level: 9
+          Size: 11
+        - Level: 10
+          Size: 13
+      Interval: 300
+      Target: Enemy
+      Flag:
+        PathCheck: true
   - Id: 654
   - Id: 654
     Name: NPC_FIREBREATH
     Name: NPC_FIREBREATH
     Description: Fire Breath
     Description: Fire Breath

+ 56 - 38
db/re/item_db.txt

@@ -4289,23 +4289,23 @@
 6186,Monkey_Wrench,Monkey Wrench,3,500,,10,,,,,,,,,,,,,{},{},{}
 6186,Monkey_Wrench,Monkey Wrench,3,500,,10,,,,,,,,,,,,,{},{},{}
 6187,Blank_Card,Blank Card,3,20,,10,,,,,,,,,,,,,{},{},{}
 6187,Blank_Card,Blank Card,3,20,,10,,,,,,,,,,,,,{},{},{}
 6188,Slot_Coupon,Slotting Advertisement,3,20,,10,,,,,,,,,,,,,{},{},{}
 6188,Slot_Coupon,Slotting Advertisement,3,20,,10,,,,,,,,,,,,,{},{},{}
-6189,Magic_Book_FB,Spell Book (Fire Bolt),3,0,,0,,,,,,,,,,,,,{},{},{}
-6190,Magic_Book_CB,Spell Book (Cold Bolt),3,0,,0,,,,,,,,,,,,,{},{},{}
-6191,Magic_Book_LB,Spell Book (Lightening Bolt),3,0,,0,,,,,,,,,,,,,{},{},{}
-6192,Magic_Book_SG,Spell Book (Storm Gust),3,0,,0,,,,,,,,,,,,,{},{},{}
-6193,Magic_Book_LOV,Spell Book (Lord Of Vermilion),3,0,,0,,,,,,,,,,,,,{},{},{}
-6194,Magic_Book_MS,Spell Book (Meteor Storm),3,0,,0,,,,,,,,,,,,,{},{},{}
-6195,Magic_Book_CM,Spell Book (Comet),3,0,,0,,,,,,,,,,,,,{},{},{}
-6196,Magic_Book_TV,Spell Book (Tetra Vortex),3,0,,0,,,,,,,,,,,,,{},{},{}
-6197,Magic_Book_TS,Spell Book (Thunder Storm),3,0,,0,,,,,,,,,,,,,{},{},{}
-6198,Magic_Book_JT,Spell Book (Jupitel Thunder),3,0,,0,,,,,,,,,,,,,{},{},{}
-6199,Magic_Book_WB,Spell Book (Water Ball),3,0,,0,,,,,,,,,,,,,{},{},{}
-6200,Magic_Book_HD,Spell Book (Heaven's Drive),3,0,,0,,,,,,,,,,,,,{},{},{}
-6201,Magic_Book_ES,Spell Book (Earth Spike),3,0,,0,,,,,,,,,,,,,{},{},{}
-6202,Magic_Book_ES_,Spell Book (Earth Strain),3,0,,0,,,,,,,,,,,,,{},{},{}
-6203,Magic_Book_CL,Spell Book (Chain Lightning),3,0,,0,,,,,,,,,,,,,{},{},{}
-6204,Magic_Book_CR,Spell Book (Crimson Rock),3,0,,0,,,,,,,,,,,,,{},{},{}
-6205,Magic_Book_DL,Spell Book (Drain Life),3,0,,0,,,,,,,,,,,,,{},{},{}
+6189,Magic_Book_FB,Old Spell Book (Fire Bolt),3,0,,0,,,,,,,,,,,,,{},{},{}
+6190,Magic_Book_CB,Old Spell Book (Cold Bolt),3,0,,0,,,,,,,,,,,,,{},{},{}
+6191,Magic_Book_LB,Old Spell Book (Lightening Bolt),3,0,,0,,,,,,,,,,,,,{},{},{}
+6192,Magic_Book_SG,Old Spell Book (Storm Gust),3,0,,0,,,,,,,,,,,,,{},{},{}
+6193,Magic_Book_LOV,Old Spell Book (Lord Of Vermilion),3,0,,0,,,,,,,,,,,,,{},{},{}
+6194,Magic_Book_MS,Old Spell Book (Meteor Storm),3,0,,0,,,,,,,,,,,,,{},{},{}
+6195,Magic_Book_CM,Old Spell Book (Comet),3,0,,0,,,,,,,,,,,,,{},{},{}
+6196,Magic_Book_TV,Old Spell Book (Tetra Vortex),3,0,,0,,,,,,,,,,,,,{},{},{}
+6197,Magic_Book_TS,Old Spell Book (Thunder Storm),3,0,,0,,,,,,,,,,,,,{},{},{}
+6198,Magic_Book_JT,Old Spell Book (Jupitel Thunder),3,0,,0,,,,,,,,,,,,,{},{},{}
+6199,Magic_Book_WB,Old Spell Book (Water Ball),3,0,,0,,,,,,,,,,,,,{},{},{}
+6200,Magic_Book_HD,Old Spell Book (Heaven's Drive),3,0,,0,,,,,,,,,,,,,{},{},{}
+6201,Magic_Book_ES,Old Spell Book (Earth Spike),3,0,,0,,,,,,,,,,,,,{},{},{}
+6202,Magic_Book_ES_,Old Spell Book (Earth Strain),3,0,,0,,,,,,,,,,,,,{},{},{}
+6203,Magic_Book_CL,Old Spell Book (Chain Lightning),3,0,,0,,,,,,,,,,,,,{},{},{}
+6204,Magic_Book_CR,Old Spell Book (Crimson Rock),3,0,,0,,,,,,,,,,,,,{},{},{}
+6205,Magic_Book_DL,Old Spell Book (Drain Life),3,0,,0,,,,,,,,,,,,,{},{},{}
 6206,I_Love_You,I Love You,3,0,,0,,,,,,,,,,,,,{},{},{}
 6206,I_Love_You,I Love You,3,0,,0,,,,,,,,,,,,,{},{},{}
 6207,Thank_You,Thank You,3,0,,0,,,,,,,,,,,,,{},{},{}
 6207,Thank_You,Thank You,3,0,,0,,,,,,,,,,,,,{},{},{}
 6208,I_Respect_You,I Respect You,3,0,,0,,,,,,,,,,,,,{},{},{}
 6208,I_Respect_You,I Respect You,3,0,,0,,,,,,,,,,,,,{},{},{}
@@ -4792,16 +4792,16 @@
 6745,HealStone_Bottom,Recovery Stone (Low),6,20,,10,,,,,,,,,,,,,{},{},{}
 6745,HealStone_Bottom,Recovery Stone (Low),6,20,,10,,,,,,,,,,,,,{},{},{}
 6746,Iron_Artifacts,Steel Artifact,3,10,,0,,,,,,,,,,,,,{},{},{}
 6746,Iron_Artifacts,Steel Artifact,3,10,,0,,,,,,,,,,,,,{},{},{}
 6747,Iron_Artifacts_,Steel Artifact,3,10,,0,,,,,,,,,,,,,{},{},{}
 6747,Iron_Artifacts_,Steel Artifact,3,10,,0,,,,,,,,,,,,,{},{},{}
-6748,Daily_Report_He_And_His_Team,Daily Report He And His Team,3,10,,0,,,,,,,,,,,,,{},{},{}
-6749,Operation_Control_Device,Operation Control Device,3,10,,0,,,,,,,,,,,,,{},{},{}
+6748,Excavator_Repoet,Daily Report He And His Team,3,10,,0,,,,,,,,,,,,,{},{},{}
+6749,Power_Control_Device,Operation Control Device,3,10,,0,,,,,,,,,,,,,{},{},{}
 6750,Failed_Engine,Failed Engine,3,10,,10,,,,,,,,,,,,,{},{},{}
 6750,Failed_Engine,Failed Engine,3,10,,10,,,,,,,,,,,,,{},{},{}
 6751,Crushed_Can_Iron_Plate,Crushed Can Iron Plate,3,10,,10,,,,,,,,,,,,,{},{},{}
 6751,Crushed_Can_Iron_Plate,Crushed Can Iron Plate,3,10,,10,,,,,,,,,,,,,{},{},{}
 6752,Charleston_Parts,Charleston Parts,3,10,,10,,,,,,,,,,,,,{},{},{}
 6752,Charleston_Parts,Charleston Parts,3,10,,10,,,,,,,,,,,,,{},{},{}
-6753,Token_Of_Destruction,Token Of Destruction,3,10,,0,,,,,,,,,,,,,{},{},{}
-6754,Collected_Medicinal_Herbs,Collected Medicinal Herbs,3,10,,0,,,,,,,,,,,,,{},{},{}
+6753,Sign_Of_Destruction,Token Of Destruction,3,10,,0,,,,,,,,,,,,,{},{},{}
+6754,Collected_Herb,Collected Medicinal Herbs,3,10,,0,,,,,,,,,,,,,{},{},{}
 6755,Contaminated_Magic,Contaminated Magic,3,20,,10,,,,,,,,,,,,,{},{},{}
 6755,Contaminated_Magic,Contaminated Magic,3,20,,10,,,,,,,,,,,,,{},{},{}
-6756,Cohesive_Energy,Cohesive Energy,3,20,,0,,,,,,,,,,,,,{},{},{}
-6757,The_Memory_Recorder,The Memory Recorder,3,20,,0,,,,,,,,,,,,,{},{},{}
+6756,Condensed_Energy,Cohesive Energy,3,20,,0,,,,,,,,,,,,,{},{},{}
+6757,Memory_Record,The Memory Recorder,3,20,,0,,,,,,,,,,,,,{},{},{}
 
 
 6762,Banana_Can,Banana Can,3,0,,10,,,,,,,,,,,,,{},{},{}
 6762,Banana_Can,Banana Can,3,0,,10,,,,,,,,,,,,,{},{},{}
 6763,Spicy_Rice_Cake,Spicy Rice Cake,3,0,,10,,,,,,,,,,,,,{},{},{}
 6763,Spicy_Rice_Cake,Spicy Rice Cake,3,0,,10,,,,,,,,,,,,,{},{},{}
@@ -4848,11 +4848,11 @@
 6819,Acolyte_Soul,Acolyte Soul,3,10,,10,,,,,,,,,,,,,{},{},{}
 6819,Acolyte_Soul,Acolyte Soul,3,10,,10,,,,,,,,,,,,,{},{},{}
 6820,Particles_Of_Energy,Energy Fragment,3,0,,10,,,,,,,,,,,,,{},{},{}
 6820,Particles_Of_Energy,Energy Fragment,3,0,,10,,,,,,,,,,,,,{},{},{}
 6821,Solo_Troops_Badge,Single Union Badge,3,0,,0,,,,,,,,,,,,,{},{},{}
 6821,Solo_Troops_Badge,Single Union Badge,3,0,,0,,,,,,,,,,,,,{},{},{}
-6824,Experimental_Dong_Memory_Record,Experimental Dong Memory Record,3,10,,10,,,,,,,,,,,,,{},{},{}
+6824,Lab_Memory_Record,Experimental Dong Memory Record,3,10,,10,,,,,,,,,,,,,{},{},{}
 6825,Air_Cleaner_Box,Air Cleaner Box,3,10,,10000,,,,,,,,,,,,,{},{},{}
 6825,Air_Cleaner_Box,Air Cleaner Box,3,10,,10000,,,,,,,,,,,,,{},{},{}
 6826,Fresh_Grapes,Fresh Grapes,3,10,,100,,,,,,,,,,,,,{},{},{}
 6826,Fresh_Grapes,Fresh Grapes,3,10,,100,,,,,,,,,,,,,{},{},{}
-6827,Complete_Machine_Parts,Complete Machine Parts,3,10,,0,,,,,,,,,,,,,{},{},{}
-6828,Gravity_Safety_Device,Gravity Safety Device,3,10,,100,,,,,,,,,,,,,{},{},{}
+6827,Normal_Parts,Complete Machine Parts,3,10,,0,,,,,,,,,,,,,{},{},{}
+6828,Gravity_Parts,Gravity Safety Device,3,10,,100,,,,,,,,,,,,,{},{},{}
 6832,Questioned_Parts,Questioned Parts,3,10,,10,,,,,,,,,,,,,{},{},{}
 6832,Questioned_Parts,Questioned Parts,3,10,,10,,,,,,,,,,,,,{},{},{}
 6833,Limited_Token_of_Ziegfried,(Limited) Token of Ziegfried,3,10,,10,,,,,,,,,,,,,{},{},{}
 6833,Limited_Token_of_Ziegfried,(Limited) Token of Ziegfried,3,10,,10,,,,,,,,,,,,,{},{},{}
 6834,Legendary_Fur,Legendary Fur,3,10,,10,,,,,,,,,,,,,{},{},{}
 6834,Legendary_Fur,Legendary Fur,3,10,,10,,,,,,,,,,,,,{},{},{}
@@ -11485,11 +11485,11 @@
 22685,Solo_Christmas_Gift,Single Union Christmas Gift,2,0,,0,,,,,0xFFFFFFFF,63,2,,,0,,,{ getgroupitem(IG_Solo_Christmas_Gift); },{},{}
 22685,Solo_Christmas_Gift,Single Union Christmas Gift,2,0,,0,,,,,0xFFFFFFFF,63,2,,,0,,,{ getgroupitem(IG_Solo_Christmas_Gift); },{},{}
 22686,Solo_Cookie,Single Cookie,0,0,,50,,,,,0xFFFFFFFF,63,2,,,0,,,{ percentheal 5,5; },{},{}
 22686,Solo_Cookie,Single Cookie,0,0,,50,,,,,0xFFFFFFFF,63,2,,,0,,,{ percentheal 5,5; },{},{}
 22687,Pieces_Of_Sentiment,Sentimental Fragment,11,0,,1,,,,0,0xFFFFFFFF,63,2,,,100,,,{ callfunc("F_Pieces_Of_Sentiment"); },{},{}
 22687,Pieces_Of_Sentiment,Sentimental Fragment,11,0,,1,,,,0,0xFFFFFFFF,63,2,,,100,,,{ callfunc("F_Pieces_Of_Sentiment"); },{},{}
-22691,Record_Fragment1,Record Fragment,0,,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "un_bk_q",98,143; if (callfunc("F_time_limit_recorder") == 1) { recorder_quest_type = 1; } },{},{}
-22692,Record_Fragment2,Record Fragment,0,,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "un_bk_q",45,276; if (callfunc("F_time_limit_recorder") == 1) { recorder_quest_type = 2; } },{},{}
-22693,Record_Fragment3,Record Fragment,0,,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "un_bk_q",217,346; if (callfunc("F_time_limit_recorder") == 1) { recorder_quest_type = 3; } },{},{}
-22694,Record_Fragment4,Record Fragment,0,,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "un_bk_q",273,235; if (callfunc("F_time_limit_recorder") == 1) { recorder_quest_type = 4; } },{},{}
-22695,Record_Fragment5,Record Fragment,0,,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "un_bk_q",275,290; if (callfunc("F_time_limit_recorder") == 1) { recorder_quest_type = 5; } },{},{}
+22691,Piece_Of_Record1,Record Fragment,0,,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "un_bk_q",98,143; },{},{}
+22692,Piece_Of_Record2,Record Fragment,0,,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "un_bk_q",45,276; },{},{}
+22693,Piece_Of_Record3,Record Fragment,0,,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "un_bk_q",217,346; },{},{}
+22694,Piece_Of_Record4,Record Fragment,0,,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "un_bk_q",273,235; },{},{}
+22695,Piece_Of_Record5,Record Fragment,0,,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ warp "un_bk_q",275,290; },{},{}
 22699,Test_Reagent,Test Reagent,2,,,30,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "bonus bFlee,100;",5,9; sc_start SC_BLIND,5000,0,10000,0; },{},{}
 22699,Test_Reagent,Test Reagent,2,,,30,,,,,0xFFFFFFFF,63,2,,,,,,{ bonus_script "bonus bFlee,100;",5,9; sc_start SC_BLIND,5000,0,10000,0; },{},{}
 22700,Jumping_Support_Box,Jumping Support Box,18,10,,0,,,,0,0xFFFFFFFF,63,2,,,,,,{ /*TODO: getitem 12529,1; getitem 12323,200; getitem 12324,50; and 5 boxes that containing quivers + oridecons*/ },{},{}
 22700,Jumping_Support_Box,Jumping Support Box,18,10,,0,,,,0,0xFFFFFFFF,63,2,,,,,,{ /*TODO: getitem 12529,1; getitem 12323,200; getitem 12324,50; and 5 boxes that containing quivers + oridecons*/ },{},{}
 22702,STR_Soul_Potion,STR Reduction Potion,11,10,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ callfunc "F_CashReduceStat",bStr,-1,22702; },{},{}
 22702,STR_Soul_Potion,STR Reduction Potion,11,10,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ callfunc "F_CashReduceStat",bStr,-1,22702; },{},{}
@@ -13668,15 +13668,33 @@
 32351,Estal,Estal,5,20,,700,195,,1,2,0x00040000,56,2,2,4,170,1,2,{ .@r = getrefine(); bonus2 bSkillCooldown,"GN_SPORE_EXPLOSION",-1000; bonus bBaseAtk,4*.@r; if (.@r>=11) .@val = 50; else if (.@r>=9) .@val = 30; bonus2 bSkillAtk,"GN_SPORE_EXPLOSION",.@val; },{},{}
 32351,Estal,Estal,5,20,,700,195,,1,2,0x00040000,56,2,2,4,170,1,2,{ .@r = getrefine(); bonus2 bSkillCooldown,"GN_SPORE_EXPLOSION",-1000; bonus bBaseAtk,4*.@r; if (.@r>=11) .@val = 50; else if (.@r>=9) .@val = 30; bonus2 bSkillAtk,"GN_SPORE_EXPLOSION",.@val; },{},{}
 
 
 //100052,Enchant_Stone_Box19,Costume Enchantment Stone Box 19,2,10,,10,,,,0,0xFFFFFFFF,63,2,,,1,,,{ getgroupitem(IG_Enchant_Stone_Box19); },{},{}
 //100052,Enchant_Stone_Box19,Costume Enchantment Stone Box 19,2,10,,10,,,,0,0xFFFFFFFF,63,2,,,1,,,{ getgroupitem(IG_Enchant_Stone_Box19); },{},{}
+
+//===================================================================
+// New Warlock Spell Books
+//===================================================================
+100065,WL_MB_SG,Spell Book (Storm Gust),11,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_READING_SB_READING",1; },{},{}
+100066,WL_MB_LOV,Spell Book (Lord of Vermilion),11,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_READING_SB_READING",2; },{},{}
+100067,WL_MB_MS,Spell Book (Meteor Storm),11,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_READING_SB_READING",3; },{},{}
+100068,WL_MB_DL,Spell Book (Drain Life),11,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_READING_SB_READING",4; },{},{}
+100069,WL_MB_JF,Spell Book (Jack Frost),11,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_READING_SB_READING",5; },{},{}
+100070,WL_MB_ES,Spell Book (Earth Strain),11,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_READING_SB_READING",6; },{},{}
+100071,WL_MB_CR,Spell Book (Crimson Rock),11,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_READING_SB_READING",7; },{},{}
+100072,WL_MB_CL,Spell Book (Chain Lightning),11,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_READING_SB_READING",8; },{},{}
+100073,WL_MB_CM,Spell Book (Comet),11,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_READING_SB_READING",9; },{},{}
+100074,WL_MB_TV,Spell Book (Tetra Vortex),11,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ itemskill "WL_READING_SB_READING",10; },{},{}
+
 //100202,Enchant_Stone_Box20,Costume Enchantment Stone Box 20,2,10,,10,,,,0,0xFFFFFFFF,63,2,,,1,,,{ getgroupitem(IG_Enchant_Stone_Box20); },{},{}
 //100202,Enchant_Stone_Box20,Costume Enchantment Stone Box 20,2,10,,10,,,,0,0xFFFFFFFF,63,2,,,1,,,{ getgroupitem(IG_Enchant_Stone_Box20); },{},{}
-//100231,Ref_T_Potion,Golden X,0,10,,30,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_REF_T_POTION,30000,0; },{},{}
-//100232,Add_Atk_Potion,Red Herb Activator,0,10,,30,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_ADD_ATK_DAMAGE,500000,15; },{},{}
-//100233,Add_Matk_Potion,Blue Herb Activator,0,10,,30,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_ADD_MATK_DAMAGE,500000,15; },{},{}
+
+100231,Ref_T_Potion,Golden X,0,10,,30,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_REF_T_POTION,30000,0; },{},{}
+100232,Add_Atk_Potion,Red Herb Activator,0,10,,30,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_ADD_ATK_DAMAGE,500000,15; },{},{}
+100233,Add_Matk_Potion,Blue Herb Activator,0,10,,30,,,,,0xFFFFFFFF,63,2,,,,,,{ sc_start SC_ADD_MATK_DAMAGE,500000,15; },{},{}
+
 //100314,Enchant_Stone_Box21,Costume Enchantment Stone Box 21,2,10,,10,,,,0,0xFFFFFFFF,63,2,,,1,,,{ getgroupitem(IG_Enchant_Stone_Box21); },{},{}
 //100314,Enchant_Stone_Box21,Costume Enchantment Stone Box 21,2,10,,10,,,,0,0xFFFFFFFF,63,2,,,1,,,{ getgroupitem(IG_Enchant_Stone_Box21); },{},{}
 // Costumes
 // Costumes
+//400020,C_BeachBall,Costume Beachball,4,0,,0,,,,0,0xFFFFFFFF,63,2,1024,,1,0,1918,{},{},{}
 //440000,C_SharkHead,Costume Shark Hat,4,0,,0,,,,0,0xFFFFFFFF,63,2,5120,,1,0,1919,{},{},{}
 //440000,C_SharkHead,Costume Shark Hat,4,0,,0,,,,0,0xFFFFFFFF,63,2,5120,,1,0,1919,{},{},{}
 //440002,C_Happy_Cat_TW,Costume Happy Cat,4,0,,0,,,,0,0xFFFFFFFF,63,2,7168,,1,0,1980,{},{},{}
 //440002,C_Happy_Cat_TW,Costume Happy Cat,4,0,,0,,,,0,0xFFFFFFFF,63,2,7168,,1,0,1980,{},{},{}
-//400020,C_BeachBall,Costume Beachball,4,0,,0,,,,0,0xFFFFFFFF,63,2,1024,,1,0,1918,{},{},{}
-//1100003,Concentrated_R_P,Concentrated Red Potion,0,10,,2,,,,,0xFFFFFFFF,63,2,,,120,,,{ itemheal rand(655,675),0; },{},{}
-//1100004,Concentrated_B_P,Concentrated Blue Potion,0,10,,2,,,,,0xFFFFFFFF,63,2,,,120,,,{ itemheal 0,rand(340,360); },{},{}
-//1100005,Concentrated_G_P,Concentrated Gold Potion,0,10,,2,,,,,0xFFFFFFFF,63,2,,,180,,,{ itemheal rand(2730,2750),0; },{},{}
+
+1100003,Concentrated_R_P,Concentrated Red Potion,0,10,,2,,,,,0xFFFFFFFF,63,2,,,120,,,{ itemheal rand(655,675),0; },{},{}
+1100004,Concentrated_B_P,Concentrated Blue Potion,0,10,,2,,,,,0xFFFFFFFF,63,2,,,120,,,{ itemheal 0,rand(340,360); },{},{}
+1100005,Concentrated_G_P,Concentrated Gold Potion,0,10,,2,,,,,0xFFFFFFFF,63,2,,,180,,,{ itemheal rand(2730,2750),0; },{},{}

+ 10 - 0
db/re/item_flag.txt

@@ -1785,3 +1785,13 @@
 12622,32 //Boarding_Halter
 12622,32 //Boarding_Halter
 12887,32 //C_Wing_Of_Fly
 12887,32 //C_Wing_Of_Fly
 22508,32 //Para_Team_Mark_
 22508,32 //Para_Team_Mark_
+//100065,32 //WL_MB_SG
+//100066,32 //WL_MB_LOV
+//100067,32 //WL_MB_MS
+//100068,32 //WL_MB_DL
+//100069,32 //WL_MB_JF
+//100070,32 //WL_MB_ES
+//100071,32 //WL_MB_CR
+//100072,32 //WL_MB_CL
+//100073,32 //WL_MB_CM
+//100074,32 //WL_MB_TV

+ 23 - 23
db/re/mob_db.txt

@@ -2279,13 +2279,13 @@
 //3119,E_RUNAWAY5_,Runaway 5,Runaway 5,1,10,1,0,0,1,1,1,1,0,1,1,1,1,1,1,10,12,0,0,20,0x11F0000,170,1084,2304,576,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 //3119,E_RUNAWAY5_,Runaway 5,Runaway 5,1,10,1,0,0,1,1,1,1,0,1,1,1,1,1,1,10,12,0,0,20,0x11F0000,170,1084,2304,576,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 //3120,M_ISIS
 //3120,M_ISIS
 //3121,Q_BYORGUE
 //3121,Q_BYORGUE
-//3122,CHARLESTON1
-//3123,CHARLESTON2
-//3124,CHARLESTON3
-3125,STEP,Step,Step,130,55403,0,3088,2392,1,871,695,101,58,117,127,55,61,116,60,10,12,0,6,22,0x2000000,250,0,780,0,0,0,0,0,0,0,0,6751,1000,998,150,13213,400,0,0,0,0,0,0,0,0,0,0,0,0,4698,1
-//3126,ROCK_STEP
-//3127,KICK_STEP
-//3128,KICK_AND_KICK
+3122,CHARLESTON1,Charleston 1,Charleston 1,140,2614000,1,36804,21064,1,3210,695,123,68,189,78,81,51,108,56,10,12,2,6,22,0x3095,150,676,2400,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3123,CHARLESTON2,Charleston 3,Charleston 2,140,2614000,1,36804,21064,1,3210,695,123,68,189,78,81,51,108,56,10,12,2,6,22,0x3095,150,676,2400,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3124,CHARLESTON3,Charleston 3,Charleston 3,145,23671401,1,3132000,2473000,1,1500,1000,200,90,208,106,205,206,228,105,10,12,2,6,60,0x620B695,200,676,2016,672,0,0,0,0,0,0,0,16031,200,28101,200,16033,100,21011,200,22043,400,22044,400,6752,5000,0,0,0,0,0,0
+3125,STEP,Step,Step,130,55403,1,3088,2392,1,871,695,101,58,117,127,55,61,116,60,10,12,0,6,20,0x0000083,100,676,672,480,0,0,0,0,0,0,0,6751,1000,998,150,6213,400,6961,50,6962,50,0,0,0,0,0,0,0,0,4698,1
+3126,ROCK_STEP,Rock Step,Lockstep,131,71056,1,3609,2209,2,1100,325,85,59,99,95,70,124,155,80,10,12,1,6,40,0x0000085,150,676,1056,480,0,0,0,0,0,0,0,6750,500,999,350,7319,500,6961,50,6962,50,0,0,0,0,0,0,0,0,4699,1
+3127,KICK_STEP,Kick Step,Hallway 1 Security Devi,132,73644,1,3607,2205,7,1151,218,80,50,99,92,72,122,161,76,10,12,1,6,20,0x0000084,200,676,816,480,0,0,0,0,0,0,0,6750,400,999,250,7319,300,6961,50,6962,50,0,0,0,0,0,0,0,0,27012,1
+3128,KICK_AND_KICK,Kick And Kick,Security Robot,133,68018,1,3729,2032,1,1484,158,98,54,164,116,66,59,141,58,10,12,1,6,40,0x0000085,200,676,576,480,0,0,0,0,0,0,0,6751,500,998,100,6961,50,6962,50,0,0,0,0,0,0,0,0,0,0,27013,1
 //3129,ORC_ZOMBIE_ANNIV
 //3129,ORC_ZOMBIE_ANNIV
 //3130,ORC_ARCHER_ANNIV
 //3130,ORC_ARCHER_ANNIV
 //3131,ORC_BABY_ANNIV
 //3131,ORC_BABY_ANNIV
@@ -2310,13 +2310,13 @@
 //3150,MG_AMDARAIS_H
 //3150,MG_AMDARAIS_H
 //3151,MG_CORRUPTION_ROOT_H
 //3151,MG_CORRUPTION_ROOT_H
 //3152,G_MG_KHALITZBURG_H
 //3152,G_MG_KHALITZBURG_H
-3153,EXCAVATOR_ROBOT,Excavator Robot,Excavator Robot,163,166860,0,15026,16915,1,4785,192,138,53,102,104,72,57,98,57,10,12,1,0,60,0x0000085,250,1020,500,768,0,0,0,0,0,0,0,11597,251,984,101,6962,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-3154,RECON_ROBOT,Recon Robot,Recon Robot,165,256000,0,15796,17738,1,2989,280,128,60,112,60,72,57,120,77,10,12,2,0,80,0x0000085,170,1072,672,384,0,0,0,0,0,0,0,998,1001,756,1001,11597,151,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-3155,REPAIR_ROBOT,Repair Robot,Repair Robot,155,154760,0,11748,47654,1,2051,216,99,55,98,39,30,35,95,45,10,12,0,3,24,0x0000085,300,1500,500,660,0,0,0,0,0,0,0,998,5000,756,1501,999,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-3156,EXPLORATION_ROVER,Exploration Rover,Exploration Rover,168,293640,0,18172,126234,1,2513,802,105,41,100,63,35,99,106,61,10,12,2,7,80,0x0000085,165,1552,1152,336,0,0,0,0,0,0,0,998,5000,756,1,999,1,6961,1,0,0,0,0,0,0,0,0,0,0,0,0
-3157,RUIN_BELIEVER1,Ruin Grace Believer,Ruin Grace Believer,100,61350,0,4666,3874,1,993,250,91,50,88,61,51,62,136,60,10,12,1,7,40,0x0000085,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-3158,RUIN_BELIEVER2,Ruin Grace Believer,Ruin Grace Believer,100,61350,0,4666,139500,1,993,250,91,50,88,61,51,62,136,60,10,12,1,7,40,0x0000085,200,2125,2112,0,0,0,0,0,0,0,0,6753,10000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-3159,ILLEGAL_PROMOTION,Illegal Promotion,Illegal Promotion,100,10,0,0,0,1,1,1,1,50,1,1,1,1,1,1,10,12,0,0,40,0x0370020,200,0,0,768,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3153,EXCAVATOR_ROBOT,Excavator Robot,Excavator Robot,163,166860,1,15026,16915,1,4785,192,138,53,102,104,72,57,98,57,10,12,1,0,60,0x0000085,250,1020,500,768,0,0,0,0,0,0,0,11597,1,984,1,6962,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3154,RECON_ROBOT,Recon Robot,Recon Robot,165,256000,1,15796,17738,3,2989,280,127,60,112,60,72,57,120,77,10,12,2,0,80,0x0000085,170,1072,672,384,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3155,REPAIR_ROBOT,Repair Robot,Repair Robot,155,154760,1,11748,13237,1,2051,216,99,55,98,39,30,35,95,45,10,12,0,3,24,0x0000085,300,1500,500,660,0,0,0,0,0,0,0,998,5000,756,1501,999,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3156,EXPLORATION_ROVER,Exploration Rover,Exploration Rover,168,293640,1,18172,35065,3,2513,802,105,41,100,63,35,99,106,61,10,12,2,7,80,0x0000085,165,1552,1152,336,0,0,0,0,0,0,0,998,5000,756,1,999,1,6961,1,0,0,0,0,0,0,0,0,0,0,0,0
+3157,RUIN_BELIEVER1,Ruin Grace Believer,Ruin Grace Believer,100,61350,1,4666,3874,1,993,250,91,50,88,61,51,62,136,60,10,12,1,7,40,0x0000085,200,800,2112,768,0,0,0,0,0,0,0,6753,10000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3158,RUIN_BELIEVER2,Ruin Grace Believer,Ruin Grace Believer,100,61350,1,4666,3874,1,993,250,91,50,88,61,51,62,136,60,10,12,1,7,40,0x0000085,200,800,2112,768,0,0,0,0,0,0,0,6753,10000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3159,ILLEGAL_PROMOTION,Illegal Promotion,Illegal Promotion,100,10,1,0,0,1,1,1,1,50,1,1,1,1,1,1,10,12,0,0,40,0x0370020,200,800,2112,768,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 //3160,BOILED_RICE_DUANWU
 //3160,BOILED_RICE_DUANWU
 //3161,BOMB
 //3161,BOMB
 //3162,ELEPHANT
 //3162,ELEPHANT
@@ -2405,15 +2405,15 @@
 3245,V_B_ALPHOCCIO,Minstrel Alphoccio,Minstrel Alphoccio,186,10800000,1,3000000,3000000,1,8000,12000,240,200,240,300,140,400,300,180,10,12,1,7,84,0x6283695,100,76,864,288,0,0,0,0,0,0,0,23016,3000,20748,150,20748,500,22687,5000,6818,10000,6818,10000,6818,10000,0,0,0,0,4673,1
 3245,V_B_ALPHOCCIO,Minstrel Alphoccio,Minstrel Alphoccio,186,10800000,1,3000000,3000000,1,8000,12000,240,200,240,300,140,400,300,180,10,12,1,7,84,0x6283695,100,76,864,288,0,0,0,0,0,0,0,23016,3000,20748,150,20748,500,22687,5000,6818,10000,6818,10000,6818,10000,0,0,0,0,4673,1
 3246,V_B_TRENTINI,Wanderer Trentini,Wanderer Trentini,186,10800000,1,3000000,3000000,2,8000,12000,200,200,220,300,140,400,300,160,10,12,1,7,84,0x6283695,100,76,864,288,0,0,0,0,0,0,0,23016,3000,20748,150,20748,500,22687,5000,6818,10000,6818,10000,6818,10000,0,0,0,0,4683,1
 3246,V_B_TRENTINI,Wanderer Trentini,Wanderer Trentini,186,10800000,1,3000000,3000000,2,8000,12000,200,200,220,300,140,400,300,160,10,12,1,7,84,0x6283695,100,76,864,288,0,0,0,0,0,0,0,23016,3000,20748,150,20748,500,22687,5000,6818,10000,6818,10000,6818,10000,0,0,0,0,4683,1
 3247,CENERE_G,Cenere G,Green Cenere,150,140088,1,7635,7698,1,1897,110,91,81,70,48,40,37,100,45,10,12,0,0,24,0x0000085,300,1500,720,360,0,0,0,0,0,0,0,6561,5000,7322,500,7001,1500,7320,1000,12815,500,0,0,0,0,0,0,0,0,27014,1
 3247,CENERE_G,Cenere G,Green Cenere,150,140088,1,7635,7698,1,1897,110,91,81,70,48,40,37,100,45,10,12,0,0,24,0x0000085,300,1500,720,360,0,0,0,0,0,0,0,6561,5000,7322,500,7001,1500,7320,1000,12815,500,0,0,0,0,0,0,0,0,27014,1
-3248,REPAIR_ROBOT_T,Repair Robot T,Repair Robot Turbo,158,186320,1,13208,14489,1,2431,226,118,59,101,42,55,35,110,45,10,12,0,0,40,0x000008B,300,1500,500,660,0,0,0,0,0,0,0,7512,500,7507,250,998,2000,999,500,11597,1500,0,0,0,0,0,0,0,0,27015,1
-3249,EXPLORATION_ROVER_T,Exploration Rover T,Explorer Robot Turbo,171,318117,1,19826,41023,3,2945,841,121,67,118,80,45,121,138,65,10,12,2,0,80,0x0000085,165,1552,1152,336,0,0,0,0,0,0,0,7512,500,7507,250,998,2000,999,500,11597,1500,0,0,0,0,0,0,0,0,27016,1
-3250,SCR_MT_ROBOTS,Scr Mt Robots,Can Robot,155,30,1,61,58,1,95,2,100,99,35,42,20,12,68,3,10,12,0,0,20,0x0070085,300,2400,500,400,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,0,0,0,0,0,0,0,0,0,0,0,0,27017,1
-3251,GC109,Machine Component,Machine Component,149,217650,1,6598,5931,1,2678,1257,121,71,60,132,45,35,155,15,10,12,0,0,47,0x0000085,120,1000,500,600,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,0,0,0,0,0,0,0,0,0,0,0,0,27018,1
-3252,DR815,Machine Component,Machine Component,153,245670,1,7255,7011,1,3315,761,143,45,88,98,88,21,116,22,10,12,1,0,27,0x0000085,135,1500,600,500,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,0,0,0,0,0,0,0,0,0,0,0,0,27019,1
-3253,SYS_MSG,Sys Msg,System message,160,100,1,0,0,1,1,1,276,99,0,0,0,188,0,0,10,12,0,0,20,0xC170081,2000,3000,600,550,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-3254,T_W_O,T_W_O,T_W_O,165,48000000,1,0,0,1,3955,196,158,134,90,141,7,87,267,70,10,12,2,6,67,0x6280085,150,1250,500,350,0,6832,5000,617,5000,617,5000,22699,3000,1531,500,7319,2000,0,0,0,0,0,0,0,0,0,0,0,0,27020,1
-3255,GHOUL_H,Ghoul H,Smelly Ghoul,155,178652,1,10233,10598,1,2235,216,99,55,98,55,61,22,133,2,10,12,0,3,24,0x0000085,200,0,500,660,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-3256,ZOMBIE_H,Zombie H,Smelly Zombie,148,134615,1,6859,6903,1,1995,450,91,42,76,53,54,21,125,3,10,12,0,0,60,0x0000085,220,0,960,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3248,REPAIR_ROBOT_T,Repair Robot T,Repair Robot Turbo,158,186320,1,13208,14489,1,2431,226,118,59,101,42,55,35,110,45,10,12,0,0,40,0x000008B,300,1500,500,660,0,0,0,0,0,0,0,7512,500,7507,250,998,2000,999,500,11597,1500,6961,50,6962,50,0,0,0,0,27015,1
+3249,EXPLORATION_ROVER_T,Exploration Rover T,Explorer Robot Turbo,171,318117,1,19826,41023,3,2945,841,121,67,118,80,45,121,138,65,10,12,2,0,80,0x0000085,165,1552,1152,336,0,0,0,0,0,0,0,7512,500,7507,250,998,2000,999,500,11597,1500,6961,50,6962,50,0,0,0,0,27016,1
+3250,SCR_MT_ROBOTS,Scr Mt Robots,Can Robot,155,30,1,61,58,1,95,2,100,99,35,42,20,12,68,3,10,12,0,0,20,0x0070085,300,2400,500,400,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,6961,50,6962,50,0,0,0,0,0,0,0,0,27017,1
+3251,GC109,Machine Component,Machine Component,149,217650,1,6598,5931,1,2678,1257,121,71,60,132,45,35,155,15,10,12,0,0,47,0x0000085,120,1000,500,600,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,6961,50,6962,50,0,0,0,0,0,0,0,0,27018,1
+3252,DR815,Machine Component,Machine Component,153,245670,1,7255,7011,1,3315,761,143,45,88,98,88,21,116,22,10,12,1,0,27,0x0000085,135,1500,600,500,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,6961,50,6962,50,0,0,0,0,0,0,0,0,27019,1
+3253,SYS_MSG,Sys Msg,System message,160,100,1,0,0,12,1,1,276,99,0,0,0,188,0,0,10,12,2,6,27,0xC170081,2000,3000,600,550,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3254,T_W_O,T_W_O,T_W_O,165,48000000,1,0,0,3,3955,196,158,134,90,141,7,87,267,70,10,12,2,6,67,0x6280085,150,1250,500,350,0,6832,5000,617,5000,617,5000,22699,3000,1531,500,7319,2000,0,0,0,0,0,0,0,0,0,0,0,0,27020,1
+3255,GHOUL_H,Ghoul H,Smelly Ghoul,155,178652,1,10233,10598,1,2235,216,99,55,98,55,61,22,133,2,10,12,0,3,24,0x0000085,200,2050,500,660,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+3256,ZOMBIE_H,Zombie H,Smelly Zombie,148,134615,1,6859,6903,1,1995,450,91,42,76,53,54,21,125,3,10,12,0,0,60,0x0000085,220,2155,960,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 //3257,MALE_PORING
 //3257,MALE_PORING
 //3258,FEMALE_PORING
 //3258,FEMALE_PORING
 //3259,FANTASTIC_B_UNICORN
 //3259,FANTASTIC_B_UNICORN

+ 23 - 56
db/re/mob_skill_db.txt

@@ -11871,62 +11871,29 @@
 3246,V_B_TRENTINI@NPC_WIDESLEEP,attack,668,5,100,1000,20000,no,self,always,,,,,,,,
 3246,V_B_TRENTINI@NPC_WIDESLEEP,attack,668,5,100,1000,20000,no,self,always,,,,,,,,
 3246,V_B_TRENTINI@NPC_WIDECONFUSE,attack,667,5,100,1000,20000,no,target,always,,,,,,,,
 3246,V_B_TRENTINI@NPC_WIDECONFUSE,attack,667,5,100,1000,20000,no,target,always,,,,,,,,
 
 
-//=================================================================
-// Phantasmagorika 15.2 Mob Skills Placeholder (Gathered from jRO)
-//=================================================================
-
-3153,Excavator Robot@NPC_BLOODDRAIN,angry,199,1,1000,0,3000,no,target,always,0,,,,,,,
-3153,Excavator Robot@NPC_STONESKIN,attack,675,3,10000,0,30000,yes,self,always,0,,,,,,,
-3153,Excavator Robot@NPC_STUNATTACK,attack,179,5,800,1000,5000,no,target,always,0,,,,,,,
-3153,Excavator Robot@NPC_ARMORBRAKE,attack,344,10,500,0,5000,no,target,always,0,,,,,,,
-3153,Excavator Robot@NPC_STONESKIN,chase,675,3,10000,0,30000,yes,self,always,0,,,,,,,
-3153,Excavator Robot@NPC_BLOODDRAIN,attack,199,1,500,0,5000,no,target,always,0,,,,,,,
-3153,Excavator Robot@NPC_STONESKIN,idle,675,3,10000,0,30000,yes,self,always,0,,,,,,,
-3153,Excavator Robot@AL_TELEPORT,idle,26,1,10000,0,0,no,target,rudeattacked,0,,,,,,,
-
-3154,Recon Robot@NPC_GUIDEDATTACK,attack,172,5,500,0,20000,no,target,always,0,,,,,,,
-3154,Recon Robot@NPC_STUNATTACK,attack,179,5,800,1000,5000,no,target,always,0,,,,,,,
-
-3155,Repair Robot@NPC_STUNATTACK,any,179,5,500,1000,5000,no,target,always,0,,,,,,,
-3155,Repair Robot@NPC_GUIDEDATTACK,attack,172,5,1000,0,15000,no,target,always,0,,,,,,,
-
-3156,Exploration Rover@NPC_SUMMONSLAVE,idle,196,5,10000,700,10000,no,self,casttargeted,1,3157,3158,,,,,
-3156,Exploration Rover@NPC_GUIDEDATTACK,attack,172,5,1000,0,10000,no,target,always,0,,,,,,,
-3156,Exploration Rover@NPC_SUMMONSLAVE,attack,196,5,10000,700,10000,no,target,attackpcge,10,3157,3158,,,,,
-
-3247,Cenere G@NPC_PETRIFYATTACK,attack,180,3,500,500,5000,no,target,always,0,,,,,,,
-3247,Cenere G@MG_THUNDERSTORM,chase,21,10,3000,1000,10000,no,target,always,0,,,,,,,
-3247,Cenere G@NPC_POISONATTACK,any,188,1,5000,0,5000,no,target,always,0,,,,,,,
-3247,Cenere G@NPC_BLINDATTACK,attack,177,3,500,0,5000,yes,target,always,0,,,,,,,
-3247,Cenere G@MG_THUNDERSTORM,attack,21,10,3000,1000,10000,no,target,always,0,,,,,,,
-
-3248,Repair Robot T@AL_PNEUMA,attack,25,1,2000,0,5000,yes,self,longrangeattacked,0,,,,,,,
-3248,Repair Robot T@AL_TELEPORT,idle,26,1,10000,0,0,no,target,rudeattacked,0,,,,,,,
-3248,Repair Robot T@NPC_CRITICALSLASH,attack,170,1,2000,0,2000,no,target,always,0,,,,,,,
-3248,Repair Robot T@NPC_GUIDEDATTACK,attack,172,5,1000,0,5000,no,target,always,0,,,,,,,
-3248,Repair Robot T@KN_TWOHANDQUICKEN,attack,60,30,10000,0,120000,yes,target,myhpltmaxrate,40,,,,,,,
-3248,Repair Robot T@NPC_STUNATTACK,attack,179,5,500,1000,5000,no,target,always,0,,,,,,,
-3248,Repair Robot T@AL_PNEUMA,chase,25,1,2000,0,5000,no,self,longrangeattacked,0,,,,,,,
-
-3249,Exploration Rover T@KN_TWOHANDQUICKEN,attack,60,30,10000,0,120000,yes,self,myhpltmaxrate,40,,,,,,,
-3249,Exploration Rover T@AL_PNEUMA,chase,25,1,2000,0,5000,no,self,longrangeattacked,0,,,,,,,
-3249,Exploration Rover T@AL_TELEPORT,walk,26,1,10000,0,0,no,target,rudeattacked,0,,,,,,,
-3249,Exploration Rover T@NPC_CRITICALWOUND,attack,673,2,1000,0,5000,no,target,always,0,,,,,,,
-3249,Exploration Rover T@NPC_GUIDEDATTACK,attack,172,5,1000,0,5000,no,target,always,0,,,,,,,
-3249,Exploration Rover T@AL_PNEUMA,attack,25,1,2000,0,5000,no,self,longrangeattacked,0,,,,,,,
-
-3253,SYS_MSG@AL_HEAL,attack,28,10,500,500,5000,yes,friend,friendhpltmaxrate,50,,,,,,,
-3253,SYS_MSG@AL_HEAL,chase,28,10,500,500,5000,yes,friend,friendhpltmaxrate,50,,,,,,,
-3253,SYS_MSG@AL_HEAL,idle,28,10,500,500,5000,yes,friend,friendhpltmaxrate,50,,,,,,,
-
-3254,T_W_O@NPC_PIERCINGATT,attack,158,10,300,0,30000,no,target,always,0,,,,,,,
-3254,T_W_O@NPC_PIERCINGATT,chase,158,10,500,0,5000,no,target,always,0,,,,,,,
-3254,T_W_O@NPC_SILENCEATTACK,attack,178,5,750,250,10000,no,target,casttargeted,0,,,,,,6,
-3254,T_W_O@NPC_SILENCEATTACK,chase,178,5,750,250,3000,no,target,casttargeted,0,,,,,,6,
-3254,T_W_O@NPC_WIDESLEEP,attack,668,5,400,0,15000,no,self,always,0,,,,,,,
-3254,T_W_O@NPC_WIDESTONE,attack,666,5,600,0,30000,no,self,always,0,,,,,,,
-3254,T_W_O@NPC_WIDESOULDRAIN,attack,680,10,1000,0,60000,no,self,always,0,,,,,,,
-3254,T_W_O@NPC_CRITICALWOUND,attack,673,5,150,500,45000,no,target,always,,,,,,,,
+// Phantasmagorika 15.2
+3124,CHARLESTON3@NPC_AGIUP,idle,350,1,2000,0,10000,yes,self,always,0,,,,,,,
+3124,CHARLESTON3@AL_HEAL,idle,28,11,10000,0,3000,yes,self,always,0,,,,,,,
+3124,CHARLESTON3@HW_NAPALMVULCAN,chase,400,5,3000,500,10000,no,target,always,0,,,,,,,
+3124,CHARLESTON3@WZ_VERMILION,chase,85,5,2000,1000,15000,no,target,always,0,,,,,,,
+3124,CHARLESTON3@HW_NAPALMVULCAN,attack,400,5,3000,500,10000,no,target,always,0,,,,,,,
+3124,CHARLESTON3@WZ_VERMILION,attack,85,21,1500,4000,20000,no,target,always,0,,,,,,,
+3124,CHARLESTON3@WZ_METEOR,attack,83,11,1500,4000,20000,no,target,always,0,,,,,,,
+3125,STEP@SM_BASH,attack,5,5,1000,0,5000,yes,target,always,0,,,,,,,
+3126,ROCK_STEP@BS_HAMMERFALL,attack,110,5,1000,1000,5000,no,target,always,0,,,,,,,
+3127,KICK_STEP@ASC_BREAKER,attack,379,5,1000,0,5000,yes,target,always,0,,,,,,,
+3128,KICK_AND_KICK@NPC_STUNATTACK,attack,179,3,500,1000,5000,no,target,always,0,,,,,,,
+3253,SYS_MSG@AL_HEAL,attack,28,11,5000,500,5000,yes,friend,friendhpltmaxrate,50,,,,,,,
+3253,SYS_MSG@AL_HEAL,chase,28,11,5000,500,5000,yes,friend,friendhpltmaxrate,50,,,,,,,
+3253,SYS_MSG@AL_HEAL,idle,28,11,5000,500,5000,yes,friend,friendhpltmaxrate,50,,,,,,,
+3254,T_W_O@NPC_PIERCINGATT,attack,158,10,3000,0,30000,no,target,always,0,,,,,,,
+3254,T_W_O@NPC_PIERCINGATT,chase,158,10,5000,0,5000,no,target,always,0,,,,,,,
+3254,T_W_O@NPC_SILENCEATTACK,attack,178,5,7500,250,10000,no,target,casttargeted,0,,,,,,6,
+3254,T_W_O@NPC_SILENCEATTACK,chase,178,5,7500,250,3000,no,target,casttargeted,0,,,,,,6,
+3254,T_W_O@NPC_WIDESLEEP,attack,668,5,4000,0,15000,no,self,always,0,,,,,,,
+3254,T_W_O@NPC_WIDESTONE,attack,666,5,6000,0,30000,no,self,always,0,,,,,,,
+3254,T_W_O@NPC_WIDESOULDRAIN,attack,680,10,10000,0,60000,no,self,always,0,,,,,,,
+3254,T_W_O@NPC_CRITICALWOUND,attack,673,5,1500,500,45000,no,target,always,,,,,,,,
 
 
 3505,DR_BIG_EGGRING@NPC_SUMMONSLAVE,attack,196,4,10000,2000,10000,no,self,slavele,3,3508,,,,,,
 3505,DR_BIG_EGGRING@NPC_SUMMONSLAVE,attack,196,4,10000,2000,10000,no,self,slavele,3,3508,,,,,,
 3505,DR_BIG_EGGRING@NPC_SUMMONSLAVE,idle,196,4,10000,2000,10000,no,self,slavele,3,3508,,,,,,
 3505,DR_BIG_EGGRING@NPC_SUMMONSLAVE,idle,196,4,10000,2000,10000,no,self,slavele,3,3508,,,,,,

+ 6 - 6
db/re/produce_db.txt

@@ -656,17 +656,17 @@
 //-- Cure Free <-- GN_S_PHARMACY Lv1, Quality Potion Book, 20 Green Herb, 1 Fruit Of Mastela, 5 Panacea, 1 Leaf Of Yggdrasil, 10 Empty Cylinder
 //-- Cure Free <-- GN_S_PHARMACY Lv1, Quality Potion Book, 20 Green Herb, 1 Fruit Of Mastela, 5 Panacea, 1 Leaf Of Yggdrasil, 10 Empty Cylinder
 263,12475,29,2497,1,6285,0,511,20,522,1,525,5,610,1,1092,10
 263,12475,29,2497,1,6285,0,511,20,522,1,525,5,610,1,1092,10
 //-- Golden X <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 10 Yggdrasilberry, 5 Gold
 //-- Golden X <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 10 Yggdrasilberry, 5 Gold
-//264,100231,29,2497,1,1092,10,607,10,969,5
+264,100231,29,2497,1,1092,10,607,10,969,5
 //-- Red Herb Activator <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 45 Red Herb, 5 Yggdrasil Seed
 //-- Red Herb Activator <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 45 Red Herb, 5 Yggdrasil Seed
-//265,100232,29,2497,1,1092,10,507,45,608,5
+265,100232,29,2497,1,1092,10,507,45,608,5
 //-- Blue Herb Activator <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 15 Blue Herb, 5 Yggdrasil Seed
 //-- Blue Herb Activator <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 15 Blue Herb, 5 Yggdrasil Seed
-//266,100233,29,2497,1,1092,10,510,15,608,5
+266,100233,29,2497,1,1092,10,510,15,608,5
 //-- Concentrated Red Syrup Potion <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 10 Empty Potion Bottle, 15 Red Syrup
 //-- Concentrated Red Syrup Potion <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 10 Empty Potion Bottle, 15 Red Syrup
-//267,1100003,29,2497,1,1092,10,1093,10,11621,15
+267,1100003,29,2497,1,1092,10,1093,10,11621,15
 //-- Concentrated Blue Syrup Potion <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 10 Empty Potion Bottle, 15 Blue Syrup
 //-- Concentrated Blue Syrup Potion <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 10 Empty Potion Bottle, 15 Blue Syrup
-//268,1100004,29,2497,1,1092,10,1093,10,11624,15
+268,1100004,29,2497,1,1092,10,1093,10,11624,15
 //-- Concentrated Golden Syrup Potion <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 10 Empty Potion Bottle, 15 White Syrup, 10 Yellow Syrup
 //-- Concentrated Golden Syrup Potion <-- GN_S_PHARMACY Lvl, 10 Empty Testtube, 10 Empty Potion Bottle, 15 White Syrup, 10 Yellow Syrup
-//269,1100005,29,2497,1,1092,10,1093,10,11623,15,11622,10
+269,1100005,29,2497,1,1092,10,1093,10,11623,15,11622,10
 //===============================================
 //===============================================
 
 
 //--------------------LEVEL 30-----------
 //--------------------LEVEL 30-----------

+ 4 - 3
db/re/quest_db.yml

@@ -4086,13 +4086,13 @@ Body:
     Title: Core Collection
     Title: Core Collection
     Drops:
     Drops:
       - Mob: RECON_ROBOT
       - Mob: RECON_ROBOT
-        Item: Operation_Control_Device
+        Item: Power_Control_Device
         Rate: 5000
         Rate: 5000
       - Mob: REPAIR_ROBOT
       - Mob: REPAIR_ROBOT
-        Item: Operation_Control_Device
+        Item: Power_Control_Device
         Rate: 5000
         Rate: 5000
       - Mob: EXPLORATION_ROVER
       - Mob: EXPLORATION_ROVER
-        Item: Operation_Control_Device
+        Item: Power_Control_Device
         Rate: 5000
         Rate: 5000
   - Id: 7616
   - Id: 7616
     Title: Core Collection - Down
     Title: Core Collection - Down
@@ -6207,6 +6207,7 @@ Body:
     Title: Let the Specialists Handle It
     Title: Let the Specialists Handle It
   - Id: 11377
   - Id: 11377
     Title: Act of Kindness
     Title: Act of Kindness
+    TimeLimit: +1d
   - Id: 11378
   - Id: 11378
     Title: "Trick or treat "
     Title: "Trick or treat "
   - Id: 11379
   - Id: 11379

+ 123 - 121
db/re/skill_db.yml

@@ -2111,7 +2111,7 @@ Body:
     HitCount: -3
     HitCount: -3
     Element: Weapon
     Element: Weapon
     SplashArea: 2
     SplashArea: 2
-    ActiveInstance: 3
+    ActiveInstance: 5
     Knockback: 2
     Knockback: 2
     CastTime: 500
     CastTime: 500
     Duration1: 1000
     Duration1: 1000
@@ -9959,25 +9959,25 @@ Body:
     Requires:
     Requires:
       SpCost:
       SpCost:
         - Level: 1
         - Level: 1
-          Amount: 14
+          Amount: 35
         - Level: 2
         - Level: 2
-          Amount: 18
+          Amount: 40
         - Level: 3
         - Level: 3
-          Amount: 22
+          Amount: 45
         - Level: 4
         - Level: 4
-          Amount: 26
+          Amount: 50
         - Level: 5
         - Level: 5
-          Amount: 30
+          Amount: 55
         - Level: 6
         - Level: 6
-          Amount: 34
+          Amount: 60
         - Level: 7
         - Level: 7
-          Amount: 38
+          Amount: 65
         - Level: 8
         - Level: 8
-          Amount: 42
+          Amount: 70
         - Level: 9
         - Level: 9
-          Amount: 46
+          Amount: 75
         - Level: 10
         - Level: 10
-          Amount: 50
+          Amount: 80
   - Id: 367
   - Id: 367
     Name: PA_PRESSURE
     Name: PA_PRESSURE
     Description: Gloria Domini
     Description: Gloria Domini
@@ -15705,10 +15705,12 @@ Body:
     DamageFlags:
     DamageFlags:
       Splash: true
       Splash: true
       SplashSplit: true
       SplashSplit: true
+      IgnoreDefense: true
     Flags:
     Flags:
       IsNpc: true
       IsNpc: true
       TargetTrap: true
       TargetTrap: true
       ShowScale: true
       ShowScale: true
+      IgnoreLandProtector: true
     Hit: Multi_Hit
     Hit: Multi_Hit
     HitCount: 1
     HitCount: 1
     SplashArea:
     SplashArea:
@@ -15732,6 +15734,35 @@ Body:
         Area: 11
         Area: 11
       - Level: 10
       - Level: 10
         Area: 13
         Area: 13
+    Duration1: 910
+    FixedCastTime: -1
+    Unit:
+      Id: Earthquake
+      Range:
+        - Level: 1
+          Size: 5
+        - Level: 2
+          Size: 7
+        - Level: 3
+          Size: 9
+        - Level: 4
+          Size: 11
+        - Level: 5
+          Size: 13
+        - Level: 6
+          Size: 5
+        - Level: 7
+          Size: 7
+        - Level: 8
+          Size: 9
+        - Level: 9
+          Size: 11
+        - Level: 10
+          Size: 13
+      Interval: 300
+      Target: Enemy
+      Flag:
+        PathCheck: true
   - Id: 654
   - Id: 654
     Name: NPC_FIREBREATH
     Name: NPC_FIREBREATH
     Description: Fire Breath
     Description: Fire Breath
@@ -18058,25 +18089,36 @@ Body:
     Description: Frosty Misty
     Description: Frosty Misty
     MaxLevel: 5
     MaxLevel: 5
     Type: Magic
     Type: Magic
-    TargetType: Self
+    TargetType: Ground
     DamageFlags:
     DamageFlags:
       Splash: true
       Splash: true
     Flags:
     Flags:
       AlterRangeRadius: true
       AlterRangeRadius: true
+    Range: 11
     Hit: Multi_Hit
     Hit: Multi_Hit
     HitCount:
     HitCount:
       - Level: 1
       - Level: 1
-        Count: -3
+        Count: 1
       - Level: 2
       - Level: 2
-        Count: -4
+        Count: 2
       - Level: 3
       - Level: 3
-        Count: -5
+        Count: 3
       - Level: 4
       - Level: 4
-        Count: -6
+        Count: 4
       - Level: 5
       - Level: 5
-        Count: -7
+        Count: 5
     Element: Water
     Element: Water
-    SplashArea: 9
+    SplashArea:
+      - Level: 1
+        Area: 3
+      - Level: 2
+        Area: 3
+      - Level: 3
+        Area: 4
+      - Level: 4
+        Area: 4
+      - Level: 5
+        Area: 5
     CopyFlags:
     CopyFlags:
       Skill:
       Skill:
         Reproduce: true
         Reproduce: true
@@ -18094,6 +18136,7 @@ Body:
         Time: 4000
         Time: 4000
     AfterCastActDelay: 1000
     AfterCastActDelay: 1000
     Duration1: 40000
     Duration1: 40000
+    Duration2: 10000
     Cooldown: 4000
     Cooldown: 4000
     FixedCastTime: 500
     FixedCastTime: 500
     Requires:
     Requires:
@@ -18113,23 +18156,24 @@ Body:
     Description: Jack Frost
     Description: Jack Frost
     MaxLevel: 5
     MaxLevel: 5
     Type: Magic
     Type: Magic
-    TargetType: Self
+    TargetType: Attack
     DamageFlags:
     DamageFlags:
       Splash: true
       Splash: true
+    Range: 11
     Hit: Multi_Hit
     Hit: Multi_Hit
     HitCount: -5
     HitCount: -5
     Element: Water
     Element: Water
     SplashArea:
     SplashArea:
       - Level: 1
       - Level: 1
-        Area: 5
+        Area: 3
       - Level: 2
       - Level: 2
-        Area: 6
+        Area: 3
       - Level: 3
       - Level: 3
-        Area: 7
+        Area: 4
       - Level: 4
       - Level: 4
-        Area: 8
+        Area: 4
       - Level: 5
       - Level: 5
-        Area: 9
+        Area: 5
     CopyFlags:
     CopyFlags:
       Skill:
       Skill:
         Reproduce: true
         Reproduce: true
@@ -18157,6 +18201,7 @@ Body:
         Time: 27500
         Time: 27500
       - Level: 5
       - Level: 5
         Time: 32500
         Time: 32500
+    Cooldown: 4000
     FixedCastTime: 1000
     FixedCastTime: 1000
     Requires:
     Requires:
       SpCost:
       SpCost:
@@ -18419,7 +18464,7 @@ Body:
         Reproduce: true
         Reproduce: true
     CastCancel: true
     CastCancel: true
     CastTime: 5000
     CastTime: 5000
-    AfterCastActDelay: 2000
+    AfterCastActDelay: 500
     Duration1: 5000
     Duration1: 5000
     Cooldown: 5000
     Cooldown: 5000
     FixedCastTime: 1000
     FixedCastTime: 1000
@@ -18441,32 +18486,46 @@ Body:
     MaxLevel: 5
     MaxLevel: 5
     Type: Magic
     Type: Magic
     TargetType: Attack
     TargetType: Attack
+    DamageFlags:
+      Splash: true
     Flags:
     Flags:
       AlterRangeRadius: true
       AlterRangeRadius: true
     Range: 11
     Range: 11
     Hit: Single
     Hit: Single
     HitCount: 1
     HitCount: 1
     Element: Fire
     Element: Fire
+    SplashArea:
+      - Level: 1
+        Area: 1
+      - Level: 2
+        Area: 1
+      - Level: 3
+        Area: 1
+      - Level: 4
+        Area: 2
+      - Level: 5
+        Area: 2
     CopyFlags:
     CopyFlags:
       Skill:
       Skill:
         Reproduce: true
         Reproduce: true
     CastCancel: true
     CastCancel: true
     CastTime: 3000
     CastTime: 3000
-    AfterCastActDelay: 1000
+    AfterCastActDelay: 500
     Duration1: 15000
     Duration1: 15000
+    Cooldown: 3000
     FixedCastTime: 1000
     FixedCastTime: 1000
     Requires:
     Requires:
       SpCost:
       SpCost:
         - Level: 1
         - Level: 1
-          Amount: 35
+          Amount: 64
         - Level: 2
         - Level: 2
-          Amount: 40
+          Amount: 70
         - Level: 3
         - Level: 3
-          Amount: 45
+          Amount: 76
         - Level: 4
         - Level: 4
-          Amount: 50
+          Amount: 82
         - Level: 5
         - Level: 5
-          Amount: 55
+          Amount: 88
   - Id: 2213
   - Id: 2213
     Name: WL_COMET
     Name: WL_COMET
     Description: Comet
     Description: Comet
@@ -18479,8 +18538,8 @@ Body:
       AlterRangeRadius: true
       AlterRangeRadius: true
     Range: 11
     Range: 11
     Hit: Multi_Hit
     Hit: Multi_Hit
-    HitCount: -20
-    SplashArea: 9
+    HitCount: -10
+    SplashArea: 6
     Knockback: 2
     Knockback: 2
     CopyFlags:
     CopyFlags:
       Skill:
       Skill:
@@ -18488,45 +18547,32 @@ Body:
     CastCancel: true
     CastCancel: true
     CastTime:
     CastTime:
       - Level: 1
       - Level: 1
-        Time: 10000
+        Time: 6000
       - Level: 2
       - Level: 2
-        Time: 11000
+        Time: 7000
       - Level: 3
       - Level: 3
-        Time: 12000
+        Time: 8000
       - Level: 4
       - Level: 4
-        Time: 13000
+        Time: 9000
       - Level: 5
       - Level: 5
-        Time: 14000
-    AfterCastActDelay: 2000
+        Time: 10000
+    AfterCastActDelay: 1500
     Duration1: 100
     Duration1: 100
     Duration2: 42000
     Duration2: 42000
-    Cooldown: 60000
-    FixedCastTime:
-      - Level: 1
-        Time: 1000
-      - Level: 2
-        Time: 1500
-      - Level: 3
-        Time: 2000
-      - Level: 4
-        Time: 2500
-      - Level: 5
-        Time: 3000
+    Cooldown: 20000
+    FixedCastTime: 2000
     Requires:
     Requires:
       SpCost:
       SpCost:
         - Level: 1
         - Level: 1
-          Amount: 480
+          Amount: 70
         - Level: 2
         - Level: 2
-          Amount: 560
+          Amount: 90
         - Level: 3
         - Level: 3
-          Amount: 640
+          Amount: 110
         - Level: 4
         - Level: 4
-          Amount: 720
+          Amount: 130
         - Level: 5
         - Level: 5
-          Amount: 800
-      ItemCost:
-        - Item: Red_Gemstone
-          Amount: 2
+          Amount: 150
     Unit:
     Unit:
       Id: Dummyskill
       Id: Dummyskill
       Range: 9
       Range: 9
@@ -18630,7 +18676,7 @@ Body:
         Time: 5000
         Time: 5000
       - Level: 5
       - Level: 5
         Time: 6000
         Time: 6000
-    AfterCastActDelay: 1000
+    AfterCastActDelay: 500
     Duration1: 100
     Duration1: 100
     Duration2:
     Duration2:
       - Level: 1
       - Level: 1
@@ -18643,7 +18689,7 @@ Body:
         Time: 120000
         Time: 120000
       - Level: 5
       - Level: 5
         Time: 135000
         Time: 135000
-    Cooldown: 10000
+    Cooldown: 7000
     FixedCastTime: 2000
     FixedCastTime: 2000
     Requires:
     Requires:
       SpCost:
       SpCost:
@@ -18811,7 +18857,7 @@ Body:
   - Id: 2222
   - Id: 2222
     Name: WL_SUMMONFB
     Name: WL_SUMMONFB
     Description: Summon Fire Ball
     Description: Summon Fire Ball
-    MaxLevel: 5
+    MaxLevel: 2
     Type: Magic
     Type: Magic
     TargetType: Self
     TargetType: Self
     DamageFlags:
     DamageFlags:
@@ -18824,17 +18870,7 @@ Body:
         Reproduce: true
         Reproduce: true
     CastCancel: true
     CastCancel: true
     CastTime: 2000
     CastTime: 2000
-    Duration1:
-      - Level: 1
-        Time: 120000
-      - Level: 2
-        Time: 160000
-      - Level: 3
-        Time: 200000
-      - Level: 4
-        Time: 240000
-      - Level: 5
-        Time: 280000
+    Duration1: 280000
     FixedCastTime: -1
     FixedCastTime: -1
     Requires:
     Requires:
       SpCost:
       SpCost:
@@ -18851,7 +18887,7 @@ Body:
   - Id: 2223
   - Id: 2223
     Name: WL_SUMMONBL
     Name: WL_SUMMONBL
     Description: Summon Lightning Ball
     Description: Summon Lightning Ball
-    MaxLevel: 5
+    MaxLevel: 2
     Type: Magic
     Type: Magic
     TargetType: Self
     TargetType: Self
     DamageFlags:
     DamageFlags:
@@ -18864,17 +18900,7 @@ Body:
         Reproduce: true
         Reproduce: true
     CastCancel: true
     CastCancel: true
     CastTime: 2000
     CastTime: 2000
-    Duration1:
-      - Level: 1
-        Time: 120000
-      - Level: 2
-        Time: 160000
-      - Level: 3
-        Time: 200000
-      - Level: 4
-        Time: 240000
-      - Level: 5
-        Time: 280000
+    Duration1: 280000
     FixedCastTime: -1
     FixedCastTime: -1
     Requires:
     Requires:
       SpCost:
       SpCost:
@@ -18891,7 +18917,7 @@ Body:
   - Id: 2224
   - Id: 2224
     Name: WL_SUMMONWB
     Name: WL_SUMMONWB
     Description: Summon Water Ball
     Description: Summon Water Ball
-    MaxLevel: 5
+    MaxLevel: 2
     Type: Magic
     Type: Magic
     TargetType: Self
     TargetType: Self
     DamageFlags:
     DamageFlags:
@@ -18904,17 +18930,7 @@ Body:
         Reproduce: true
         Reproduce: true
     CastCancel: true
     CastCancel: true
     CastTime: 2000
     CastTime: 2000
-    Duration1:
-      - Level: 1
-        Time: 120000
-      - Level: 2
-        Time: 160000
-      - Level: 3
-        Time: 200000
-      - Level: 4
-        Time: 240000
-      - Level: 5
-        Time: 280000
+    Duration1: 280000
     FixedCastTime: -1
     FixedCastTime: -1
     Requires:
     Requires:
       SpCost:
       SpCost:
@@ -18995,7 +19011,7 @@ Body:
   - Id: 2229
   - Id: 2229
     Name: WL_SUMMONSTONE
     Name: WL_SUMMONSTONE
     Description: Summon Stone
     Description: Summon Stone
-    MaxLevel: 5
+    MaxLevel: 2
     Type: Magic
     Type: Magic
     TargetType: Self
     TargetType: Self
     DamageFlags:
     DamageFlags:
@@ -19008,17 +19024,7 @@ Body:
         Reproduce: true
         Reproduce: true
     CastCancel: true
     CastCancel: true
     CastTime: 2000
     CastTime: 2000
-    Duration1:
-      - Level: 1
-        Time: 120000
-      - Level: 2
-        Time: 160000
-      - Level: 3
-        Time: 200000
-      - Level: 4
-        Time: 240000
-      - Level: 5
-        Time: 280000
+    Duration1: 280000
     FixedCastTime: -1
     FixedCastTime: -1
     Requires:
     Requires:
       SpCost:
       SpCost:
@@ -19054,19 +19060,7 @@ Body:
     Name: WL_READING_SB
     Name: WL_READING_SB
     Description: Reading Spellbook
     Description: Reading Spellbook
     MaxLevel: 1
     MaxLevel: 1
-    Type: Magic
-    TargetType: Self
-    DamageFlags:
-      NoDamage: true
-    Hit: Single
-    HitCount: 1
-    CastCancel: true
-    CastTime: 5000
-    AfterCastActDelay: 500
     Duration1: 30000
     Duration1: 30000
-    FixedCastTime: 1000
-    Requires:
-      SpCost: 40
   - Id: 2232
   - Id: 2232
     Name: WL_FREEZE_SP
     Name: WL_FREEZE_SP
     Description: Freeze Spell
     Description: Freeze Spell
@@ -33480,6 +33474,14 @@ Body:
     Name: NV_TRANSCENDENCE
     Name: NV_TRANSCENDENCE
     Description: Transcendence
     Description: Transcendence
     MaxLevel: 5
     MaxLevel: 5
+  - Id: 5078
+    Name: WL_READING_SB_READING
+    Description: Reading Spellbook
+    MaxLevel: 10
+    TargetType: Self
+    CastTime: 5000
+    AfterCastActDelay: 500
+    FixedCastTime: 1000
   - Id: 8001
   - Id: 8001
     Name: HLIF_HEAL
     Name: HLIF_HEAL
     Description: Healing Touch
     Description: Healing Touch

+ 12 - 12
db/re/skill_tree.txt

@@ -2492,10 +2492,10 @@
 4055,2214,5,2223,1,0,0,0,0,0,0,0,0 //WL_CHAINLIGHTNING#Chain Lightning#
 4055,2214,5,2223,1,0,0,0,0,0,0,0,0 //WL_CHAINLIGHTNING#Chain Lightning#
 4055,2216,5,2207,2,0,0,0,0,0,0,0,0 //WL_EARTHSTRAIN#Earth Strain#
 4055,2216,5,2207,2,0,0,0,0,0,0,0,0 //WL_EARTHSTRAIN#Earth Strain#
 4055,2217,10,2204,5,2212,5,2214,5,2216,5,0,0 //WL_TETRAVORTEX#Tetra Vortex#
 4055,2217,10,2204,5,2212,5,2214,5,2216,5,0,0 //WL_TETRAVORTEX#Tetra Vortex#
-4055,2222,5,83,1,0,0,0,0,0,0,0,0 //WL_SUMMONFB#Summon Fire Ball#
-4055,2223,5,85,1,0,0,0,0,0,0,0,0 //WL_SUMMONBL#Summon Lightning Ball#
-4055,2224,5,89,1,0,0,0,0,0,0,0,0 //WL_SUMMONWB#Summon Water Ball#
-4055,2229,5,91,1,0,0,0,0,0,0,0,0 //WL_SUMMONSTONE#Summon Stone#
+4055,2222,2,83,1,0,0,0,0,0,0,0,0 //WL_SUMMONFB#Summon Fire Ball#
+4055,2223,2,85,1,0,0,0,0,0,0,0,0 //WL_SUMMONBL#Summon Lightning Ball#
+4055,2224,2,89,1,0,0,0,0,0,0,0,0 //WL_SUMMONWB#Summon Water Ball#
+4055,2229,2,91,1,0,0,0,0,0,0,0,0 //WL_SUMMONSTONE#Summon Stone#
 4055,2230,2,0,0,0,0,0,0,0,0,0,0 //WL_RELEASE#Release#
 4055,2230,2,0,0,0,0,0,0,0,0,0,0 //WL_RELEASE#Release#
 4055,2231,1,0,0,0,0,0,0,0,0,0,0 //WL_READING_SB#Reading Spellbook#
 4055,2231,1,0,0,0,0,0,0,0,0,0,0 //WL_READING_SB#Reading Spellbook#
 4055,2232,10,0,0,0,0,0,0,0,0,0,0 //WL_FREEZE_SP#Freeze Spell#
 4055,2232,10,0,0,0,0,0,0,0,0,0,0 //WL_FREEZE_SP#Freeze Spell#
@@ -2833,10 +2833,10 @@
 4061,2214,5,2223,1,0,0,0,0,0,0,0,0 //WL_CHAINLIGHTNING#Chain Lightning#
 4061,2214,5,2223,1,0,0,0,0,0,0,0,0 //WL_CHAINLIGHTNING#Chain Lightning#
 4061,2216,5,2207,2,0,0,0,0,0,0,0,0 //WL_EARTHSTRAIN#Earth Strain#
 4061,2216,5,2207,2,0,0,0,0,0,0,0,0 //WL_EARTHSTRAIN#Earth Strain#
 4061,2217,10,2204,5,2212,5,2214,5,2216,5,0,0 //WL_TETRAVORTEX#Tetra Vortex#
 4061,2217,10,2204,5,2212,5,2214,5,2216,5,0,0 //WL_TETRAVORTEX#Tetra Vortex#
-4061,2222,5,83,1,0,0,0,0,0,0,0,0 //WL_SUMMONFB#Summon Fire Ball#
-4061,2223,5,85,1,0,0,0,0,0,0,0,0 //WL_SUMMONBL#Summon Lightning Ball#
-4061,2224,5,89,1,0,0,0,0,0,0,0,0 //WL_SUMMONWB#Summon Water Ball#
-4061,2229,5,91,1,0,0,0,0,0,0,0,0 //WL_SUMMONSTONE#Summon Stone#
+4061,2222,2,83,1,0,0,0,0,0,0,0,0 //WL_SUMMONFB#Summon Fire Ball#
+4061,2223,2,85,1,0,0,0,0,0,0,0,0 //WL_SUMMONBL#Summon Lightning Ball#
+4061,2224,2,89,1,0,0,0,0,0,0,0,0 //WL_SUMMONWB#Summon Water Ball#
+4061,2229,2,91,1,0,0,0,0,0,0,0,0 //WL_SUMMONSTONE#Summon Stone#
 4061,2230,2,0,0,0,0,0,0,0,0,0,0 //WL_RELEASE#Release#
 4061,2230,2,0,0,0,0,0,0,0,0,0,0 //WL_RELEASE#Release#
 4061,2231,1,0,0,0,0,0,0,0,0,0,0 //WL_READING_SB#Reading Spellbook#
 4061,2231,1,0,0,0,0,0,0,0,0,0,0 //WL_READING_SB#Reading Spellbook#
 4061,2232,10,0,0,0,0,0,0,0,0,0,0 //WL_FREEZE_SP#Freeze Spell#
 4061,2232,10,0,0,0,0,0,0,0,0,0,0 //WL_FREEZE_SP#Freeze Spell#
@@ -4500,10 +4500,10 @@
 4097,2214,5,2223,1,0,0,0,0,0,0,0,0 //WL_CHAINLIGHTNING#Chain Lightning#
 4097,2214,5,2223,1,0,0,0,0,0,0,0,0 //WL_CHAINLIGHTNING#Chain Lightning#
 4097,2216,5,2207,2,0,0,0,0,0,0,0,0 //WL_EARTHSTRAIN#Earth Strain#
 4097,2216,5,2207,2,0,0,0,0,0,0,0,0 //WL_EARTHSTRAIN#Earth Strain#
 4097,2217,10,2204,5,2212,5,2214,5,2216,5,0,0 //WL_TETRAVORTEX#Tetra Vortex#
 4097,2217,10,2204,5,2212,5,2214,5,2216,5,0,0 //WL_TETRAVORTEX#Tetra Vortex#
-4097,2222,5,83,1,0,0,0,0,0,0,0,0 //WL_SUMMONFB#Summon Fire Ball#
-4097,2223,5,85,1,0,0,0,0,0,0,0,0 //WL_SUMMONBL#Summon Lightning Ball#
-4097,2224,5,89,1,0,0,0,0,0,0,0,0 //WL_SUMMONWB#Summon Water Ball#
-4097,2229,5,91,1,0,0,0,0,0,0,0,0 //WL_SUMMONSTONE#Summon Stone#
+4097,2222,2,83,1,0,0,0,0,0,0,0,0 //WL_SUMMONFB#Summon Fire Ball#
+4097,2223,2,85,1,0,0,0,0,0,0,0,0 //WL_SUMMONBL#Summon Lightning Ball#
+4097,2224,2,89,1,0,0,0,0,0,0,0,0 //WL_SUMMONWB#Summon Water Ball#
+4097,2229,2,91,1,0,0,0,0,0,0,0,0 //WL_SUMMONSTONE#Summon Stone#
 4097,2230,2,0,0,0,0,0,0,0,0,0,0 //WL_RELEASE#Release#
 4097,2230,2,0,0,0,0,0,0,0,0,0,0 //WL_RELEASE#Release#
 4097,2231,1,0,0,0,0,0,0,0,0,0,0 //WL_READING_SB#Reading Spellbook#
 4097,2231,1,0,0,0,0,0,0,0,0,0,0 //WL_READING_SB#Reading Spellbook#
 4097,2232,10,0,0,0,0,0,0,0,0,0,0 //WL_FREEZE_SP#Freeze Spell#
 4097,2232,10,0,0,0,0,0,0,0,0,0,0 //WL_FREEZE_SP#Freeze Spell#

+ 12 - 33
db/re/spellbook_db.yml

@@ -32,54 +32,33 @@ Header:
   Version: 1
   Version: 1
 
 
 Body:
 Body:
-  - Skill: MG_COLDBOLT
-    Book: Magic_Book_CB
-    PreservePoints: 7
-  - Skill: MG_FIREBOLT
-    Book: Magic_Book_FB
-    PreservePoints: 7
-  - Skill: MG_LIGHTNINGBOLT
-    Book: Magic_Book_LB
-    PreservePoints: 7
-  - Skill: MG_THUNDERSTORM
-    Book: Magic_Book_TS
-    PreservePoints: 9
   - Skill: WZ_METEOR
   - Skill: WZ_METEOR
-    Book: Magic_Book_MS
+    Book: WL_MB_MS
     PreservePoints: 10
     PreservePoints: 10
-  - Skill: WZ_JUPITEL
-    Book: Magic_Book_JT
-    PreservePoints: 9
   - Skill: WZ_VERMILION
   - Skill: WZ_VERMILION
-    Book: Magic_Book_LOV
+    Book: WL_MB_LOV
     PreservePoints: 10
     PreservePoints: 10
-  - Skill: WZ_WATERBALL
-    Book: Magic_Book_WB
-    PreservePoints: 9
   - Skill: WZ_STORMGUST
   - Skill: WZ_STORMGUST
-    Book: Magic_Book_SG
+    Book: WL_MB_SG
+    PreservePoints: 10
+  - Skill: WL_JACKFROST
+    Book: WL_MB_JF
     PreservePoints: 10
     PreservePoints: 10
-  - Skill: WZ_EARTHSPIKE
-    Book: Magic_Book_ES
-    PreservePoints: 8
-  - Skill: WZ_HEAVENDRIVE
-    Book: Magic_Book_HD
-    PreservePoints: 9
   - Skill: WL_DRAINLIFE
   - Skill: WL_DRAINLIFE
-    Book: Magic_Book_DL
+    Book: WL_MB_DL
     PreservePoints: 8
     PreservePoints: 8
   - Skill: WL_CRIMSONROCK
   - Skill: WL_CRIMSONROCK
-    Book: Magic_Book_CR
+    Book: WL_MB_CR
     PreservePoints: 12
     PreservePoints: 12
   - Skill: WL_COMET
   - Skill: WL_COMET
-    Book: Magic_Book_CM
+    Book: WL_MB_CM
     PreservePoints: 22
     PreservePoints: 22
   - Skill: WL_CHAINLIGHTNING
   - Skill: WL_CHAINLIGHTNING
-    Book: Magic_Book_CL
+    Book: WL_MB_CL
     PreservePoints: 12
     PreservePoints: 12
   - Skill: WL_EARTHSTRAIN
   - Skill: WL_EARTHSTRAIN
-    Book: Magic_Book_ES_
+    Book: WL_MB_ES
     PreservePoints: 12
     PreservePoints: 12
   - Skill: WL_TETRAVORTEX
   - Skill: WL_TETRAVORTEX
-    Book: Magic_Book_TV
+    Book: WL_MB_TV
     PreservePoints: 22
     PreservePoints: 22

+ 3 - 2
doc/script_commands.txt

@@ -2861,8 +2861,7 @@ number.
 This is the only function around where a parameter may be either a string or a
 This is the only function around where a parameter may be either a string or a
 number! If it's a number, it means that only the items with that item ID number
 number! If it's a number, it means that only the items with that item ID number
 will be counted. If it is a string, it is assumed to mean the 'english name'
 will be counted. If it is a string, it is assumed to mean the 'english name'
-field from the item database. If you give it an empty string, or something that
-isn't found from the item database, it will count items number '512' (apples).
+field from the item database.
 
 
 ---------------------------------------
 ---------------------------------------
 
 
@@ -8548,6 +8547,8 @@ Valid types are:
 		if = 10000, then this item is sold in NPC shops only
 		if = 10000, then this item is sold in NPC shops only
 	4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
 	4 - sex; 5 - equip; 6 - weight; 7 - atk; 8 - def; 9 - range;
 	10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id
 	10 - slot; 11 - look; 12 - elv; 13 - wlv; 14 - view id
+	15 - eLVMax
+	16 - matk if RENEWAL is defined
 
 
 Example:
 Example:
 	setiteminfo 7049,6,9990; // Stone now weighs 999.0
 	setiteminfo 7049,6,9990; // Stone now weighs 999.0

+ 2 - 1
npc/jobs/2-1/assassin.txt

@@ -1102,7 +1102,8 @@ in_moc_16,21,165,2	script	Standby Room#ASNTEST	725,{
 	end;
 	end;
 
 
 OnInit:
 OnInit:
-	disablenpc "Standby Room#ASNTEST";
+	//disablenpc "Standby Room#ASNTEST";
+	hideonnpc "Standby Room#ASNTEST";
 	waitingroom "Standby Room",10,"Standby Room#ASNTEST::OnStartArena",1;
 	waitingroom "Standby Room",10,"Standby Room#ASNTEST::OnStartArena",1;
 	enablewaitingroomevent;
 	enablewaitingroomevent;
 	end;
 	end;

+ 2 - 1
npc/jobs/2-1/knight.txt

@@ -1227,7 +1227,8 @@ job_knt,89,106,4	script	Windsor Benedict#knt	733,{
 	end;
 	end;
 
 
 OnInit:
 OnInit:
-	disablenpc "Windsor Benedict#knt";
+	//disablenpc  "Windsor Benedict#knt";
+	hideonnpc "Windsor Benedict#knt";
 	waitingroom "Waiting Room",20,"Windsor Benedict#knt::OnStartArena",1;
 	waitingroom "Waiting Room",20,"Windsor Benedict#knt::OnStartArena",1;
 	enablewaitingroomevent;
 	enablewaitingroomevent;
 	end;
 	end;

+ 2 - 1
npc/jobs/2-2/crusader.txt

@@ -1228,7 +1228,8 @@ job_cru,24,187,2	script	Waiting Room#cr1	700,{
 	end;
 	end;
 
 
 OnInit:
 OnInit:
-	disablenpc "Waiting Room#cr1";
+	//disablenpc  "Waiting Room#cr1";
+	hideonnpc "Waiting Room#cr1";
 	waitingroom "Waiting Room",20,"Waiting Room#cr1::OnStartArena",1;
 	waitingroom "Waiting Room",20,"Waiting Room#cr1::OnStartArena",1;
 	enablewaitingroomevent;
 	enablewaitingroomevent;
 	end;
 	end;

+ 2 - 1
npc/jobs/2-2/sage.txt

@@ -2563,7 +2563,8 @@ job_sage,50,165,4	script	Waiting Room#sg	700,{
 	end;
 	end;
 
 
 OnInit:
 OnInit:
-	disablenpc "Waiting Room#sg";
+	//disablenpc  "Waiting Room#sg";
+	hideonnpc "Waiting Room#sg";
 	waitingroom "Waiting Room",20,"Waiting Room#sg::OnStartArena",1;
 	waitingroom "Waiting Room",20,"Waiting Room#sg::OnStartArena",1;
 	enablewaitingroomevent;
 	enablewaitingroomevent;
 	end;
 	end;

+ 51 - 51
npc/quests/counteragent_mixture.txt

@@ -4,7 +4,7 @@
 //= kobra_k88
 //= kobra_k88
 //= added some dialogs for Morgenstein by Komurka
 //= added some dialogs for Morgenstein by Komurka
 //===== Current Version: ===================================== 
 //===== Current Version: ===================================== 
-//= 2.2b
+//= 2.2c
 //===== Compatible With: ===================================== 
 //===== Compatible With: ===================================== 
 //= rAthena Project
 //= rAthena Project
 //===== Description: ========================================= 
 //===== Description: ========================================= 
@@ -14,6 +14,7 @@
 //= 2.2 Rescripted to Aegis 10.3 standards. [L0ne_W0lf]
 //= 2.2 Rescripted to Aegis 10.3 standards. [L0ne_W0lf]
 //= 2.2a A few minor fixes. (bugreport:1122) [L0ne_W0lf]
 //= 2.2a A few minor fixes. (bugreport:1122) [L0ne_W0lf]
 //= 2.2b Follow up fixes to bugreport:1122 [L0ne_W0lf]
 //= 2.2b Follow up fixes to bugreport:1122 [L0ne_W0lf]
+//= 2.2c NPC name typo fix [Everade]
 //============================================================ 
 //============================================================ 
 
 
 alberta_in,133,55,3	script	Louitz#cm	84,{
 alberta_in,133,55,3	script	Louitz#cm	84,{
@@ -24,7 +25,7 @@ alberta_in,133,55,3	script	Louitz#cm	84,{
 		mes "that nutcase scientist";
 		mes "that nutcase scientist";
 		mes "who lives over in Geffen?";
 		mes "who lives over in Geffen?";
 		next;
 		next;
-		if (select("Talk About Molgenstein:Cancel") == 1) {
+		if (select("Talk About Morgenstein:Cancel") == 1) {
 			mes "[Merchant Louitz]";
 			mes "[Merchant Louitz]";
 			mes "You know where he lives";
 			mes "You know where he lives";
 			mes "but didn't check it out? Hey,";
 			mes "but didn't check it out? Hey,";
@@ -103,7 +104,7 @@ alberta_in,133,55,3	script	Louitz#cm	84,{
 			mes "I don't remember exactly";
 			mes "I don't remember exactly";
 			mes "where he lives, but I know";
 			mes "where he lives, but I know";
 			mes "he's in Geffen and that his";
 			mes "he's in Geffen and that his";
-			mes "name is ^0000FFMolgenstein^000000.";
+			mes "name is ^0000FFMorgenstein^000000.";
 			next;
 			next;
 			mes "[Merchant Louitz]";
 			mes "[Merchant Louitz]";
 			mes "Hmm... You better";
 			mes "Hmm... You better";
@@ -111,7 +112,7 @@ alberta_in,133,55,3	script	Louitz#cm	84,{
 			mes "around first. I know for";
 			mes "around first. I know for";
 			mes "ask around first. I know for";
 			mes "ask around first. I know for";
 			mes "sure that somebody knows";
 			mes "sure that somebody knows";
-			mes "where you can find Molgenstein.";
+			mes "where you can find Morgenstein.";
 			close;
 			close;
 		case 3:
 		case 3:
 			mes "[Merchant Louitz]";
 			mes "[Merchant Louitz]";
@@ -173,7 +174,7 @@ alberta_in,133,55,3	script	Louitz#cm	84,{
 			mes "I don't remember exactly";
 			mes "I don't remember exactly";
 			mes "where he lives, but I know";
 			mes "where he lives, but I know";
 			mes "he's in Geffen and that his";
 			mes "he's in Geffen and that his";
-			mes "name is ^0000FFMolgenstein^000000.";
+			mes "name is ^0000FFMorgenstein^000000.";
 			next;
 			next;
 			mes "[Merchant Louitz]";
 			mes "[Merchant Louitz]";
 			mes "Hmm... You better";
 			mes "Hmm... You better";
@@ -181,7 +182,7 @@ alberta_in,133,55,3	script	Louitz#cm	84,{
 			mes "around first. I know for";
 			mes "around first. I know for";
 			mes "ask around first. I know for";
 			mes "ask around first. I know for";
 			mes "sure that somebody knows";
 			mes "sure that somebody knows";
-			mes "where you can find Molgenstein.";
+			mes "where you can find Morgenstein.";
 			close;
 			close;
 		case 3:
 		case 3:
 			mes "[Merchant Louitz]";
 			mes "[Merchant Louitz]";
@@ -243,7 +244,7 @@ alberta_in,133,55,3	script	Louitz#cm	84,{
 			mes "I don't remember exactly";
 			mes "I don't remember exactly";
 			mes "where he lives, but I know";
 			mes "where he lives, but I know";
 			mes "he's in Geffen and that his";
 			mes "he's in Geffen and that his";
-			mes "name is ^0000FFMolgenstein^000000.";
+			mes "name is ^0000FFMorgenstein^000000.";
 			next;
 			next;
 			mes "[Merchant Louitz]";
 			mes "[Merchant Louitz]";
 			mes "Hmm... You better";
 			mes "Hmm... You better";
@@ -251,7 +252,7 @@ alberta_in,133,55,3	script	Louitz#cm	84,{
 			mes "around first. I know for";
 			mes "around first. I know for";
 			mes "ask around first. I know for";
 			mes "ask around first. I know for";
 			mes "sure that somebody knows";
 			mes "sure that somebody knows";
-			mes "where you can find Molgenstein.";
+			mes "where you can find Morgenstein.";
 			close;
 			close;
 		case 3:
 		case 3:
 			mes "[Merchant Louitz]";
 			mes "[Merchant Louitz]";
@@ -313,10 +314,10 @@ geffen,181,114,3	script	Aure Dupon#cm	82,{
 		mes "Coincidence? It's more";
 		mes "Coincidence? It's more";
 		mes "than that. This is ^0000FFfate^000000.";
 		mes "than that. This is ^0000FFfate^000000.";
 		next;
 		next;
-		if (select("Talk About Molgenstein:Cancel") == 1) {
+		if (select("Talk About Morgenstein:Cancel") == 1) {
 			mes "[Aure Dupon]";
 			mes "[Aure Dupon]";
 			mes "Have you not met";
 			mes "Have you not met";
-			mes "Molgenstein yet? He";
+			mes "Morgenstein yet? He";
 			mes "lives on the second floor";
 			mes "lives on the second floor";
 			mes "of the Forge. Although we've";
 			mes "of the Forge. Although we've";
 			mes "just met, I must warn you not";
 			mes "just met, I must warn you not";
@@ -339,7 +340,7 @@ geffen,181,114,3	script	Aure Dupon#cm	82,{
 	mes "mote in the grand scheme.";
 	mes "mote in the grand scheme.";
 	next;
 	next;
 	if (molgenstain > 0) {
 	if (molgenstain > 0) {
-		switch(select("Talk:Ask About Molgenstein:Cancel")) {
+		switch(select("Talk:Ask About Morgenstein:Cancel")) {
 		case 1:
 		case 1:
 			mes "[Aure Dupon]";
 			mes "[Aure Dupon]";
 			mes "To have goals and focus";
 			mes "To have goals and focus";
@@ -352,7 +353,7 @@ geffen,181,114,3	script	Aure Dupon#cm	82,{
 		case 2:
 		case 2:
 			set molgenstain,2;
 			set molgenstain,2;
 			mes "[Aure Dupon]";
 			mes "[Aure Dupon]";
-			mes "Molgenstein...?";
+			mes "Morgenstein...?";
 			mes "The man is obsessed";
 			mes "The man is obsessed";
 			mes "with conquering the forces";
 			mes "with conquering the forces";
 			mes "that control our world. But";
 			mes "that control our world. But";
@@ -361,7 +362,7 @@ geffen,181,114,3	script	Aure Dupon#cm	82,{
 			next;
 			next;
 			mes "[Aure Dupon]";
 			mes "[Aure Dupon]";
 			mes "It would be best if you";
 			mes "It would be best if you";
-			mes "were to see Molgenstein";
+			mes "were to see Morgenstein";
 			mes "and judge his character for";
 			mes "and judge his character for";
 			mes "yourself. You may find him in";
 			mes "yourself. You may find him in";
 			mes "the second floor of the Geffen";
 			mes "the second floor of the Geffen";
@@ -394,7 +395,7 @@ geffen,181,114,3	script	Aure Dupon#cm	82,{
 	close;
 	close;
 }
 }
 
 
-geffen_in,141,140,3	script	Molgenstein#cm	121,{
+geffen_in,141,140,3	script	Morgenstein#cm	121,{
 	if (checkweight(1201,1) == 0) {
 	if (checkweight(1201,1) == 0) {
 		mes "- Wait a minute !! -";
 		mes "- Wait a minute !! -";
 		mes "- Currently you're carrying -";
 		mes "- Currently you're carrying -";
@@ -404,7 +405,7 @@ geffen_in,141,140,3	script	Molgenstein#cm	121,{
 		close;
 		close;
 	}
 	}
 	if (MISC_QUEST & 4) {
 	if (MISC_QUEST & 4) {
-		mes "[Chemist Molgenstein]";
+		mes "[Chemist Morgenstein]";
 		mes ".....";
 		mes ".....";
 		mes "Welcome.";
 		mes "Welcome.";
 		mes "Hehehehe....";
 		mes "Hehehehe....";
@@ -412,59 +413,59 @@ geffen_in,141,140,3	script	Molgenstein#cm	121,{
 		next;
 		next;
 		switch(select("Ask about his research:Ask him to make a new solution.:Cancel")) {
 		switch(select("Ask about his research:Ask him to make a new solution.:Cancel")) {
 		case 1:
 		case 1:
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "Heeheeheeheee...";
 			mes "Heeheeheeheee...";
 			mes "You must have heard the rumors about my research. Yes! But since you probably know already, I'll tell you without hiding, I mean, there's nothing to hide.";
 			mes "You must have heard the rumors about my research. Yes! But since you probably know already, I'll tell you without hiding, I mean, there's nothing to hide.";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "Actually, you can say my research is complete! Nothing's impossible for my genius! Bwahaha, it's just a matter of time!";
 			mes "Actually, you can say my research is complete! Nothing's impossible for my genius! Bwahaha, it's just a matter of time!";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "Are you still here? Right, you wanted to know about my research. It's actually very simple. I was just trying to invent a super liquid that can melt everything!";
 			mes "Are you still here? Right, you wanted to know about my research. It's actually very simple. I was just trying to invent a super liquid that can melt everything!";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "Isn't it interesting? No matter how strong you are, you can't break apart stone or steel, but with my new liquid, you can melt those things, making them soft like puddy!";
 			mes "Isn't it interesting? No matter how strong you are, you can't break apart stone or steel, but with my new liquid, you can melt those things, making them soft like puddy!";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "It can't melt everything yet, but I did find that you could combine things that you could never mix before with my invention. Heeheeheehee~!";
 			mes "It can't melt everything yet, but I did find that you could combine things that you could never mix before with my invention. Heeheeheehee~!";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "You can make a whole lot of things that you'd never would have imagined possible! I can make you a lot of new things you never would have imagined using this method... as long as you want it!!";
 			mes "You can make a whole lot of things that you'd never would have imagined possible! I can make you a lot of new things you never would have imagined using this method... as long as you want it!!";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "The endorphins are rushing to my face at least 2.1 times faster than the usual rate! Ah! I'm so excited! I... I just can't hide it!";
 			mes "The endorphins are rushing to my face at least 2.1 times faster than the usual rate! Ah! I'm so excited! I... I just can't hide it!";
 			close;
 			close;
 		case 2:
 		case 2:
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "So...";
 			mes "So...";
 			mes "You want me to make something totally new, huh? Hehhehheh! I love your sense of scientific adventure!";
 			mes "You want me to make something totally new, huh? Hehhehheh! I love your sense of scientific adventure!";
 			next;
 			next;
 			switch(select("Counteragent:Mixture")) {
 			switch(select("Counteragent:Mixture")) {
 			case 1:
 			case 1:
-				mes "[Chemist Molgenstein]";
+				mes "[Chemist Morgenstein]";
 				mes "Ooh...!";
 				mes "Ooh...!";
 				mes "You want to make a Counteragent? Hohohohoho, let's see what we'll need...";
 				mes "You want to make a Counteragent? Hohohohoho, let's see what we'll need...";
 				next;
 				next;
-				mes "[Chemist Molgenstein]";
+				mes "[Chemist Morgenstein]";
 				mes "Oh, I remember, yes, Alcohol, and um, er, Detrimindexta and an Empty Bottle to put it it all in. Just these three items and 3000 zeny.";
 				mes "Oh, I remember, yes, Alcohol, and um, er, Detrimindexta and an Empty Bottle to put it it all in. Just these three items and 3000 zeny.";
 				next;
 				next;
-				mes "[Chemist Molgenstein]";
+				mes "[Chemist Morgenstein]";
 				mes "Bwahahahah!";
 				mes "Bwahahahah!";
 				mes "Oh, I just can't wait to make this! Are you ready to begin?";
 				mes "Oh, I just can't wait to make this! Are you ready to begin?";
 				next;
 				next;
 				if (select("Make:Cancel") == 1) {
 				if (select("Make:Cancel") == 1) {
 					if (countitem(970) == 0 || countitem(971) == 0 || countitem(713) == 0 || Zeny < 3000) {
 					if (countitem(970) == 0 || countitem(971) == 0 || countitem(713) == 0 || Zeny < 3000) {
-						mes "[Chemist Molgenstein]";
+						mes "[Chemist Morgenstein]";
 						mes "Heuheuheuheuh.... not enough... not enough.. Haah...Haah... Go..... get the rest of the materials!";
 						mes "Heuheuheuheuh.... not enough... not enough.. Haah...Haah... Go..... get the rest of the materials!";
 						mes "We'll postpone the fun until then... Heuheuheuheuheuh.";
 						mes "We'll postpone the fun until then... Heuheuheuheuheuh.";
 						close;
 						close;
 					}
 					}
-					mes "[Chemist Molgenstein]";
+					mes "[Chemist Morgenstein]";
 					mes "Ooooooooh...... heeheeheeheehee...... yes... like that...... yes... more... more........ heeheeheehee.";
 					mes "Ooooooooh...... heeheeheeheehee...... yes... like that...... yes... more... more........ heeheeheehee.";
 					mes ".... Aaah.... ahah... ha....ahahooooooooohoh!";
 					mes ".... Aaah.... ahah... ha....ahahooooooooohoh!";
 					next;
 					next;
 					if (countitem(970) < 1 || countitem(971) < 1 || countitem(713) < 1) {
 					if (countitem(970) < 1 || countitem(971) < 1 || countitem(713) < 1) {
-						mes "[Chemist Molgenstein]";
+						mes "[Chemist Morgenstein]";
 						mes "Hohohoho.... not enough... not enough... haah...haah... go..... go get the rest of the materials!!";
 						mes "Hohohoho.... not enough... not enough... haah...haah... go..... go get the rest of the materials!!";
 						close;
 						close;
 					}
 					}
@@ -473,42 +474,42 @@ geffen_in,141,140,3	script	Molgenstein#cm	121,{
 					delitem 713,1; //Empty_Bottle
 					delitem 713,1; //Empty_Bottle
 					set Zeny, Zeny-3000;
 					set Zeny, Zeny-3000;
 					getitem 973,1; //Counteragent
 					getitem 973,1; //Counteragent
-					mes "[Chemist Molgenstein]";
+					mes "[Chemist Morgenstein]";
 					mes "Hee hee hee...";
 					mes "Hee hee hee...";
 					mes "Haaaaah......";
 					mes "Haaaaah......";
 					mes "Oh? We're done already?!";
 					mes "Oh? We're done already?!";
 					close;
 					close;
 				}
 				}
-				mes "[Chemist Molgenstein]";
+				mes "[Chemist Morgenstein]";
 				mes "Hee hee hee...!";
 				mes "Hee hee hee...!";
 				mes "Come back when";
 				mes "Come back when";
 				mes "you're ready~";
 				mes "you're ready~";
 				close;
 				close;
 			case 2:
 			case 2:
-				mes "[Chemist Molgenstein]";
+				mes "[Chemist Morgenstein]";
 				mes "Ooh...!";
 				mes "Ooh...!";
 				mes "You want to make a Mixture? Hohohohoho, let's see what we'll need...";
 				mes "You want to make a Mixture? Hohohohoho, let's see what we'll need...";
 				next;
 				next;
-				mes "[Chemist Molgenstein]";
+				mes "[Chemist Morgenstein]";
 				mes "Ooh, I remember now, yes, Alcohol, and um, er, Karvodailnirol and an empty bottle to put all of it in. Just these three items and 4000 zeny.";
 				mes "Ooh, I remember now, yes, Alcohol, and um, er, Karvodailnirol and an empty bottle to put all of it in. Just these three items and 4000 zeny.";
 				next;
 				next;
-				mes "[Chemist Molgenstein]";
+				mes "[Chemist Morgenstein]";
 				mes "Bwahahahah!";
 				mes "Bwahahahah!";
 				mes "Oh, I just can't wait to make this! Are you ready to begin?";
 				mes "Oh, I just can't wait to make this! Are you ready to begin?";
 				next;
 				next;
 				if (select("Make:Cancel") == 1) {
 				if (select("Make:Cancel") == 1) {
 					if (countitem(970) == 0 || countitem(972) == 0 || countitem(713) == 0 || Zeny < 4000) {
 					if (countitem(970) == 0 || countitem(972) == 0 || countitem(713) == 0 || Zeny < 4000) {
-						mes "[Chemist Molgenstein]";
+						mes "[Chemist Morgenstein]";
 						mes "Hohohoho.... not enough... not enough... haah...haah... go..... go get the rest of the materials!!";
 						mes "Hohohoho.... not enough... not enough... haah...haah... go..... go get the rest of the materials!!";
 						mes "We'll have to postpone the fun for later... Hehehehe";
 						mes "We'll have to postpone the fun for later... Hehehehe";
 						close;
 						close;
 					}
 					}
-					mes "[Chemist Molgenstein]";
+					mes "[Chemist Morgenstein]";
 					mes "Ooooooooh... heehee...... yes... like that...... yes... more... more........ heeheeheehee";
 					mes "Ooooooooh... heehee...... yes... like that...... yes... more... more........ heeheeheehee";
 					mes ".... Aaah.... ahah... ha....ahah...oooooooooooooooooh!!!...!!!!!!";
 					mes ".... Aaah.... ahah... ha....ahah...oooooooooooooooooh!!!...!!!!!!";
 					next;
 					next;
 					if (countitem(970) < 1 || countitem(972) < 1 || countitem(713) < 1) {
 					if (countitem(970) < 1 || countitem(972) < 1 || countitem(713) < 1) {
-						mes "[Chemist Molgenstein]";
+						mes "[Chemist Morgenstein]";
 						mes "Hohohoho.... not enough... not enough... haah...haah... go..... go get the rest of the materials!!";
 						mes "Hohohoho.... not enough... not enough... haah...haah... go..... go get the rest of the materials!!";
 						close;
 						close;
 					}
 					}
@@ -517,14 +518,13 @@ geffen_in,141,140,3	script	Molgenstein#cm	121,{
 					delitem 713,1; //Empty_Bottle
 					delitem 713,1; //Empty_Bottle
 					set Zeny, Zeny-4000;
 					set Zeny, Zeny-4000;
 					getitem 974,1; //Mixture
 					getitem 974,1; //Mixture
-					mes "[Chemist Molgenstein]";
+					mes "[Chemist Morgenstein]";
 					mes "Hee hee hee...";
 					mes "Hee hee hee...";
 					mes "Haaaaah......";
 					mes "Haaaaah......";
 					mes "Oh? We're done already?!";
 					mes "Oh? We're done already?!";
 					close;
 					close;
 				}
 				}
-				mes "[Chemist Molgenstein]";
-				mes "[Chemist Molgenstein]";
+				mes "[Chemist Morgenstein]";
 				mes "Hee hee hee...!";
 				mes "Hee hee hee...!";
 				mes "Come back when";
 				mes "Come back when";
 				mes "you're ready~";
 				mes "you're ready~";
@@ -532,7 +532,7 @@ geffen_in,141,140,3	script	Molgenstein#cm	121,{
 				close;
 				close;
 			}
 			}
 		case 3:
 		case 3:
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "Heehee....heheheheh....";
 			mes "Heehee....heheheheh....";
 			close;
 			close;
 		}
 		}
@@ -540,40 +540,40 @@ geffen_in,141,140,3	script	Molgenstein#cm	121,{
 	if (molgenstain == 2) {
 	if (molgenstain == 2) {
 		set MISC_QUEST,MISC_QUEST | 4;
 		set MISC_QUEST,MISC_QUEST | 4;
 		set molgenstain,0;
 		set molgenstain,0;
-		mes "[Chemist Molgenstein]";
+		mes "[Chemist Morgenstein]";
 		mes "Heeheeheehee.... welcome. Hehehehe.... heeheeheeheehee....";
 		mes "Heeheeheehee.... welcome. Hehehehe.... heeheeheeheehee....";
 		next;
 		next;
-		mes "[Chemist Molgenstein]";
+		mes "[Chemist Morgenstein]";
 		mes "Ah...?!";
 		mes "Ah...?!";
 		mes "So sorry if I weirded you out. It's just... I haven't seen a living person in soooo long. So, er, what can I do for you??";
 		mes "So sorry if I weirded you out. It's just... I haven't seen a living person in soooo long. So, er, what can I do for you??";
 		next;
 		next;
 		if (select("Ask about his research.:Cancel.") == 1) {
 		if (select("Ask about his research.:Cancel.") == 1) {
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "Heeheeheeheee...";
 			mes "Heeheeheeheee...";
 			mes "You must have heard the rumors about my research. Yes! But since you probably know already, I'll tell you without hiding, I mean, there's nothing to hide.";
 			mes "You must have heard the rumors about my research. Yes! But since you probably know already, I'll tell you without hiding, I mean, there's nothing to hide.";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "Actually, you can say my research is complete! Nothing's impossible for my genius! Bwahaha, it's just a matter of time!";
 			mes "Actually, you can say my research is complete! Nothing's impossible for my genius! Bwahaha, it's just a matter of time!";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "Are you still here? Right, you wanted to know about my research. It's actually very simple. I was just trying to invent a super liquid that can melt everything!";
 			mes "Are you still here? Right, you wanted to know about my research. It's actually very simple. I was just trying to invent a super liquid that can melt everything!";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "Isn't it interesting? No matter how strong you are, you can't break apart stone or steel, but with my new liquid, you can melt those things, making them soft like puddy!";
 			mes "Isn't it interesting? No matter how strong you are, you can't break apart stone or steel, but with my new liquid, you can melt those things, making them soft like puddy!";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "It can't melt everything yet, but I did find that you could combine things that you could never mix before with my invention.";
 			mes "It can't melt everything yet, but I did find that you could combine things that you could never mix before with my invention.";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "I can make you a lot of new things you never would have imagined using this method... as long as you want it!!";
 			mes "I can make you a lot of new things you never would have imagined using this method... as long as you want it!!";
 			next;
 			next;
-			mes "[Chemist Molgenstein]";
+			mes "[Chemist Morgenstein]";
 			mes "The endorphins are rushing to my face at least 2.1 times faster than the usual rate! Ah! I'm so excited! I... I just can't hide it!";
 			mes "The endorphins are rushing to my face at least 2.1 times faster than the usual rate! Ah! I'm so excited! I... I just can't hide it!";
 			close;
 			close;
 		}
 		}
 		close;
 		close;
 	}
 	}
-	mes "[Chemist Molgenstein]";
+	mes "[Chemist Morgenstein]";
 	mes "Heeheeheehee...";
 	mes "Heeheeheehee...";
 	mes "You're not here to be a test subject, are you? Probably not though. Not since my little 'accident.' Heeheeheeee~!";
 	mes "You're not here to be a test subject, are you? Probably not though. Not since my little 'accident.' Heeheeheeee~!";
 	close;
 	close;

+ 2 - 1
npc/re/jobs/3-1/warlock.txt

@@ -760,7 +760,8 @@ job3_war01,29,25,0	script	Ebein#WRR	437,{
 job3_war01,29,25,5	script	The chamber of magic#1	437,{
 job3_war01,29,25,5	script	The chamber of magic#1	437,{
 	end;
 	end;
 OnInit:
 OnInit:
-	disablenpc "The chamber of magic#1";
+	//disablenpc  "The chamber of magic#1";
+	hideonnpc "The chamber of magic#1";
 	waitingroom "The chamber of magic",20,"The chamber of magic#1::OnStartArena",1;
 	waitingroom "The chamber of magic",20,"The chamber of magic#1::OnStartArena",1;
 	enablewaitingroomevent;
 	enablewaitingroomevent;
 	end;
 	end;

+ 14 - 0
npc/re/kafras/cool_event_corp.txt

@@ -0,0 +1,14 @@
+//===== rAthena Script =======================================
+//= Cool Event Corp. Staff
+//===== Description: =========================================
+//= Cool Event Corp. Staff (Save, Storage & Pushcart Service)
+//===== Changelogs: ==========================================
+//= 1.0 Added Verus. [Capuche]
+//============================================================ 
+
+verus04,121,243,4	script	Cool Event Corp Staff::CoolEventCorpStaffVerus	4_M_ZONDAMAN,{
+	callfunc "F_CoolEventCorp",
+		"Save:Use Storage::Rent a Pushcart::Cancel",
+		"in Verus","verus04",121,246;
+	end;
+}

+ 1 - 1
npc/re/merchants/ticket_refiner.txt

@@ -39,7 +39,7 @@ prontera,184,177,6	script	Refine Master	851,{
 			close;
 			close;
 		case 2:
 		case 2:
 			mes "[Refine Master]";
 			mes "[Refine Master]";
-			mes "Actully, I sometimes provide refine services for adventurers with a ^006400Refine Ticket^000000...";
+			mes "Actually, I sometimes provide refine services for adventurers with a ^006400Refine Ticket^000000...";
 			mes "Bye bye~!";
 			mes "Bye bye~!";
 			close;
 			close;
 		}
 		}

File diff suppressed because it is too large
+ 143 - 1323
npc/re/quests/quests_15_1.txt


File diff suppressed because it is too large
+ 3817 - 954
npc/re/quests/quests_15_2.txt


+ 1 - 0
npc/re/scripts_athena.conf

@@ -84,6 +84,7 @@ npc: npc/re/instances/WolfchevLaboratory.txt
 //npc: npc/custom/official/GeffenMagicTournament.txt
 //npc: npc/custom/official/GeffenMagicTournament.txt
 
 
 // ---------------- Kafras & Cool Event Corp. -------------------
 // ---------------- Kafras & Cool Event Corp. -------------------
+npc: npc/re/kafras/cool_event_corp.txt
 npc: npc/re/kafras/kafras.txt
 npc: npc/re/kafras/kafras.txt
 npc: npc/re/kafras/Kafra_Teleportation_Services.txt
 npc: npc/re/kafras/Kafra_Teleportation_Services.txt
 npc: npc/re/kafras/Zonda_Teleportation_Services.txt
 npc: npc/re/kafras/Zonda_Teleportation_Services.txt

+ 23 - 93
npc/re/warps/other/un_myst.txt

@@ -4,129 +4,59 @@
 //= Warp Points for episodes 15.1 & 15.2
 //= Warp Points for episodes 15.1 & 15.2
 //===== Changelogs: ==========================================
 //===== Changelogs: ==========================================
 //= 1.0 First version. [Capuche]
 //= 1.0 First version. [Capuche]
+//= 2.0 Updated using Aegis files. [Capuche]
 //============================================================
 //============================================================
 
 
 // A
 // A
-un_myst,124,189,0	script	#un_myst_entrance	WARPNPC,1,1,{
-	end;
-OnTouch:
-	warp "un_myst",171,197;
-	@weird_piece = 1;
-	end;
-}
-un_myst,171,183,0	warp2	#un_myst_A_1	1,1,un_myst,259,200
+un_myst,124,189,0	warp2	#m101	1,1,un_myst,171,197
+un_myst,171,183,0	warp2	#m102	1,1,un_myst,259,200
 
 
-un_myst,258,208,0	script	#un_myst_A_2	WARPNPC,1,1,{
+un_myst,258,208,0	script	#m103	WARPNPC,1,1,{
 	end;
 	end;
 OnTouch:
 OnTouch:
-	.@r = rand(9);
-	if (.@r == 0)
-		warp "un_myst",329,205;
-	else if (.@r < 5)
+	.@r = rand(1,100);
+	if (.@r < 40)
 		warp "un_myst",291,203;
 		warp "un_myst",291,203;
-	else
-		warp "un_myst",259,200;
-	end;
-}
-un_myst,295,208,0	script	#un_myst_A_3	WARPNPC,1,1,{
-	end;
-OnTouch:
-	.@r = rand(9);
-	if (.@r == 0)
+	else if (.@r > 80)
 		warp "un_myst",329,205;
 		warp "un_myst",329,205;
-	else if (.@r < 5)
-		warp "un_myst",291,203;
 	else
 	else
 		warp "un_myst",259,200;
 		warp "un_myst",259,200;
 	end;
 	end;
 }
 }
+un_myst,295,208,0	duplicate(#m103)	#m104	WARPNPC,1,1
 
 
 // B
 // B
-un_myst,393,139,0	script	#un_myst_B_1	WARPNPC,1,1,{
+un_myst,393,139,0	script	#m201	WARPNPC,1,1,{
 	end;
 	end;
 OnTouch:
 OnTouch:
-	.@r = rand(9);
-	if (.@r == 0)
-		warp "un_myst",176,137;
-	else if (.@r < 5)
-		warp "un_myst",138,138;
-	else
+	.@r = rand(1,100);
+	if (.@r < 40)
 		warp "un_myst",86,136;
 		warp "un_myst",86,136;
-	end;
-}
-un_myst,104,136,0	script	#un_myst_B_2	WARPNPC,1,1,{
-	end;
-OnTouch:
-	.@r = rand(9);
-	if (.@r == 0)
+	else if (.@r > 80)
 		warp "un_myst",176,137;
 		warp "un_myst",176,137;
-	else if (.@r < 5)
-		warp "un_myst",138,138;
 	else
 	else
-		warp "un_myst",86,136;
-	end;
-}
-un_myst,138,140,0	script	#un_myst_B_3	WARPNPC,1,1,{
-	end;
-OnTouch:
-	.@r = rand(9);
-	if (.@r == 0)
-		warp "un_myst",176,137;
-	else if (.@r < 5)
 		warp "un_myst",138,138;
 		warp "un_myst",138,138;
-	else
-		warp "un_myst",86,136;
 	end;
 	end;
 }
 }
+un_myst,104,136,0	duplicate(#m201)	#m202	WARPNPC,1,1
+un_myst,138,140,0	duplicate(#m201)	#m203	WARPNPC,1,1
 
 
 // C
 // C
-un_myst,75,91,0	script	#un_myst_C_1	WARPNPC,1,1,{
+un_myst,75,91,0	script	#m301	WARPNPC,1,1,{
 	end;
 	end;
 OnTouch:
 OnTouch:
-	.@r = rand(9);
-	if (.@r == 0)
-		warp "un_myst",217,84;
-	else if (.@r < 5)
-		warp "un_myst",160,89;
-	else
-		warp "un_myst",107,88;
-	end;
-}
-un_myst,169,89,0	script	#un_myst_C_2	WARPNPC,1,1,{
-	end;
-OnTouch:
-	.@r = rand(9);
-	if (.@r == 0)
-		warp "un_myst",217,84;
-	else if (.@r < 5)
-		warp "un_myst",160,89;
-	else
+	.@r = rand(1,100);
+	if (.@r < 40)
 		warp "un_myst",107,88;
 		warp "un_myst",107,88;
-	end;
-}
-un_myst,121,82,0	script	#un_myst_C_3	WARPNPC,1,1,{
-	end;
-OnTouch:
-	.@r = rand(9);
-	if (.@r == 0)
-		warp "un_myst",217,84;
-	else if (.@r < 5)
+	else if (.@r > 80)
 		warp "un_myst",160,89;
 		warp "un_myst",160,89;
 	else
 	else
-		warp "un_myst",107,88;
-	end;
-}
-un_myst,219,88,0	script	#un_myst_C_4	WARPNPC,1,1,{
-	end;
-OnTouch:
-	.@r = rand(9);
-	if (.@r == 0)
 		warp "un_myst",217,84;
 		warp "un_myst",217,84;
-	else if (.@r < 5)
-		warp "un_myst",160,89;
-	else
-		warp "un_myst",107,88;
 	end;
 	end;
 }
 }
+un_myst,121,82,0	duplicate(#m301)	#m302	WARPNPC,1,1
+un_myst,169,89,0	duplicate(#m301)	#m303	WARPNPC,1,1
+un_myst,219,88,0	duplicate(#m301)	#m304	WARPNPC,1,1
 
 
-un_myst,108,38,0	warp2	#un_myst_tamarin	1,1,un_myst,209,33
+un_bunker,387,79,0	warp2	#room_out_	1,1,un_bunker,300,166
+un_myst,108,38,0	warp2	#way	1,1,un_myst,209,33

+ 698 - 128
npc/re/warps/other/verus.txt

@@ -4,6 +4,7 @@
 //= Warp Points for episodes 15.1 & 15.2
 //= Warp Points for episodes 15.1 & 15.2
 //===== Changelogs: ==========================================
 //===== Changelogs: ==========================================
 //= 1.0 First version. [Capuche]
 //= 1.0 First version. [Capuche]
+//= 2.0 Updated using Aegis files. [Capuche]
 //============================================================
 //============================================================
 
 
 verus04,204,163,0	warp2	fr_ver04_to_tun	1,1,ver_tunn,13,35
 verus04,204,163,0	warp2	fr_ver04_to_tun	1,1,ver_tunn,13,35
@@ -15,142 +16,711 @@ verus02,72,16,0	warp2	verus02_to_verus03	1,1,verus03,169,255
 verus03,122,17,0	warp2	fr_ver03_to_ver04_1	1,1,verus04,121,264
 verus03,122,17,0	warp2	fr_ver03_to_ver04_1	1,1,verus04,121,264
 verus03,44,17,0	warp2	fr_ver03_to_ver04_2	1,1,verus04,44,264
 verus03,44,17,0	warp2	fr_ver03_to_ver04_2	1,1,verus04,44,264
 
 
+verus03,52,254,0	script	verus03_to_verus01	WARPNPC,1,1,{
+	end;
+OnTouch:
+	if (ep15_2_permit < 1) {
+		mes "[Access Controller]";
+		mes "I am sorry but only permitted members can enter from this point.";
+		close;
+	}
+	warp "verus01",243,62;
+	end;
+}
+
+verus03,169,259,0	script	verus03_to_verus02	WARPNPC,1,1,{
+	end;
+OnTouch:
+	if (ep15_2_permit < 1) {
+		mes "[Access Controller]";
+		mes "I am sorry but only permitted members can enter from this point.";
+		close;
+	}
+	warp "verus02",72,19;
+	end;
+}
+
 juperos_01,245,87,0	warp2	fr_ju_to_eju	1,1,ver_eju,13,148
 juperos_01,245,87,0	warp2	fr_ju_to_eju	1,1,ver_eju,13,148
 ver_eju,10,148,0	warp2	fr_eju_to_ju	1,1,juperos_01,242,87
 ver_eju,10,148,0	warp2	fr_eju_to_ju	1,1,juperos_01,242,87
-ver_eju,107,36,0	warp2	fr_eju_to_tun	2,2,ver_tunn,84,82
+ver_eju,107,36,0	warp2	fr_eju_to_tun	2,3,ver_tunn,84,82
 ver_tunn,84,86,0	warp2	fr_tun_to_eju	1,1,ver_eju,113,38
 ver_tunn,84,86,0	warp2	fr_tun_to_eju	1,1,ver_eju,113,38
 ver_tunn,10,36,0	warp2	fr_tun_to_ver04	1,1,verus04,202,165
 ver_tunn,10,36,0	warp2	fr_tun_to_ver04	1,1,verus04,202,165
 
 
 lhz_in01,276,238,0	warp2	in_to_out#e152i02	1,1,lhz_in01,276,230
 lhz_in01,276,238,0	warp2	in_to_out#e152i02	1,1,lhz_in01,276,230
 
 
 // Bunker
 // Bunker
-un_bunker,41,275,0	warp2	A_0#A_1	1,1,un_bunker,21,276
 un_bunker,98,85,0	warp2	#bunker_out	1,1,verus01,115,190
 un_bunker,98,85,0	warp2	#bunker_out	1,1,verus01,115,190
-un_bunker,24,276,0	warp2	A_1#A_0	1,1,un_bunker,45,275
-un_bunker,24,256,0	warp2	A_2#A_3	1,1,un_bunker,26,190
-un_bunker,23,190,0	warp2	A_3#A_2	1,1,un_bunker,21,256
-un_bunker,31,196,0	warp2	A_4#A_5	1,1,un_bunker,22,378
-un_bunker,21,375,0	warp2	A_5#A_4	1,1,un_bunker,32,193
-un_bunker,51,196,0	warp2	A_6#A_7	1,1,un_bunker,68,378
-un_bunker,67,375,0	warp2	A_7#A_6	1,1,un_bunker,52,193
-un_bunker,60,183,0	warp2	A_8#A_9	1,1,un_bunker,75,235
-un_bunker,71,236,0	warp2	A_9#A_8	1,1,un_bunker,57,182
-un_bunker,60,169,0	warp2	A_10#A_11	1,1,un_bunker,72,168
-un_bunker,69,167,0	warp2	A_11#A_10	1,1,un_bunker,57,168
-un_bunker,47,135,0	warp2	A_12#A_13	1,1,un_bunker,37,134
-un_bunker,40,135,0	warp2	A_13#A_12	1,1,un_bunker,50,134
-un_bunker,57,118,0	warp2	A_14#A_15	1,1,un_bunker,72,117
-un_bunker,69,118,0	warp2	A_15#A_14	1,1,un_bunker,53,117
-un_bunker,97,124,0	warp2	A_16#A_17	1,1,un_bunker,100,144
-un_bunker,97,141,0	warp2	A_17#A_16	1,1,un_bunker,98,121
-un_bunker,128,118,0	warp2	A_18#A_19	1,1,un_bunker,144,117
-un_bunker,140,118,0	warp2	A_19#A_18	1,1,un_bunker,125,117
-un_bunker,137,168,0	warp2	A_20#A_21	1,1,un_bunker,122,167
-un_bunker,126,168,0	warp2	A_21#A_20	1,1,un_bunker,140,167
-un_bunker,137,185,0	warp2	A_22#A_23	1,1,un_bunker,120,235
-un_bunker,124,236,0	warp2	A_23#A_22	1,1,un_bunker,140,184
-un_bunker,147,196,0	warp2	A_24#A_25	1,1,un_bunker,106,378
-un_bunker,105,375,0	warp2	A_25#A_24	1,1,un_bunker,148,193
-un_bunker,167,196,0	warp2	A_26#A_27	1,1,un_bunker,152,378
-un_bunker,151,375,0	warp2	A_27#A_26	1,1,un_bunker,168,193
-un_bunker,174,190,0	warp2	A_28#A_29	1,1,un_bunker,172,229
-un_bunker,169,230,0	warp2	A_29#A_28	1,1,un_bunker,171,189
-un_bunker,213,346,0	warp2	A_30#A_31	1,1,un_bunker,213,299
-un_bunker,216,300,0	warp2	A_31#A_30	1,1,un_bunker,216,345
-un_bunker,216,280,0	warp2	A_32#A_33	1,1,un_bunker,220,261
-un_bunker,217,262,0	warp2	A_33#A_32	1,1,un_bunker,213,279
-un_bunker,249,268,0	warp2	A_34#A_35	1,1,un_bunker,390,380
-un_bunker,389,377,0	warp2	A_35#A_34	1,1,un_bunker,250,265
-un_bunker,258,262,0	warp2	A_36#A_37	1,1,un_bunker,274,289
-un_bunker,271,290,0	warp2	A_37#A_36	1,1,un_bunker,255,261
-un_bunker,258,236,0	warp2	A_38#A_39	1,1,un_bunker,272,235
-un_bunker,269,236,0	warp2	A_39#A_38	1,1,un_bunker,255,235
-un_bunker,245,214,0	warp2	A_40#A_41	1,1,un_bunker,226,213
-un_bunker,230,214,0	warp2	A_41#A_40	1,1,un_bunker,248,213
-un_bunker,262,200,0	warp2	A_42#A_43	1,1,un_bunker,274,199
-un_bunker,271,200,0	warp2	A_43#A_42	1,1,un_bunker,258,199
-un_bunker,75,128,0	warp2	A_44#B_1	1,1,un_bunker,276,196
-un_bunker,275,191,0	warp2	B_1#A_44	1,1,un_bunker,76,121
-un_bunker,119,128,0	warp2	A_45#B_2	1,1,un_bunker,319,196
-un_bunker,320,191,0	warp2	B_2#A_45	1,1,un_bunker,120,121
-un_bunker,297,206,0	warp2	B_3#B_4	1,1,un_bunker,298,224
-un_bunker,297,221,0	warp2	B_4#B_3	1,1,un_bunker,298,203
-un_bunker,324,200,0	warp2	B_5#B_6	1,1,un_bunker,344,199
-un_bunker,339,200,0	warp2	B_6#B_5	1,1,un_bunker,321,199
-un_bunker,350,214,0	warp2	B_7#B_8	1,1,un_bunker,368,213
-un_bunker,365,214,0	warp2	B_8#B_7	1,1,un_bunker,347,213
-un_bunker,337,236,0	warp2	B_9#B_10	1,1,un_bunker,323,235
-un_bunker,326,236,0	warp2	B_10#B_9	1,1,un_bunker,340,235
-un_bunker,281,266,0	warp2	B_11#B_12	1,1,un_bunker,282,282
-un_bunker,281,279,0	warp2	B_12#B_11	1,1,un_bunker,282,263
-un_bunker,313,266,0	warp2	B_13#B_14	1,1,un_bunker,314,282
-un_bunker,313,279,0	warp2	B_14#B_13	1,1,un_bunker,314,262
-un_bunker,324,290,0	warp2	B_15#B_16	1,1,un_bunker,340,261
-un_bunker,337,262,0	warp2	B_16#B_15	1,1,un_bunker,321,289
-un_bunker,343,270,0	warp2	B_17#B_18	1,1,un_bunker,382,328
-un_bunker,381,325,0	warp2	B_18#B_17	1,1,un_bunker,344,267
-un_bunker,370,264,0	warp2	B_19#B_20	1,1,un_bunker,388,263
-un_bunker,385,264,0	warp2	B_20#B_19	1,1,un_bunker,367,263
-un_bunker,297,192,0	warp2	B_21#B_22	1,1,un_bunker,298,181
-un_bunker,297,186,0	warp2	B_22#B_21	1,1,un_bunker,298,196
-un_bunker,229,163,0	warp2	B_23#B_24	1,1,un_bunker,159,52
-un_bunker,164,51,0	warp2	B_24#B_23	1,1,un_bunker,233,164
-un_bunker,366,164,0	warp2	B_25#B_26	1,1,un_bunker,31,51
-un_bunker,27,52,0	warp2	B_26#B_25	1,1,un_bunker,361,163
-un_bunker,387,79,0	warp2	alp2#out	1,1,un_bunker,366,164
+un_bunker,41,275,0	warp2	MechanicalRoom#b_J-0	1,1,un_bunker,21,276
+un_bunker,24,276,0	warp2	J-0#b_MechanicalRoom	1,1,un_bunker,45,275
+un_bunker,24,256,0	warp2	J-0#b_L-1	1,1,un_bunker,26,190
+un_bunker,23,190,0	warp2	L-1#b_J-0	1,1,un_bunker,21,256
+un_bunker,31,196,0	warp2	L-1#b_D-1	1,1,un_bunker,22,378
+un_bunker,21,375,0	warp2	D-1#b_L-1	1,1,un_bunker,32,193
+un_bunker,51,196,0	warp2	L-1#b_D-2	1,1,un_bunker,68,378
+un_bunker,67,375,0	warp2	D-2#b_L-1	1,1,un_bunker,52,193
+un_bunker,60,183,0	warp2	L-1#b_ControlRoom	1,1,un_bunker,75,235
+un_bunker,71,236,0	warp2	ControlRoom#b_L-1	1,1,un_bunker,57,182
+un_bunker,60,169,0	warp2	L-1#b_Monitoring room	1,1,un_bunker,72,168
+un_bunker,69,167,0	warp2	Monitoring room#b_L-1	1,1,un_bunker,57,168
+un_bunker,47,135,0	warp2	L-1#b_B-1	1,1,un_bunker,37,134
+un_bunker,40,135,0	warp2	B-1#b_L-1	1,1,un_bunker,50,134
+un_bunker,57,118,0	warp2	L-1#b_A-0	1,1,un_bunker,72,117
+un_bunker,69,118,0	warp2	A-0#b_L-1	1,1,un_bunker,53,117
+un_bunker,97,124,0	warp2	A-0#b_Monitoring room	1,1,un_bunker,100,144
+un_bunker,97,141,0	warp2	Monitoring room#b_A-0	1,1,un_bunker,98,121
+un_bunker,128,118,0	warp2	A-0#b_L-2	1,1,un_bunker,144,117
+un_bunker,140,118,0	warp2	L-2#b_A-0	1,1,un_bunker,125,117
+un_bunker,137,168,0	warp2	L-2#b_Monitoring room	1,1,un_bunker,122,167
+un_bunker,126,168,0	warp2	Monitoring room#b_L-2	1,1,un_bunker,140,167
+un_bunker,137,185,0	warp2	L-2#b_ControlRoom	1,1,un_bunker,120,235
+un_bunker,124,236,0	warp2	ControlRoom#b_L-2	1,1,un_bunker,140,184
+un_bunker,147,196,0	warp2	L-2#b_E-1	1,1,un_bunker,106,378
+un_bunker,105,375,0	warp2	E-1#b_L-2	1,1,un_bunker,148,193
+un_bunker,167,196,0	warp2	L-2#b_E-2	1,1,un_bunker,152,378
+un_bunker,151,375,0	warp2	E-2#b_L-2	1,1,un_bunker,168,193
+un_bunker,174,190,0	warp2	L-2#b_K-0	1,1,un_bunker,172,229
+un_bunker,169,230,0	warp2	K-0#b_L-2	1,1,un_bunker,171,189
+un_bunker,213,346,0	warp2	Farm#b_C-0	1,1,un_bunker,213,299
+un_bunker,216,300,0	warp2	C-0#b_Farm	1,1,un_bunker,216,345
+un_bunker,216,280,0	warp2	C-0#b_G-1	1,1,un_bunker,220,261
+un_bunker,217,262,0	warp2	G-1#b_C-0	1,1,un_bunker,213,279
+un_bunker,249,268,0	warp2	G-1#b_M-0	1,1,un_bunker,390,380
+un_bunker,389,377,0	warp2	M-0#b_G-1	1,1,un_bunker,250,265
+un_bunker,258,262,0	warp2	G-1#b_Cafeteria	1,1,un_bunker,274,289
+un_bunker,271,290,0	warp2	Cafeteria#b_G-1	1,1,un_bunker,255,261
+un_bunker,258,236,0	warp2	G-1#b_Clinic	1,1,un_bunker,272,235
+un_bunker,269,236,0	warp2	Clinic#b_G-1	1,1,un_bunker,255,235
+un_bunker,245,214,0	warp2	G-1#b_F-1	1,1,un_bunker,226,213
+un_bunker,230,214,0	warp2	F-1#b_G-1	1,1,un_bunker,248,213
+un_bunker,262,200,0	warp2	G-1#b_H-0	1,1,un_bunker,274,199
+un_bunker,271,200,0	warp2	H-0#b_G-1	1,1,un_bunker,258,199
+un_bunker,75,128,0	warp2	LA-0#b_LH-0	1,1,un_bunker,276,196
+un_bunker,275,191,0	warp2	LH-0#b_LA-0	1,1,un_bunker,76,121
+un_bunker,119,128,0	warp2	RA-0#b_RH-0	1,1,un_bunker,319,196
+un_bunker,320,191,0	warp2	RH-0#b_RA-0	1,1,un_bunker,120,121
+un_bunker,297,206,0	warp2	H-0#b_Clinic	1,1,un_bunker,298,224
+un_bunker,297,221,0	warp2	Clinic#b_H-0	1,1,un_bunker,298,203
+un_bunker,324,200,0	warp2	H-0#b_G-2	1,1,un_bunker,344,199
+un_bunker,339,200,0	warp2	G-2#b_H-0	1,1,un_bunker,321,199
+un_bunker,350,214,0	warp2	G-2#b_F-2	1,1,un_bunker,368,213
+un_bunker,365,214,0	warp2	F-2#b_G-2	1,1,un_bunker,347,213
+un_bunker,337,236,0	warp2	G-2#b_Clinic	1,1,un_bunker,323,235
+un_bunker,326,236,0	warp2	Clinic#b_G-2	1,1,un_bunker,340,235
+un_bunker,281,266,0	warp2	LClinic#b_LCafeteria	1,1,un_bunker,282,282
+un_bunker,281,279,0	warp2	LCafeteria#b_LClinic	1,1,un_bunker,282,263
+un_bunker,313,266,0	warp2	RClinic#b_RCafeteria	1,1,un_bunker,314,282
+un_bunker,313,279,0	warp2	RCafeteria#b_RClinic	1,1,un_bunker,314,262
+un_bunker,324,290,0	warp2	Cafeteria#b_G-2	1,1,un_bunker,340,261
+un_bunker,337,262,0	warp2	G-2#b_Cafeteria	1,1,un_bunker,321,289
+un_bunker,343,270,0	warp2	G-2#b_N-0	1,1,un_bunker,382,328
+un_bunker,381,325,0	warp2	N-0#b_G-2	1,1,un_bunker,344,267
+un_bunker,370,264,0	warp2	G-2#b_I-0	1,1,un_bunker,388,263
+un_bunker,385,264,0	warp2	I-0#b_G-2	1,1,un_bunker,367,263
+un_bunker,297,192,0	warp2	H-0#b_Z-0	1,1,un_bunker,298,181
+un_bunker,297,186,0	warp2	Z-0#b_H-0	1,1,un_bunker,298,196
+un_bunker,229,163,0	warp2	Z-0#b_Z-1	1,1,un_bunker,159,52
+un_bunker,164,51,0	warp2	Z-1#b_Z-0	1,1,un_bunker,233,164
+un_bunker,366,164,0	warp2	Z-0#b_Z-2	1,1,un_bunker,31,51
+un_bunker,27,52,0	warp2	Z-2#b_Z-0	1,1,un_bunker,361,163
 
 
 // Memory bunker
 // Memory bunker
-un_bk_q,69,118,0	warp2	A-0#L-1	1,1,un_bk_q,53,117
-un_bk_q,128,118,0	warp2	A-0#L-2	1,1,un_bk_q,144,117
-un_bk_q,97,124,0	warp2	A-0#Monitoring room	1,1,un_bk_q,100,144
-un_bk_q,40,135,0	warp2	B-1#L-1	1,1,un_bk_q,50,134
-un_bk_q,71,236,0	warp2	Control room#L-1	1,1,un_bk_q,57,182
-un_bk_q,124,236,0	warp2	Control room#L-2	1,1,un_bk_q,140,184
-un_bk_q,216,280,0	warp2	C-0#G-1	1,1,un_bk_q,220,261
-un_bk_q,21,375,0	warp2	D-1#L-1	1,1,un_bk_q,32,193
-un_bk_q,67,375,0	warp2	D-2#L-1	1,1,un_bk_q,52,193
-un_bk_q,105,375,0	warp2	E-1#L-2	1,1,un_bk_q,148,193
-un_bk_q,151,375,0	warp2	E-2#L-2	1,1,un_bk_q,168,193
-un_bk_q,230,214,0	warp2	F-1#G-1	1,1,un_bk_q,248,213
-un_bk_q,365,214,0	warp2	F-2#G-2	1,1,un_bk_q,347,213
-un_bk_q,258,262,0	warp2	G-1#Cafeteria	1,1,un_bk_q,274,289
-un_bk_q,217,262,0	warp2	G-1#C-0	1,1,un_bk_q,213,279
-un_bk_q,245,214,0	warp2	G-1#F-1	1,1,un_bk_q,226,213
-un_bk_q,262,200,0	warp2	G-1#H-0	1,1,un_bk_q,274,199
-un_bk_q,249,268,0	warp2	G-1#M-0	1,1,un_bk_q,390,380
-un_bk_q,350,214,0	warp2	G-2#F-2	1,1,un_bk_q,368,213
-un_bk_q,324,200,0	warp2	G-2#H-0	1,1,un_bk_q,344,199
-un_bk_q,370,264,0	warp2	G-2#I-0	1,1,un_bk_q,388,263
-un_bk_q,343,270,0	warp2	G-2#N-0	1,1,un_bk_q,382,328
-un_bk_q,337,262,0	warp2	H-0#Cafeteria	1,1,un_bk_q,321,289
-un_bk_q,271,200,0	warp2	H-0#G-1	1,1,un_bk_q,258,199
-un_bk_q,339,200,0	warp2	H-0#G-2	1,1,un_bk_q,321,199
-un_bk_q,297,192,0	warp2	H-0#Z-0	1,1,un_bk_q,298,181
-un_bk_q,385,264,0	warp2	I-0#G-2	1,1,un_bk_q,367,263
-un_bk_q,24,256,0	warp2	J-0#L-1	1,1,un_bk_q,26,190
-un_bk_q,24,276,0	warp2	J-0#Machine Warehouse	1,1,un_bk_q,45,275
-un_bk_q,169,230,0	warp2	K-0#L-2	1,1,un_bk_q,171,189
-un_bk_q,60,183,0	warp2	L-1#Control room	1,1,un_bk_q,75,235
-un_bk_q,60,169,0	warp2	L-1#Monitoring room	1,1,un_bk_q,72,168
-un_bk_q,137,168,0	warp2	L-2#Monitoring room	1,1,un_bk_q,122,167
-un_bk_q,57,118,0	warp2	L-1#A-0	1,1,un_bk_q,72,117
-un_bk_q,47,135,0	warp2	L-1#B-1	1,1,un_bk_q,37,134
-un_bk_q,31,196,0	warp2	L-1#D-1	1,1,un_bk_q,22,378
-un_bk_q,51,196,0	warp2	L-1#D-2	1,1,un_bk_q,68,378
-un_bk_q,23,190,0	warp2	L-1#J-0	1,1,un_bk_q,21,256
-un_bk_q,137,185,0	warp2	L-2#Control room	1,1,un_bk_q,120,235
-un_bk_q,140,118,0	warp2	L-2#A-0	1,1,un_bk_q,125,117
-un_bk_q,147,196,0	warp2	L-2#E-1	1,1,un_bk_q,106,378
-un_bk_q,167,196,0	warp2	L-2#E-2	1,1,un_bk_q,152,378
-un_bk_q,174,190,0	warp2	L-2#K-0	1,1,un_bk_q,172,229
-un_bk_q,389,377,0	warp2	M-0#G-1	1,1,un_bk_q,250,265
-un_bk_q,381,325,0	warp2	N-0#G-2	1,1,un_bk_q,344,267
-un_bk_q,297,186,0	warp2	Z-0#H-0	1,1,un_bk_q,298,196
-un_bk_q,164,51,0	warp2	Z-1#Z-0	1,1,un_bk_q,233,164
-un_bk_q,27,52,0	warp2	Z-2#Z-0	1,1,un_bk_q,361,163
-un_bk_q,229,163,0	warp2	Z-0#Z-1	1,1,un_bk_q,159,52
-un_bk_q,366,164,0	warp2	Z-0#Z-2	1,1,un_bk_q,31,51
-un_bk_q,75,128,0	warp2	LA-0#LH-0	1,1,un_bk_q,276,196
-un_bk_q,275,191,0	warp2	LH-0#LA-0	1,1,un_bk_q,76,121
-un_bk_q,119,128,0	warp2	RA-0#RH-0	1,1,un_bk_q,319,196
-un_bk_q,320,191,0	warp2	RH-0#RA-0	1,1,un_bk_q,120,121
+un_bk_q,41,275,0	script	Machine Warehouse#J-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	if (.@cooldown_status_day[0] == 0 && .@cooldown_status_day[1] == 0 && .@cooldown_status_day[2] == 0 && .@cooldown_status_day[3] == 0 && .@cooldown_status_day[4] == 0) {
+		emotion 24, getnpcid(0, "Mechanician Mugeosi#EP15.2MR");
+		mes "[Mechanician Mugeosi]";
+		mes "Ah! You're the adventurer send to deliver air cleaners. You are at the right place. Come this way.";
+		close;
+	}
+	warp "un_bk_q",21,276;
+	end;
+}
+
+un_bk_q,24,276,0	script	J-0#Machine Warehouse	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",45,275;
+	end;
+}
+
+un_bk_q,24,256,0	script	J-0#L-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",26,190;
+	end;
+}
+
+un_bk_q,23,190,0	script	L-1#J-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",21,256;
+	end;
+}
+
+un_bk_q,31,196,0	script	L-1#D-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",22,378;
+	end;
+}
+
+un_bk_q,21,375,0	script	D-1#L-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",32,193;
+	end;
+}
+
+un_bk_q,51,196,0	script	L-1#D-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",68,378;
+	end;
+}
+
+un_bk_q,67,375,0	script	D-2#L-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",52,193;
+	end;
+}
+
+un_bk_q,60,183,0	script	L-1#Control room	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",75,235;
+	end;
+}
+
+un_bk_q,71,236,0	script	Control room#L-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",57,182;
+	end;
+}
+
+un_bk_q,60,169,0	script	L-1#b_Monitoring room_	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",72,168;
+	end;
+}
+
+un_bk_q,69,167,0	script	b_Monitoring room#L-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	if (.@cooldown_status_day[0] == 0 && .@cooldown_status_day[1] == 0 && .@cooldown_status_day[2] == 0 && .@cooldown_status_day[3] == 0 && .@cooldown_status_day[4] == 0) {
+		mes "[Bunker Sayhu]";
+		mes "Hey!! Where do you think you're going when we're trying to get a headcount? Get over here.";
+		close;
+	}
+	warp "un_bk_q",57,168;
+	end;
+}
+
+un_bk_q,47,135,0	script	L-1#B-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",37,134;
+	end;
+}
+
+un_bk_q,40,135,0	script	B-1#L-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",50,134;
+	end;
+}
+
+un_bk_q,57,118,0	script	L-1#A-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",72,117;
+	end;
+}
+
+un_bk_q,69,118,0	script	A-0#L-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",53,117;
+	end;
+}
+
+un_bk_q,97,124,0	script	A-0#b_Monitoring room_	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",100,144;
+	end;
+}
+
+un_bk_q,97,141,0	script	Monitoring room#A-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	if (.@cooldown_status_day[0] == 0 && .@cooldown_status_day[1] == 0 && .@cooldown_status_day[2] == 0 && .@cooldown_status_day[3] == 0 && .@cooldown_status_day[4] == 0) {
+		mes "[Bunker Sayhu]";
+		mes "Hey!! Where do you think you're going when we're trying to get a headcount? Get over here.";
+		close;
+	}
+	warp "un_bk_q",98,121;
+	end;
+}
+
+un_bk_q,128,118,0	script	A-0#L-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",144,117;
+	end;
+}
+
+un_bk_q,140,118,0	script	L-2#A-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",125,117;
+	end;
+}
+
+un_bk_q,137,168,0	script	L-2#b_Monitoring room_	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",122,167;
+	end;
+}
+
+un_bk_q,126,168,0	script	b_Monitoring room#L-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	if (.@cooldown_status_day[0] == 0 && .@cooldown_status_day[1] == 0 && .@cooldown_status_day[2] == 0 && .@cooldown_status_day[3] == 0 && .@cooldown_status_day[4] == 0) {
+		emotion 19, getnpcid(0, "Bunker Sayhu#EP15.2MR");
+		mes "[Bunker Sayhu]";
+		mes "Hey!! Where do you think you're going when we're trying to get a headcount? Get over here.";
+		close;
+	}
+	warp "un_bk_q",140,167;
+	end;
+}
+
+un_bk_q,137,185,0	script	L-2#Control room	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",120,235;
+	end;
+}
+
+un_bk_q,124,236,0	script	Control room#L-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",140,184;
+	end;
+}
+
+un_bk_q,147,196,0	script	L-2#E-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",106,378;
+	end;
+}
+
+un_bk_q,105,375,0	script	E-1#L-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",148,193;
+	end;
+}
+
+un_bk_q,167,196,0	script	L-2#E-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",152,378;
+	end;
+}
+
+un_bk_q,151,375,0	script	E-2#L-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",168,193;
+	end;
+}
+
+un_bk_q,174,190,0	script	L-2#K-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",172,229;
+	end;
+}
+
+un_bk_q,169,230,0	script	K-0#L-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",171,189;
+	end;
+}
+
+un_bk_q,213,346,0	script	Farm#C-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	if (.@cooldown_status_day[0] == 0 && .@cooldown_status_day[1] == 0 && .@cooldown_status_day[2] == 0 && .@cooldown_status_day[3] == 0 && .@cooldown_status_day[4] == 0) {
+		emotion 14, getnpcid(0, "Bioengineer Ebrik#EP15.2MR");
+		mes "[Bioengineer Ebrik]";
+		mes "Are you the Adventurer here to help us with the grape harvest? Right here!!";
+		close;
+	}
+	warp "un_bk_q",213,299;
+	end;
+}
+
+un_bk_q,216,300,0	script	C-0#Farm	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	if ((isbegin_quest(5359) + isbegin_quest(5360) + isbegin_quest(5361) + isbegin_quest(5362)) != 1) {
+		mes "[Bioengineer Touring]";
+		mes "Wait a minute. You cannot enter the farm right now.";
+		close;
+	}
+	warp "un_bk_q",216,345;
+	end;
+}
+
+un_bk_q,216,280,0	script	C-0#G-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",220,261;
+	end;
+}
+
+un_bk_q,217,262,0	script	G-1#C-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",213,279;
+	end;
+}
+
+un_bk_q,249,268,0	script	G-1#M-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",390,380;
+	end;
+}
+
+un_bk_q,389,377,0	script	M-0#G-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",250,265;
+	end;
+}
+
+un_bk_q,258,262,0	script	G-1#Cafeteria	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",274,289;
+	end;
+}
+
+un_bk_q,271,290,0	script	Cafeteria#G-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	if (.@cooldown_status_day[0] == 0 && .@cooldown_status_day[1] == 0 && .@cooldown_status_day[2] == 0 && .@cooldown_status_day[3] == 0 && .@cooldown_status_day[4] == 0) {
+		emotion 6, getnpcid(0, "Transportation Executive Ernon#EP15.2MR");
+		mes "[Transportation Executive Ernon]";
+		mes "Hey~ This is a time to borrow even the hands of small children. Stop goofing around and come here.";
+		close;
+	}
+	warp "un_bk_q",255,261;
+	end;
+}
+
+un_bk_q,269,236,0	script	Clinic#G-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	if (.@cooldown_status_day[0] == 0 && .@cooldown_status_day[1] == 0 && .@cooldown_status_day[2] == 0 && .@cooldown_status_day[3] == 0 && .@cooldown_status_day[4] == 0) {
+		emotion 6, getnpcid(0, "Nurse Lapplad#EP15.2MR");
+		mes "[Nurse Lapplad]";
+		mes "Look here?! Where are you trying to go? We have to do some tests so don't leave and wait here!!";
+		close;
+	}
+	if ((isbegin_quest(5364) + isbegin_quest(5365)) == 1) {
+		emotion 6, getnpcid(0, "Nurse Lapplad#EP15.2MR");
+		mes "[Nurse Lapplad]";
+		mes "Hello? You have to deal with it before you can go? Where do you want to go!?";
+		close;
+	}
+	warp "un_bk_q",255,235;
+	end;
+}
+
+un_bk_q,245,214,0	script	G-1#F-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",226,213;
+	end;
+}
+
+un_bk_q,230,214,0	script	F-1#G-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",248,213;
+	end;
+}
+
+un_bk_q,262,200,0	script	G-1#H-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",274,199;
+	end;
+}
+
+un_bk_q,271,200,0	script	H-0#G-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",258,199;
+	end;
+}
+
+un_bk_q,75,128,0	script	LeftA-0#LeftH-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",276,196;
+	end;
+}
+
+un_bk_q,275,191,0	script	LeftH-0#LeftA-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",76,121;
+	end;
+}
+
+un_bk_q,119,128,0	script	RightA-0#RightH-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",319,196;
+	end;
+}
+
+un_bk_q,320,191,0	script	RightH-0#RightA-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",120,121;
+	end;
+}
+
+un_bk_q,297,221,0	script	Clinic#H-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	if (.@cooldown_status_day[0] == 0 && .@cooldown_status_day[1] == 0 && .@cooldown_status_day[2] == 0 && .@cooldown_status_day[3] == 0 && .@cooldown_status_day[4] == 0) {
+		emotion 6, getnpcid(0, "Nurse Lapplad#EP15.2MR");
+		mes "[Nurse Lapplad]";
+		mes "Look here?! Where are you trying to go? We have to do some tests so don't leave and wait here!!";
+		close;
+	}
+	if ((isbegin_quest(5364) + isbegin_quest(5365)) == 1) {
+		emotion 6, getnpcid(0, "Nurse Lapplad#EP15.2MR");
+		mes "[Nurse Lapplad]";
+		mes "Hello? You have to deal with it before you can go? Where do you want to go!?";
+		close;
+	}
+	warp "un_bk_q",298,203;
+	end;
+}
+
+un_bk_q,324,200,0	script	H-0#G-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",344,199;
+	end;
+}
+
+un_bk_q,339,200,0	script	G-2#H-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",321,199;
+	end;
+}
+
+un_bk_q,350,214,0	script	G-2#F-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",368,213;
+	end;
+}
+
+un_bk_q,365,214,0	script	F-2#G-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",347,213;
+	end;
+}
+
+un_bk_q,326,236,0	script	Clinic#G-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	if (.@cooldown_status_day[0] == 0 && .@cooldown_status_day[1] == 0 && .@cooldown_status_day[2] == 0 && .@cooldown_status_day[3] == 0 && .@cooldown_status_day[4] == 0) {
+		emotion 6, getnpcid(0, "Nurse Lapplad#EP15.2MR");
+		mes "[Nurse Lapplad]";
+		mes "Look here?! Where are you trying to go? We have to do some tests so don't leave and wait here!!";
+		close;
+	}
+	if ((isbegin_quest(5364) + isbegin_quest(5365)) == 1) {
+		emotion 6, getnpcid(0, "Nurse Lapplad#EP15.2MR");
+		mes "[Nurse Lapplad]";
+		mes "Hello? You have to deal with it before you can go? Where do you want to go!?";
+		close;
+	}
+	warp "un_bk_q",340,235;
+	end;
+}
+
+un_bk_q,324,290,0	script	Cafeteria#G-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	if (.@cooldown_status_day[0] == 0 && .@cooldown_status_day[1] == 0 && .@cooldown_status_day[2] == 0 && .@cooldown_status_day[3] == 0 && .@cooldown_status_day[4] == 0) {
+		emotion 6, getnpcid(0, "Transportation Executive Ernon#EP15.2MR");
+		mes "[Transportation Executive Ernon]";
+		mes "Hey~ This is a time to borrow even the hands of small children. Stop goofing around and come here.";
+		close;
+	}
+	warp "un_bk_q",340,261;
+	end;
+}
+
+un_bk_q,337,262,0	script	G-2#Cafeteria	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",321,289;
+	end;
+}
+
+un_bk_q,343,270,0	script	G-2#N-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",382,328;
+	end;
+}
+
+un_bk_q,381,325,0	script	N-0#G-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",344,267;
+	end;
+}
+
+un_bk_q,370,264,0	script	G-2#I-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",388,263;
+	end;
+}
+
+un_bk_q,385,264,0	script	I-0#G-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",367,263;
+	end;
+}
+
+un_bk_q,297,192,0	script	H-0#Z-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",298,181;
+	end;
+}
+
+un_bk_q,297,186,0	script	Z-0#H-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",298,196;
+	end;
+}
+
+un_bk_q,229,163,0	script	Z-0#Z-1	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",159,52;
+	end;
+}
+
+un_bk_q,164,51,0	script	Z-1#Z-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",233,164;
+	end;
+}
+
+un_bk_q,366,164,0	script	Z-0#Z-2	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",31,51;
+	end;
+}
+
+un_bk_q,27,52,0	script	Z-2#Z-0	WARPNPC,1,1,{
+	end;
+OnTouch:
+	callfunc( "F_time_limit_recorder", .@cooldown_status_day );
+	warp "un_bk_q",361,163;
+	end;
+}

+ 1 - 1
sql-files/item_cash_db.sql

@@ -1,7 +1,7 @@
 DROP TABLE IF EXISTS `item_cash_db`;
 DROP TABLE IF EXISTS `item_cash_db`;
 CREATE TABLE `item_cash_db` (
 CREATE TABLE `item_cash_db` (
   `tab` smallint(6) NOT NULL,
   `tab` smallint(6) NOT NULL,
-  `item_id` smallint(5) unsigned NOT NULL,
+  `item_id` int(10) unsigned NOT NULL,
   `price` mediumint(10) unsigned NOT NULL DEFAULT '0',
   `price` mediumint(10) unsigned NOT NULL DEFAULT '0',
   PRIMARY KEY (`tab`,`item_id`)
   PRIMARY KEY (`tab`,`item_id`)
 ) ENGINE=MyISAM;
 ) ENGINE=MyISAM;

+ 1 - 1
sql-files/item_cash_db2.sql

@@ -1,7 +1,7 @@
 DROP TABLE IF EXISTS `item_cash_db2`;
 DROP TABLE IF EXISTS `item_cash_db2`;
 CREATE TABLE `item_cash_db2` (
 CREATE TABLE `item_cash_db2` (
   `tab` smallint(6) NOT NULL,
   `tab` smallint(6) NOT NULL,
-  `item_id` smallint(5) unsigned NOT NULL,
+  `item_id` int(10) unsigned NOT NULL,
   `price` mediumint(10) unsigned NOT NULL DEFAULT '0',
   `price` mediumint(10) unsigned NOT NULL DEFAULT '0',
   PRIMARY KEY (`tab`,`item_id`)
   PRIMARY KEY (`tab`,`item_id`)
 ) ENGINE=MyISAM;
 ) ENGINE=MyISAM;

+ 1 - 1
sql-files/item_db.sql

@@ -4,7 +4,7 @@
 
 
 DROP TABLE IF EXISTS `item_db`;
 DROP TABLE IF EXISTS `item_db`;
 CREATE TABLE `item_db` (
 CREATE TABLE `item_db` (
-  `id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `id` int(10) unsigned NOT NULL DEFAULT '0',
   `name_english` varchar(50) NOT NULL DEFAULT '',
   `name_english` varchar(50) NOT NULL DEFAULT '',
   `name_japanese` varchar(50) NOT NULL DEFAULT '',
   `name_japanese` varchar(50) NOT NULL DEFAULT '',
   `type` tinyint(2) unsigned NOT NULL DEFAULT '0',
   `type` tinyint(2) unsigned NOT NULL DEFAULT '0',

+ 1 - 1
sql-files/item_db2.sql

@@ -4,7 +4,7 @@
 
 
 DROP TABLE IF EXISTS `item_db2`;
 DROP TABLE IF EXISTS `item_db2`;
 CREATE TABLE `item_db2` (
 CREATE TABLE `item_db2` (
-  `id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `id` int(10) unsigned NOT NULL DEFAULT '0',
   `name_english` varchar(50) NOT NULL DEFAULT '',
   `name_english` varchar(50) NOT NULL DEFAULT '',
   `name_japanese` varchar(50) NOT NULL DEFAULT '',
   `name_japanese` varchar(50) NOT NULL DEFAULT '',
   `type` tinyint(2) unsigned NOT NULL DEFAULT '0',
   `type` tinyint(2) unsigned NOT NULL DEFAULT '0',

+ 1 - 1
sql-files/item_db2_re.sql

@@ -4,7 +4,7 @@
 
 
 DROP TABLE IF EXISTS `item_db2_re`;
 DROP TABLE IF EXISTS `item_db2_re`;
 CREATE TABLE `item_db2_re` (
 CREATE TABLE `item_db2_re` (
-  `id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `id` int(10) unsigned NOT NULL DEFAULT '0',
   `name_english` varchar(50) NOT NULL DEFAULT '',
   `name_english` varchar(50) NOT NULL DEFAULT '',
   `name_japanese` varchar(50) NOT NULL DEFAULT '',
   `name_japanese` varchar(50) NOT NULL DEFAULT '',
   `type` tinyint(2) unsigned NOT NULL DEFAULT '0',
   `type` tinyint(2) unsigned NOT NULL DEFAULT '0',

+ 54 - 39
sql-files/item_db_re.sql

@@ -4,7 +4,7 @@
 
 
 DROP TABLE IF EXISTS `item_db_re`;
 DROP TABLE IF EXISTS `item_db_re`;
 CREATE TABLE `item_db_re` (
 CREATE TABLE `item_db_re` (
-  `id` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `id` int(10) unsigned NOT NULL DEFAULT '0',
   `name_english` varchar(50) NOT NULL DEFAULT '',
   `name_english` varchar(50) NOT NULL DEFAULT '',
   `name_japanese` varchar(50) NOT NULL DEFAULT '',
   `name_japanese` varchar(50) NOT NULL DEFAULT '',
   `type` tinyint(2) unsigned NOT NULL DEFAULT '0',
   `type` tinyint(2) unsigned NOT NULL DEFAULT '0',
@@ -4321,23 +4321,23 @@ REPLACE INTO `item_db_re` VALUES (6185,'Alice_Ticket','Alice Exchange Ticket',3,
 REPLACE INTO `item_db_re` VALUES (6186,'Monkey_Wrench','Monkey Wrench',3,500,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6186,'Monkey_Wrench','Monkey Wrench',3,500,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6187,'Blank_Card','Blank Card',3,20,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6187,'Blank_Card','Blank Card',3,20,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6188,'Slot_Coupon','Slotting Advertisement',3,20,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6188,'Slot_Coupon','Slotting Advertisement',3,20,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6189,'Magic_Book_FB','Spell Book (Fire Bolt)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6190,'Magic_Book_CB','Spell Book (Cold Bolt)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6191,'Magic_Book_LB','Spell Book (Lightening Bolt)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6192,'Magic_Book_SG','Spell Book (Storm Gust)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6193,'Magic_Book_LOV','Spell Book (Lord Of Vermilion)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6194,'Magic_Book_MS','Spell Book (Meteor Storm)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6195,'Magic_Book_CM','Spell Book (Comet)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6196,'Magic_Book_TV','Spell Book (Tetra Vortex)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6197,'Magic_Book_TS','Spell Book (Thunder Storm)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6198,'Magic_Book_JT','Spell Book (Jupitel Thunder)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6199,'Magic_Book_WB','Spell Book (Water Ball)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6200,'Magic_Book_HD','Spell Book (Heaven\'s Drive)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6201,'Magic_Book_ES','Spell Book (Earth Spike)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6202,'Magic_Book_ES_','Spell Book (Earth Strain)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6203,'Magic_Book_CL','Spell Book (Chain Lightning)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6204,'Magic_Book_CR','Spell Book (Crimson Rock)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6205,'Magic_Book_DL','Spell Book (Drain Life)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6189,'Magic_Book_FB','Old Spell Book (Fire Bolt)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6190,'Magic_Book_CB','Old Spell Book (Cold Bolt)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6191,'Magic_Book_LB','Old Spell Book (Lightening Bolt)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6192,'Magic_Book_SG','Old Spell Book (Storm Gust)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6193,'Magic_Book_LOV','Old Spell Book (Lord Of Vermilion)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6194,'Magic_Book_MS','Old Spell Book (Meteor Storm)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6195,'Magic_Book_CM','Old Spell Book (Comet)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6196,'Magic_Book_TV','Old Spell Book (Tetra Vortex)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6197,'Magic_Book_TS','Old Spell Book (Thunder Storm)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6198,'Magic_Book_JT','Old Spell Book (Jupitel Thunder)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6199,'Magic_Book_WB','Old Spell Book (Water Ball)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6200,'Magic_Book_HD','Old Spell Book (Heaven\'s Drive)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6201,'Magic_Book_ES','Old Spell Book (Earth Spike)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6202,'Magic_Book_ES_','Old Spell Book (Earth Strain)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6203,'Magic_Book_CL','Old Spell Book (Chain Lightning)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6204,'Magic_Book_CR','Old Spell Book (Crimson Rock)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6205,'Magic_Book_DL','Old Spell Book (Drain Life)',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6206,'I_Love_You','I Love You',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6206,'I_Love_You','I Love You',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6207,'Thank_You','Thank You',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6207,'Thank_You','Thank You',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6208,'I_Respect_You','I Respect You',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6208,'I_Respect_You','I Respect You',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
@@ -4824,16 +4824,16 @@ REPLACE INTO `item_db_re` VALUES (6744,'SPStone_Middle','SP Stone (Middle)',6,10
 REPLACE INTO `item_db_re` VALUES (6745,'HealStone_Bottom','Recovery Stone (Low)',6,20,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6745,'HealStone_Bottom','Recovery Stone (Low)',6,20,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6746,'Iron_Artifacts','Steel Artifact',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6746,'Iron_Artifacts','Steel Artifact',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6747,'Iron_Artifacts_','Steel Artifact',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6747,'Iron_Artifacts_','Steel Artifact',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6748,'Daily_Report_He_And_His_Team','Daily Report He And His Team',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6749,'Operation_Control_Device','Operation Control Device',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6748,'Excavator_Repoet','Daily Report He And His Team',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6749,'Power_Control_Device','Operation Control Device',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6750,'Failed_Engine','Failed Engine',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6750,'Failed_Engine','Failed Engine',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6751,'Crushed_Can_Iron_Plate','Crushed Can Iron Plate',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6751,'Crushed_Can_Iron_Plate','Crushed Can Iron Plate',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6752,'Charleston_Parts','Charleston Parts',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6752,'Charleston_Parts','Charleston Parts',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6753,'Token_Of_Destruction','Token Of Destruction',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6754,'Collected_Medicinal_Herbs','Collected Medicinal Herbs',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6753,'Sign_Of_Destruction','Token Of Destruction',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6754,'Collected_Herb','Collected Medicinal Herbs',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6755,'Contaminated_Magic','Contaminated Magic',3,20,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6755,'Contaminated_Magic','Contaminated Magic',3,20,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6756,'Cohesive_Energy','Cohesive Energy',3,20,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6757,'The_Memory_Recorder','The Memory Recorder',3,20,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6756,'Condensed_Energy','Cohesive Energy',3,20,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6757,'Memory_Record','The Memory Recorder',3,20,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 
 
 REPLACE INTO `item_db_re` VALUES (6762,'Banana_Can','Banana Can',3,0,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6762,'Banana_Can','Banana Can',3,0,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6763,'Spicy_Rice_Cake','Spicy Rice Cake',3,0,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6763,'Spicy_Rice_Cake','Spicy Rice Cake',3,0,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
@@ -4880,11 +4880,11 @@ REPLACE INTO `item_db_re` VALUES (6818,'Archer_Soul','Archer Soul',3,10,NULL,10,
 REPLACE INTO `item_db_re` VALUES (6819,'Acolyte_Soul','Acolyte Soul',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6819,'Acolyte_Soul','Acolyte Soul',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6820,'Particles_Of_Energy','Energy Fragment',3,0,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6820,'Particles_Of_Energy','Energy Fragment',3,0,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6821,'Solo_Troops_Badge','Single Union Badge',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6821,'Solo_Troops_Badge','Single Union Badge',3,0,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6824,'Experimental_Dong_Memory_Record','Experimental Dong Memory Record',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6824,'Lab_Memory_Record','Experimental Dong Memory Record',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6825,'Air_Cleaner_Box','Air Cleaner Box',3,10,NULL,10000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6825,'Air_Cleaner_Box','Air Cleaner Box',3,10,NULL,10000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6826,'Fresh_Grapes','Fresh Grapes',3,10,NULL,100,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6826,'Fresh_Grapes','Fresh Grapes',3,10,NULL,100,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6827,'Complete_Machine_Parts','Complete Machine Parts',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (6828,'Gravity_Safety_Device','Gravity Safety Device',3,10,NULL,100,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6827,'Normal_Parts','Complete Machine Parts',3,10,NULL,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (6828,'Gravity_Parts','Gravity Safety Device',3,10,NULL,100,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6832,'Questioned_Parts','Questioned Parts',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6832,'Questioned_Parts','Questioned Parts',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6833,'Limited_Token_of_Ziegfried','(Limited) Token of Ziegfried',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6833,'Limited_Token_of_Ziegfried','(Limited) Token of Ziegfried',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6834,'Legendary_Fur','Legendary Fur',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (6834,'Legendary_Fur','Legendary Fur',3,10,NULL,10,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
@@ -11517,11 +11517,11 @@ REPLACE INTO `item_db_re` VALUES (22679,'Chest_Of_Death','Death\'s Chest',2,0,NU
 REPLACE INTO `item_db_re` VALUES (22685,'Solo_Christmas_Gift','Single Union Christmas Gift',2,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'0',NULL,NULL,'getgroupitem(IG_Solo_Christmas_Gift);',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22685,'Solo_Christmas_Gift','Single Union Christmas Gift',2,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'0',NULL,NULL,'getgroupitem(IG_Solo_Christmas_Gift);',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22686,'Solo_Cookie','Single Cookie',0,0,NULL,50,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'0',NULL,NULL,'percentheal 5,5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22686,'Solo_Cookie','Single Cookie',0,0,NULL,50,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'0',NULL,NULL,'percentheal 5,5;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22687,'Pieces_Of_Sentiment','Sentimental Fragment',11,0,NULL,1,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,NULL,NULL,'100',NULL,NULL,'callfunc("F_Pieces_Of_Sentiment");',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22687,'Pieces_Of_Sentiment','Sentimental Fragment',11,0,NULL,1,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,NULL,NULL,'100',NULL,NULL,'callfunc("F_Pieces_Of_Sentiment");',NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (22691,'Record_Fragment1','Record Fragment',0,NULL,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'warp "un_bk_q",98,143; if (callfunc("F_time_limit_recorder") == 1) { recorder_quest_type = 1; }',NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (22692,'Record_Fragment2','Record Fragment',0,NULL,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'warp "un_bk_q",45,276; if (callfunc("F_time_limit_recorder") == 1) { recorder_quest_type = 2; }',NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (22693,'Record_Fragment3','Record Fragment',0,NULL,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'warp "un_bk_q",217,346; if (callfunc("F_time_limit_recorder") == 1) { recorder_quest_type = 3; }',NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (22694,'Record_Fragment4','Record Fragment',0,NULL,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'warp "un_bk_q",273,235; if (callfunc("F_time_limit_recorder") == 1) { recorder_quest_type = 4; }',NULL,NULL);
-REPLACE INTO `item_db_re` VALUES (22695,'Record_Fragment5','Record Fragment',0,NULL,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'warp "un_bk_q",275,290; if (callfunc("F_time_limit_recorder") == 1) { recorder_quest_type = 5; }',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (22691,'Piece_Of_Record1','Record Fragment',0,NULL,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'warp "un_bk_q",98,143;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (22692,'Piece_Of_Record2','Record Fragment',0,NULL,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'warp "un_bk_q",45,276;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (22693,'Piece_Of_Record3','Record Fragment',0,NULL,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'warp "un_bk_q",217,346;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (22694,'Piece_Of_Record4','Record Fragment',0,NULL,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'warp "un_bk_q",273,235;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (22695,'Piece_Of_Record5','Record Fragment',0,NULL,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'warp "un_bk_q",275,290;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22699,'Test_Reagent','Test Reagent',2,NULL,NULL,30,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'bonus_script "bonus bFlee,100;",5,9; sc_start SC_BLIND,5000,0,10000,0;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22699,'Test_Reagent','Test Reagent',2,NULL,NULL,30,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'bonus_script "bonus bFlee,100;",5,9; sc_start SC_BLIND,5000,0,10000,0;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22700,'Jumping_Support_Box','Jumping Support Box',18,10,NULL,0,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'/*TODO: getitem 12529,1; getitem 12323,200; getitem 12324,50; and 5 boxes that containing quivers + oridecons*/',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22700,'Jumping_Support_Box','Jumping Support Box',18,10,NULL,0,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'/*TODO: getitem 12529,1; getitem 12323,200; getitem 12324,50; and 5 boxes that containing quivers + oridecons*/',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22702,'STR_Soul_Potion','STR Reduction Potion',11,10,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'callfunc "F_CashReduceStat",bStr,-1,22702;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (22702,'STR_Soul_Potion','STR Reduction Potion',11,10,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'callfunc "F_CashReduceStat",bStr,-1,22702;',NULL,NULL);
@@ -13700,16 +13700,31 @@ REPLACE INTO `item_db_re` VALUES (32350,'Farthezan','Farthezan',5,20,NULL,1100,'
 REPLACE INTO `item_db_re` VALUES (32351,'Estal','Estal',5,20,NULL,700,'195',NULL,1,2,0x00040000,56,2,2,4,'170',1,2,'.@r = getrefine(); bonus2 bSkillCooldown,"GN_SPORE_EXPLOSION",-1000; bonus bBaseAtk,4*.@r; if (.@r>=11) .@val = 50; else if (.@r>=9) .@val = 30; bonus2 bSkillAtk,"GN_SPORE_EXPLOSION",.@val;',NULL,NULL);
 REPLACE INTO `item_db_re` VALUES (32351,'Estal','Estal',5,20,NULL,700,'195',NULL,1,2,0x00040000,56,2,2,4,'170',1,2,'.@r = getrefine(); bonus2 bSkillCooldown,"GN_SPORE_EXPLOSION",-1000; bonus bBaseAtk,4*.@r; if (.@r>=11) .@val = 50; else if (.@r>=9) .@val = 30; bonus2 bSkillAtk,"GN_SPORE_EXPLOSION",.@val;',NULL,NULL);
 
 
 #REPLACE INTO `item_db_re` VALUES (100052,'Enchant_Stone_Box19','Costume Enchantment Stone Box 19',2,10,NULL,10,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,NULL,NULL,'1',NULL,NULL,'getgroupitem(IG_Enchant_Stone_Box19);',NULL,NULL);
 #REPLACE INTO `item_db_re` VALUES (100052,'Enchant_Stone_Box19','Costume Enchantment Stone Box 19',2,10,NULL,10,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,NULL,NULL,'1',NULL,NULL,'getgroupitem(IG_Enchant_Stone_Box19);',NULL,NULL);
+
+#===================================================================
+# New Warlock Spell Books
+#===================================================================
+REPLACE INTO `item_db_re` VALUES (100065,'WL_MB_SG','Spell Book (Storm Gust)',11,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'itemskill "WL_READING_SB_READING",1;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100066,'WL_MB_LOV','Spell Book (Lord of Vermilion)',11,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'itemskill "WL_READING_SB_READING",2;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100067,'WL_MB_MS','Spell Book (Meteor Storm)',11,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'itemskill "WL_READING_SB_READING",3;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100068,'WL_MB_DL','Spell Book (Drain Life)',11,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'itemskill "WL_READING_SB_READING",4;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100069,'WL_MB_JF','Spell Book (Jack Frost)',11,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'itemskill "WL_READING_SB_READING",5;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100070,'WL_MB_ES','Spell Book (Earth Strain)',11,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'itemskill "WL_READING_SB_READING",6;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100071,'WL_MB_CR','Spell Book (Crimson Rock)',11,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'itemskill "WL_READING_SB_READING",7;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100072,'WL_MB_CL','Spell Book (Chain Lightning)',11,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'itemskill "WL_READING_SB_READING",8;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100073,'WL_MB_CM','Spell Book (Comet)',11,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'itemskill "WL_READING_SB_READING",9;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100074,'WL_MB_TV','Spell Book (Tetra Vortex)',11,0,NULL,0,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'itemskill "WL_READING_SB_READING",10;',NULL,NULL);
+
 #REPLACE INTO `item_db_re` VALUES (100202,'Enchant_Stone_Box20','Costume Enchantment Stone Box 20',2,10,NULL,10,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,NULL,NULL,'1',NULL,NULL,'getgroupitem(IG_Enchant_Stone_Box20);',NULL,NULL);
 #REPLACE INTO `item_db_re` VALUES (100202,'Enchant_Stone_Box20','Costume Enchantment Stone Box 20',2,10,NULL,10,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,NULL,NULL,'1',NULL,NULL,'getgroupitem(IG_Enchant_Stone_Box20);',NULL,NULL);
-#REPLACE INTO `item_db_re` VALUES (100231,'Ref_T_Potion','Golden X',0,10,NULL,30,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_REF_T_POTION,30000,0;',NULL,NULL);
-#REPLACE INTO `item_db_re` VALUES (100232,'Add_Atk_Potion','Red Herb Activator',0,10,NULL,30,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_ADD_ATK_DAMAGE,500000,15;',NULL,NULL);
-#REPLACE INTO `item_db_re` VALUES (100233,'Add_Matk_Potion','Blue Herb Activator',0,10,NULL,30,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_ADD_MATK_DAMAGE,500000,15;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100231,'Ref_T_Potion','Golden X',0,10,NULL,30,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_REF_T_POTION,30000,0;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100232,'Add_Atk_Potion','Red Herb Activator',0,10,NULL,30,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_ADD_ATK_DAMAGE,500000,15;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (100233,'Add_Matk_Potion','Blue Herb Activator',0,10,NULL,30,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,NULL,NULL,NULL,'sc_start SC_ADD_MATK_DAMAGE,500000,15;',NULL,NULL);
 #REPLACE INTO `item_db_re` VALUES (100314,'Enchant_Stone_Box21','Costume Enchantment Stone Box 21',2,10,NULL,10,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,NULL,NULL,'1',NULL,NULL,'getgroupitem(IG_Enchant_Stone_Box21);',NULL,NULL);
 #REPLACE INTO `item_db_re` VALUES (100314,'Enchant_Stone_Box21','Costume Enchantment Stone Box 21',2,10,NULL,10,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,NULL,NULL,'1',NULL,NULL,'getgroupitem(IG_Enchant_Stone_Box21);',NULL,NULL);
 # Costumes
 # Costumes
+#REPLACE INTO `item_db_re` VALUES (400020,'C_BeachBall','Costume Beachball',4,0,NULL,0,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'1',0,1918,NULL,NULL,NULL);
 #REPLACE INTO `item_db_re` VALUES (440000,'C_SharkHead','Costume Shark Hat',4,0,NULL,0,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,5120,NULL,'1',0,1919,NULL,NULL,NULL);
 #REPLACE INTO `item_db_re` VALUES (440000,'C_SharkHead','Costume Shark Hat',4,0,NULL,0,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,5120,NULL,'1',0,1919,NULL,NULL,NULL);
 #REPLACE INTO `item_db_re` VALUES (440002,'C_Happy_Cat_TW','Costume Happy Cat',4,0,NULL,0,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,7168,NULL,'1',0,1980,NULL,NULL,NULL);
 #REPLACE INTO `item_db_re` VALUES (440002,'C_Happy_Cat_TW','Costume Happy Cat',4,0,NULL,0,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,7168,NULL,'1',0,1980,NULL,NULL,NULL);
-#REPLACE INTO `item_db_re` VALUES (400020,'C_BeachBall','Costume Beachball',4,0,NULL,0,NULL,NULL,NULL,0,0xFFFFFFFF,63,2,1024,NULL,'1',0,1918,NULL,NULL,NULL);
-#REPLACE INTO `item_db_re` VALUES (1100003,'Concentrated_R_P','Concentrated Red Potion',0,10,NULL,2,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'120',NULL,NULL,'itemheal rand(655,675),0;',NULL,NULL);
-#REPLACE INTO `item_db_re` VALUES (1100004,'Concentrated_B_P','Concentrated Blue Potion',0,10,NULL,2,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'120',NULL,NULL,'itemheal 0,rand(340,360);',NULL,NULL);
-#REPLACE INTO `item_db_re` VALUES (1100005,'Concentrated_G_P','Concentrated Gold Potion',0,10,NULL,2,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'180',NULL,NULL,'itemheal rand(2730,2750),0;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (1100003,'Concentrated_R_P','Concentrated Red Potion',0,10,NULL,2,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'120',NULL,NULL,'itemheal rand(655,675),0;',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (1100004,'Concentrated_B_P','Concentrated Blue Potion',0,10,NULL,2,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'120',NULL,NULL,'itemheal 0,rand(340,360);',NULL,NULL);
+REPLACE INTO `item_db_re` VALUES (1100005,'Concentrated_G_P','Concentrated Gold Potion',0,10,NULL,2,NULL,NULL,NULL,NULL,0xFFFFFFFF,63,2,NULL,NULL,'180',NULL,NULL,'itemheal rand(2730,2750),0;',NULL,NULL);
 
 

+ 7 - 7
sql-files/logs.sql

@@ -87,7 +87,7 @@ CREATE TABLE IF NOT EXISTS `feedinglog` (
   `target_class` SMALLINT(11) NOT NULL,
   `target_class` SMALLINT(11) NOT NULL,
   `type` ENUM('P','H','O') NOT NULL, -- P: Pet, H: Homunculus, O: Other
   `type` ENUM('P','H','O') NOT NULL, -- P: Pet, H: Homunculus, O: Other
   `intimacy` INT(11) UNSIGNED NOT NULL,
   `intimacy` INT(11) UNSIGNED NOT NULL,
-  `item_id` SMALLINT(5) UNSIGNED NOT NULL,
+  `item_id` int(10) UNSIGNED NOT NULL,
   `map` VARCHAR(11) NOT NULL,
   `map` VARCHAR(11) NOT NULL,
   `x` SMALLINT(5) UNSIGNED NOT NULL,
   `x` SMALLINT(5) UNSIGNED NOT NULL,
   `y` SMALLINT(5) UNSIGNED NOT NULL,
   `y` SMALLINT(5) UNSIGNED NOT NULL,
@@ -116,7 +116,7 @@ CREATE TABLE IF NOT EXISTS `mvplog` (
   `mvp_date` datetime NOT NULL,
   `mvp_date` datetime NOT NULL,
   `kill_char_id` int(11) NOT NULL default '0',
   `kill_char_id` int(11) NOT NULL default '0',
   `monster_id` smallint(6) NOT NULL default '0',
   `monster_id` smallint(6) NOT NULL default '0',
-  `prize` smallint(5) unsigned NOT NULL default '0',
+  `prize` int(10) unsigned NOT NULL default '0',
   `mvpexp` bigint(20) unsigned NOT NULL default '0',
   `mvpexp` bigint(20) unsigned NOT NULL default '0',
   `map` varchar(11) NOT NULL default '',
   `map` varchar(11) NOT NULL default '',
   PRIMARY KEY  (`mvp_id`)
   PRIMARY KEY  (`mvp_id`)
@@ -172,13 +172,13 @@ CREATE TABLE IF NOT EXISTS `picklog` (
   `time` datetime NOT NULL,
   `time` datetime NOT NULL,
   `char_id` int(11) NOT NULL default '0',
   `char_id` int(11) NOT NULL default '0',
   `type` enum('M','P','L','T','V','S','N','C','A','R','G','E','B','O','I','X','D','U','$','F','Y','Z','Q','H') NOT NULL default 'P',
   `type` enum('M','P','L','T','V','S','N','C','A','R','G','E','B','O','I','X','D','U','$','F','Y','Z','Q','H') NOT NULL default 'P',
-  `nameid` smallint(5) unsigned NOT NULL default '0',
+  `nameid` int(10) unsigned NOT NULL default '0',
   `amount` int(11) NOT NULL default '1',
   `amount` int(11) NOT NULL default '1',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
-  `card0` smallint(5) unsigned NOT NULL default '0',
-  `card1` smallint(5) unsigned NOT NULL default '0',
-  `card2` smallint(5) unsigned NOT NULL default '0',
-  `card3` smallint(5) unsigned NOT NULL default '0',
+  `card0` int(10) unsigned NOT NULL default '0',
+  `card1` int(10) unsigned NOT NULL default '0',
+  `card2` int(10) unsigned NOT NULL default '0',
+  `card3` int(10) unsigned NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',

+ 40 - 40
sql-files/main.sql

@@ -61,15 +61,15 @@ CREATE TABLE IF NOT EXISTS `auction` (
   `buynow` int(11) unsigned NOT NULL default '0',
   `buynow` int(11) unsigned NOT NULL default '0',
   `hours` smallint(6) NOT NULL default '0',
   `hours` smallint(6) NOT NULL default '0',
   `timestamp` int(11) unsigned NOT NULL default '0',
   `timestamp` int(11) unsigned NOT NULL default '0',
-  `nameid` smallint(5) unsigned NOT NULL default '0',
+  `nameid` int(10) unsigned NOT NULL default '0',
   `item_name` varchar(50) NOT NULL default '',
   `item_name` varchar(50) NOT NULL default '',
   `type` smallint(6) NOT NULL default '0',
   `type` smallint(6) NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
-  `card0` smallint(5) unsigned NOT NULL default '0',
-  `card1` smallint(5) unsigned NOT NULL default '0',
-  `card2` smallint(5) unsigned NOT NULL default '0',
-  `card3` smallint(5) unsigned NOT NULL default '0',
+  `card0` int(10) unsigned NOT NULL default '0',
+  `card1` int(10) unsigned NOT NULL default '0',
+  `card2` int(10) unsigned NOT NULL default '0',
+  `card3` int(10) unsigned NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
@@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS `auction` (
 CREATE TABLE IF NOT EXISTS `db_roulette` (
 CREATE TABLE IF NOT EXISTS `db_roulette` (
   `index` int(11) NOT NULL default '0',
   `index` int(11) NOT NULL default '0',
   `level` smallint(5) unsigned NOT NULL,
   `level` smallint(5) unsigned NOT NULL,
-  `item_id` smallint(5) unsigned NOT NULL,
+  `item_id` int(10) unsigned NOT NULL,
   `amount` smallint(5) unsigned NOT NULL DEFAULT '1',
   `amount` smallint(5) unsigned NOT NULL DEFAULT '1',
   `flag` smallint(5) unsigned NOT NULL DEFAULT '1',
   `flag` smallint(5) unsigned NOT NULL DEFAULT '1',
   PRIMARY KEY (`index`)
   PRIMARY KEY (`index`)
@@ -157,16 +157,16 @@ CREATE TABLE IF NOT EXISTS `buyingstores` (
 CREATE TABLE IF NOT EXISTS `cart_inventory` (
 CREATE TABLE IF NOT EXISTS `cart_inventory` (
   `id` int(11) NOT NULL auto_increment,
   `id` int(11) NOT NULL auto_increment,
   `char_id` int(11) NOT NULL default '0',
   `char_id` int(11) NOT NULL default '0',
-  `nameid` smallint(5) unsigned NOT NULL default '0',
+  `nameid` int(10) unsigned NOT NULL default '0',
   `amount` int(11) NOT NULL default '0',
   `amount` int(11) NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `identify` smallint(6) NOT NULL default '0',
   `identify` smallint(6) NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) NOT NULL default '0',
   `attribute` tinyint(4) NOT NULL default '0',
-  `card0` smallint(5) unsigned NOT NULL default '0',
-  `card1` smallint(5) unsigned NOT NULL default '0',
-  `card2` smallint(5) unsigned NOT NULL default '0',
-  `card3` smallint(5) unsigned NOT NULL default '0',
+  `card0` int(10) unsigned NOT NULL default '0',
+  `card1` int(10) unsigned NOT NULL default '0',
+  `card2` int(10) unsigned NOT NULL default '0',
+  `card3` int(10) unsigned NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
@@ -548,16 +548,16 @@ CREATE TABLE IF NOT EXISTS `guild_skill` (
 CREATE TABLE IF NOT EXISTS `guild_storage` (
 CREATE TABLE IF NOT EXISTS `guild_storage` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `id` int(10) unsigned NOT NULL auto_increment,
   `guild_id` int(11) unsigned NOT NULL default '0',
   `guild_id` int(11) unsigned NOT NULL default '0',
-  `nameid` smallint(5) unsigned NOT NULL default '0',
+  `nameid` int(10) unsigned NOT NULL default '0',
   `amount` int(11) unsigned NOT NULL default '0',
   `amount` int(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `identify` smallint(6) unsigned NOT NULL default '0',
   `identify` smallint(6) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
-  `card0` smallint(5) unsigned NOT NULL default '0',
-  `card1` smallint(5) unsigned NOT NULL default '0',
-  `card2` smallint(5) unsigned NOT NULL default '0',
-  `card3` smallint(5) unsigned NOT NULL default '0',
+  `card0` int(10) unsigned NOT NULL default '0',
+  `card1` int(10) unsigned NOT NULL default '0',
+  `card2` int(10) unsigned NOT NULL default '0',
+  `card3` int(10) unsigned NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
@@ -590,15 +590,15 @@ CREATE TABLE IF NOT EXISTS `guild_storage_log` (
   `time` datetime NOT NULL,
   `time` datetime NOT NULL,
   `char_id` int(11) NOT NULL default '0',
   `char_id` int(11) NOT NULL default '0',
   `name` varchar(24) NOT NULL default '',
   `name` varchar(24) NOT NULL default '',
-  `nameid` smallint(5) unsigned NOT NULL default '0',
+  `nameid` int(10) unsigned NOT NULL default '0',
   `amount` int(11) NOT NULL default '1',
   `amount` int(11) NOT NULL default '1',
   `identify` smallint(6) NOT NULL default '0',
   `identify` smallint(6) NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
-  `card0` smallint(5) unsigned NOT NULL default '0',
-  `card1` smallint(5) unsigned NOT NULL default '0',
-  `card2` smallint(5) unsigned NOT NULL default '0',
-  `card3` smallint(5) unsigned NOT NULL default '0',
+  `card0` int(10) unsigned NOT NULL default '0',
+  `card1` int(10) unsigned NOT NULL default '0',
+  `card2` int(10) unsigned NOT NULL default '0',
+  `card3` int(10) unsigned NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
@@ -685,16 +685,16 @@ CREATE TABLE IF NOT EXISTS `interlog` (
 CREATE TABLE IF NOT EXISTS `inventory` (
 CREATE TABLE IF NOT EXISTS `inventory` (
   `id` int(11) unsigned NOT NULL auto_increment,
   `id` int(11) unsigned NOT NULL auto_increment,
   `char_id` int(11) unsigned NOT NULL default '0',
   `char_id` int(11) unsigned NOT NULL default '0',
-  `nameid` smallint(5) unsigned NOT NULL default '0',
+  `nameid` int(10) unsigned NOT NULL default '0',
   `amount` int(11) unsigned NOT NULL default '0',
   `amount` int(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `identify` smallint(6) NOT NULL default '0',
   `identify` smallint(6) NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
-  `card0` smallint(5) unsigned NOT NULL default '0',
-  `card1` smallint(5) unsigned NOT NULL default '0',
-  `card2` smallint(5) unsigned NOT NULL default '0',
-  `card3` smallint(5) unsigned NOT NULL default '0',
+  `card0` int(10) unsigned NOT NULL default '0',
+  `card1` int(10) unsigned NOT NULL default '0',
+  `card2` int(10) unsigned NOT NULL default '0',
+  `card3` int(10) unsigned NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
@@ -792,15 +792,15 @@ CREATE TABLE IF NOT EXISTS `mail` (
 CREATE TABLE IF NOT EXISTS `mail_attachments` (
 CREATE TABLE IF NOT EXISTS `mail_attachments` (
   `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
   `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
   `index` smallint(5) unsigned NOT NULL DEFAULT '0',
   `index` smallint(5) unsigned NOT NULL DEFAULT '0',
-  `nameid` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `nameid` int(10) unsigned NOT NULL DEFAULT '0',
   `amount` int(11) unsigned NOT NULL DEFAULT '0',
   `amount` int(11) unsigned NOT NULL DEFAULT '0',
   `refine` tinyint(3) unsigned NOT NULL DEFAULT '0',
   `refine` tinyint(3) unsigned NOT NULL DEFAULT '0',
   `attribute` tinyint(4) unsigned NOT NULL DEFAULT '0',
   `attribute` tinyint(4) unsigned NOT NULL DEFAULT '0',
   `identify` smallint(6) NOT NULL DEFAULT '0',
   `identify` smallint(6) NOT NULL DEFAULT '0',
-  `card0` smallint(5) unsigned NOT NULL DEFAULT '0',
-  `card1` smallint(5) unsigned NOT NULL DEFAULT '0',
-  `card2` smallint(5) unsigned NOT NULL DEFAULT '0',
-  `card3` smallint(5) unsigned NOT NULL DEFAULT '0',
+  `card0` int(10) unsigned NOT NULL DEFAULT '0',
+  `card1` int(10) unsigned NOT NULL DEFAULT '0',
+  `card2` int(10) unsigned NOT NULL DEFAULT '0',
+  `card3` int(10) unsigned NOT NULL DEFAULT '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
@@ -838,7 +838,7 @@ CREATE TABLE IF NOT EXISTS `mapreg` (
 
 
 CREATE TABLE IF NOT EXISTS `market` (
 CREATE TABLE IF NOT EXISTS `market` (
   `name` varchar(50) NOT NULL DEFAULT '',
   `name` varchar(50) NOT NULL DEFAULT '',
-  `nameid` SMALLINT(5) UNSIGNED NOT NULL,
+  `nameid` int(10) UNSIGNED NOT NULL,
   `price` INT(11) UNSIGNED NOT NULL,
   `price` INT(11) UNSIGNED NOT NULL,
   `amount` SMALLINT(5) UNSIGNED NOT NULL,
   `amount` SMALLINT(5) UNSIGNED NOT NULL,
   `flag` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0',
   `flag` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0',
@@ -895,7 +895,7 @@ CREATE TABLE IF NOT EXISTS `mercenary_owner` (
 -- ----------------------------
 -- ----------------------------
 
 
 CREATE TABLE IF NOT EXISTS `sales` (
 CREATE TABLE IF NOT EXISTS `sales` (
-  `nameid` smallint(5) unsigned NOT NULL,
+  `nameid` int(10) unsigned NOT NULL,
   `start` datetime NOT NULL,
   `start` datetime NOT NULL,
   `end` datetime NOT NULL,
   `end` datetime NOT NULL,
   `amount` int(11) NOT NULL,
   `amount` int(11) NOT NULL,
@@ -955,8 +955,8 @@ CREATE TABLE IF NOT EXISTS `pet` (
   `account_id` int(11) unsigned NOT NULL default '0',
   `account_id` int(11) unsigned NOT NULL default '0',
   `char_id` int(11) unsigned NOT NULL default '0',
   `char_id` int(11) unsigned NOT NULL default '0',
   `level` smallint(4) unsigned NOT NULL default '0',
   `level` smallint(4) unsigned NOT NULL default '0',
-  `egg_id` smallint(5) unsigned NOT NULL default '0',
-  `equip` mediumint(8) unsigned NOT NULL default '0',
+  `egg_id` int(10) unsigned NOT NULL default '0',
+  `equip` int(10) unsigned NOT NULL default '0',
   `intimate` smallint(9) unsigned NOT NULL default '0',
   `intimate` smallint(9) unsigned NOT NULL default '0',
   `hungry` smallint(9) unsigned NOT NULL default '0',
   `hungry` smallint(9) unsigned NOT NULL default '0',
   `rename_flag` tinyint(4) unsigned NOT NULL default '0',
   `rename_flag` tinyint(4) unsigned NOT NULL default '0',
@@ -1010,16 +1010,16 @@ CREATE TABLE IF NOT EXISTS `skill_homunculus` (
 CREATE TABLE IF NOT EXISTS `storage` (
 CREATE TABLE IF NOT EXISTS `storage` (
   `id` int(11) unsigned NOT NULL auto_increment,
   `id` int(11) unsigned NOT NULL auto_increment,
   `account_id` int(11) unsigned NOT NULL default '0',
   `account_id` int(11) unsigned NOT NULL default '0',
-  `nameid` smallint(5) unsigned NOT NULL default '0',
+  `nameid` int(10) unsigned NOT NULL default '0',
   `amount` smallint(11) unsigned NOT NULL default '0',
   `amount` smallint(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `identify` smallint(6) unsigned NOT NULL default '0',
   `identify` smallint(6) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
-  `card0` smallint(5) unsigned NOT NULL default '0',
-  `card1` smallint(5) unsigned NOT NULL default '0',
-  `card2` smallint(5) unsigned NOT NULL default '0',
-  `card3` smallint(5) unsigned NOT NULL default '0',
+  `card0` int(10) unsigned NOT NULL default '0',
+  `card1` int(10) unsigned NOT NULL default '0',
+  `card2` int(10) unsigned NOT NULL default '0',
+  `card3` int(10) unsigned NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_id0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_val0` smallint(5) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',
   `option_parm0` tinyint(3) NOT NULL default '0',

+ 13 - 13
sql-files/mob_db.sql

@@ -35,31 +35,31 @@ CREATE TABLE `mob_db` (
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
-  `MVP1id` smallint(5) unsigned NOT NULL default '0',
+  `MVP1id` int(10) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
-  `MVP2id` smallint(5) unsigned NOT NULL default '0',
+  `MVP2id` int(10) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
-  `MVP3id` smallint(5) unsigned NOT NULL default '0',
+  `MVP3id` int(10) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop1id` smallint(5) unsigned NOT NULL default '0',
+  `Drop1id` int(10) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
-  `Drop2id` smallint(5) unsigned NOT NULL default '0',
+  `Drop2id` int(10) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
-  `Drop3id` smallint(5) unsigned NOT NULL default '0',
+  `Drop3id` int(10) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop4id` smallint(5) unsigned NOT NULL default '0',
+  `Drop4id` int(10) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
-  `Drop5id` smallint(5) unsigned NOT NULL default '0',
+  `Drop5id` int(10) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
-  `Drop6id` smallint(5) unsigned NOT NULL default '0',
+  `Drop6id` int(10) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
-  `Drop7id` smallint(5) unsigned NOT NULL default '0',
+  `Drop7id` int(10) unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
-  `Drop8id` smallint(5) unsigned NOT NULL default '0',
+  `Drop8id` int(10) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
-  `Drop9id` smallint(5) unsigned NOT NULL default '0',
+  `Drop9id` int(10) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
-  `DropCardid` smallint(5) unsigned NOT NULL default '0',
+  `DropCardid` int(10) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   PRIMARY KEY  (`ID`),
   PRIMARY KEY  (`ID`),
   UNIQUE KEY (`Sprite`)
   UNIQUE KEY (`Sprite`)

+ 13 - 13
sql-files/mob_db2.sql

@@ -35,31 +35,31 @@ CREATE TABLE `mob_db2` (
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
-  `MVP1id` smallint(5) unsigned NOT NULL default '0',
+  `MVP1id` int(10) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
-  `MVP2id` smallint(5) unsigned NOT NULL default '0',
+  `MVP2id` int(10) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
-  `MVP3id` smallint(5) unsigned NOT NULL default '0',
+  `MVP3id` int(10) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop1id` smallint(5) unsigned NOT NULL default '0',
+  `Drop1id` int(10) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
-  `Drop2id` smallint(5) unsigned NOT NULL default '0',
+  `Drop2id` int(10) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
-  `Drop3id` smallint(5) unsigned NOT NULL default '0',
+  `Drop3id` int(10) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop4id` smallint(5) unsigned NOT NULL default '0',
+  `Drop4id` int(10) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
-  `Drop5id` smallint(5) unsigned NOT NULL default '0',
+  `Drop5id` int(10) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
-  `Drop6id` smallint(5) unsigned NOT NULL default '0',
+  `Drop6id` int(10) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
-  `Drop7id` smallint(5) unsigned NOT NULL default '0',
+  `Drop7id` int(10) unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
-  `Drop8id` smallint(5) unsigned NOT NULL default '0',
+  `Drop8id` int(10) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
-  `Drop9id` smallint(5) unsigned NOT NULL default '0',
+  `Drop9id` int(10) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
-  `DropCardid` smallint(5) unsigned NOT NULL default '0',
+  `DropCardid` int(10) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   PRIMARY KEY  (`ID`),
   PRIMARY KEY  (`ID`),
   UNIQUE KEY (`Sprite`)
   UNIQUE KEY (`Sprite`)

+ 13 - 13
sql-files/mob_db2_re.sql

@@ -35,31 +35,31 @@ CREATE TABLE `mob_db2_re` (
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
-  `MVP1id` smallint(5) unsigned NOT NULL default '0',
+  `MVP1id` int(10) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
-  `MVP2id` smallint(5) unsigned NOT NULL default '0',
+  `MVP2id` int(10) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
-  `MVP3id` smallint(5) unsigned NOT NULL default '0',
+  `MVP3id` int(10) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop1id` smallint(5) unsigned NOT NULL default '0',
+  `Drop1id` int(10) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
-  `Drop2id` smallint(5) unsigned NOT NULL default '0',
+  `Drop2id` int(10) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
-  `Drop3id` smallint(5) unsigned NOT NULL default '0',
+  `Drop3id` int(10) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop4id` smallint(5) unsigned NOT NULL default '0',
+  `Drop4id` int(10) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
-  `Drop5id` smallint(5) unsigned NOT NULL default '0',
+  `Drop5id` int(10) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
-  `Drop6id` smallint(5) unsigned NOT NULL default '0',
+  `Drop6id` int(10) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
-  `Drop7id` smallint(5) unsigned NOT NULL default '0',
+  `Drop7id` int(10)unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
-  `Drop8id` smallint(5) unsigned NOT NULL default '0',
+  `Drop8id` int(10) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
-  `Drop9id` smallint(5) unsigned NOT NULL default '0',
+  `Drop9id` int(10) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
-  `DropCardid` smallint(5) unsigned NOT NULL default '0',
+  `DropCardid` int(10) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   PRIMARY KEY  (`ID`),
   PRIMARY KEY  (`ID`),
   UNIQUE KEY (`Sprite`)
   UNIQUE KEY (`Sprite`)

+ 36 - 36
sql-files/mob_db_re.sql

@@ -35,31 +35,31 @@ CREATE TABLE `mob_db_re` (
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
-  `MVP1id` smallint(5) unsigned NOT NULL default '0',
+  `MVP1id` int(10) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
-  `MVP2id` smallint(5) unsigned NOT NULL default '0',
+  `MVP2id` int(10) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
-  `MVP3id` smallint(5) unsigned NOT NULL default '0',
+  `MVP3id` int(10) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop1id` smallint(5) unsigned NOT NULL default '0',
+  `Drop1id` int(10) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
-  `Drop2id` smallint(5) unsigned NOT NULL default '0',
+  `Drop2id` int(10) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
-  `Drop3id` smallint(5) unsigned NOT NULL default '0',
+  `Drop3id` int(10) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop4id` smallint(5) unsigned NOT NULL default '0',
+  `Drop4id` int(10) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
-  `Drop5id` smallint(5) unsigned NOT NULL default '0',
+  `Drop5id` int(10) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
-  `Drop6id` smallint(5) unsigned NOT NULL default '0',
+  `Drop6id` int(10) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
-  `Drop7id` smallint(5) unsigned NOT NULL default '0',
+  `Drop7id` int(10) unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
-  `Drop8id` smallint(5) unsigned NOT NULL default '0',
+  `Drop8id` int(10) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
-  `Drop9id` smallint(5) unsigned NOT NULL default '0',
+  `Drop9id` int(10) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
-  `DropCardid` smallint(5) unsigned NOT NULL default '0',
+  `DropCardid` int(10) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   PRIMARY KEY  (`ID`),
   PRIMARY KEY  (`ID`),
   UNIQUE KEY (`Sprite`)
   UNIQUE KEY (`Sprite`)
@@ -2346,13 +2346,13 @@ REPLACE INTO `mob_db_re` VALUES (3109,'JITTERBUG2','Jitterbug2','Jitterbug2',135
 #REPLACE INTO `mob_db_re` VALUES (3119,'E_RUNAWAY5_','Runaway 5','Runaway 5',1,10,1,0,0,1,1,1,1,0,1,1,1,1,1,1,10,12,0,0,20,0x11F0000,170,1084,2304,576,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
 #REPLACE INTO `mob_db_re` VALUES (3119,'E_RUNAWAY5_','Runaway 5','Runaway 5',1,10,1,0,0,1,1,1,1,0,1,1,1,1,1,1,10,12,0,0,20,0x11F0000,170,1084,2304,576,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
 #3120,M_ISIS
 #3120,M_ISIS
 #3121,Q_BYORGUE
 #3121,Q_BYORGUE
-#3122,CHARLESTON1
-#3123,CHARLESTON2
-#3124,CHARLESTON3
-REPLACE INTO `mob_db_re` VALUES (3125,'STEP','Step','Step',130,55403,0,3088,2392,1,871,695,101,58,117,127,55,61,116,60,10,12,0,6,22,0x2000000,250,0,780,0,0,0,0,0,0,0,0,6751,1000,998,150,13213,400,0,0,0,0,0,0,0,0,0,0,0,0,4698,1);
-#3126,ROCK_STEP
-#3127,KICK_STEP
-#3128,KICK_AND_KICK
+REPLACE INTO `mob_db_re` VALUES (3122,'CHARLESTON1','Charleston 1','Charleston 1',140,2614000,1,36804,21064,1,3210,695,123,68,189,78,81,51,108,56,10,12,2,6,22,0x3095,150,676,2400,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3123,'CHARLESTON2','Charleston 3','Charleston 2',140,2614000,1,36804,21064,1,3210,695,123,68,189,78,81,51,108,56,10,12,2,6,22,0x3095,150,676,2400,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3124,'CHARLESTON3','Charleston 3','Charleston 3',145,23671401,1,3132000,2473000,1,1500,1000,200,90,208,106,205,206,228,105,10,12,2,6,60,0x620B695,200,676,2016,672,0,0,0,0,0,0,0,16031,200,28101,200,16033,100,21011,200,22043,400,22044,400,6752,5000,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3125,'STEP','Step','Step',130,55403,1,3088,2392,1,871,695,101,58,117,127,55,61,116,60,10,12,0,6,20,0x0000083,100,676,672,480,0,0,0,0,0,0,0,6751,1000,998,150,6213,400,6961,50,6962,50,0,0,0,0,0,0,0,0,4698,1);
+REPLACE INTO `mob_db_re` VALUES (3126,'ROCK_STEP','Rock Step','Lockstep',131,71056,1,3609,2209,2,1100,325,85,59,99,95,70,124,155,80,10,12,1,6,40,0x0000085,150,676,1056,480,0,0,0,0,0,0,0,6750,500,999,350,7319,500,6961,50,6962,50,0,0,0,0,0,0,0,0,4699,1);
+REPLACE INTO `mob_db_re` VALUES (3127,'KICK_STEP','Kick Step','Hallway 1 Security Devi',132,73644,1,3607,2205,7,1151,218,80,50,99,92,72,122,161,76,10,12,1,6,20,0x0000084,200,676,816,480,0,0,0,0,0,0,0,6750,400,999,250,7319,300,6961,50,6962,50,0,0,0,0,0,0,0,0,27012,1);
+REPLACE INTO `mob_db_re` VALUES (3128,'KICK_AND_KICK','Kick And Kick','Security Robot',133,68018,1,3729,2032,1,1484,158,98,54,164,116,66,59,141,58,10,12,1,6,40,0x0000085,200,676,576,480,0,0,0,0,0,0,0,6751,500,998,100,6961,50,6962,50,0,0,0,0,0,0,0,0,0,0,27013,1);
 #3129,ORC_ZOMBIE_ANNIV
 #3129,ORC_ZOMBIE_ANNIV
 #3130,ORC_ARCHER_ANNIV
 #3130,ORC_ARCHER_ANNIV
 #3131,ORC_BABY_ANNIV
 #3131,ORC_BABY_ANNIV
@@ -2377,13 +2377,13 @@ REPLACE INTO `mob_db_re` VALUES (3125,'STEP','Step','Step',130,55403,0,3088,2392
 #3150,MG_AMDARAIS_H
 #3150,MG_AMDARAIS_H
 #3151,MG_CORRUPTION_ROOT_H
 #3151,MG_CORRUPTION_ROOT_H
 #3152,G_MG_KHALITZBURG_H
 #3152,G_MG_KHALITZBURG_H
-REPLACE INTO `mob_db_re` VALUES (3153,'EXCAVATOR_ROBOT','Excavator Robot','Excavator Robot',163,166860,0,15026,16915,1,4785,192,138,53,102,104,72,57,98,57,10,12,1,0,60,0x0000085,250,1020,500,768,0,0,0,0,0,0,0,11597,251,984,101,6962,101,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-REPLACE INTO `mob_db_re` VALUES (3154,'RECON_ROBOT','Recon Robot','Recon Robot',165,256000,0,15796,17738,1,2989,280,128,60,112,60,72,57,120,77,10,12,2,0,80,0x0000085,170,1072,672,384,0,0,0,0,0,0,0,998,1001,756,1001,11597,151,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-REPLACE INTO `mob_db_re` VALUES (3155,'REPAIR_ROBOT','Repair Robot','Repair Robot',155,154760,0,11748,47654,1,2051,216,99,55,98,39,30,35,95,45,10,12,0,3,24,0x0000085,300,1500,500,660,0,0,0,0,0,0,0,998,5000,756,1501,999,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-REPLACE INTO `mob_db_re` VALUES (3156,'EXPLORATION_ROVER','Exploration Rover','Exploration Rover',168,293640,0,18172,126234,1,2513,802,105,41,100,63,35,99,106,61,10,12,2,7,80,0x0000085,165,1552,1152,336,0,0,0,0,0,0,0,998,5000,756,1,999,1,6961,1,0,0,0,0,0,0,0,0,0,0,0,0);
-REPLACE INTO `mob_db_re` VALUES (3157,'RUIN_BELIEVER1','Ruin Grace Believer','Ruin Grace Believer',100,61350,0,4666,3874,1,993,250,91,50,88,61,51,62,136,60,10,12,1,7,40,0x0000085,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-REPLACE INTO `mob_db_re` VALUES (3158,'RUIN_BELIEVER2','Ruin Grace Believer','Ruin Grace Believer',100,61350,0,4666,139500,1,993,250,91,50,88,61,51,62,136,60,10,12,1,7,40,0x0000085,200,2125,2112,0,0,0,0,0,0,0,0,6753,10000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-REPLACE INTO `mob_db_re` VALUES (3159,'ILLEGAL_PROMOTION','Illegal Promotion','Illegal Promotion',100,10,0,0,0,1,1,1,1,50,1,1,1,1,1,1,10,12,0,0,40,0x0370020,200,0,0,768,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3153,'EXCAVATOR_ROBOT','Excavator Robot','Excavator Robot',163,166860,1,15026,16915,1,4785,192,138,53,102,104,72,57,98,57,10,12,1,0,60,0x0000085,250,1020,500,768,0,0,0,0,0,0,0,11597,1,984,1,6962,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3154,'RECON_ROBOT','Recon Robot','Recon Robot',165,256000,1,15796,17738,3,2989,280,127,60,112,60,72,57,120,77,10,12,2,0,80,0x0000085,170,1072,672,384,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3155,'REPAIR_ROBOT','Repair Robot','Repair Robot',155,154760,1,11748,13237,1,2051,216,99,55,98,39,30,35,95,45,10,12,0,3,24,0x0000085,300,1500,500,660,0,0,0,0,0,0,0,998,5000,756,1501,999,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3156,'EXPLORATION_ROVER','Exploration Rover','Exploration Rover',168,293640,1,18172,35065,3,2513,802,105,41,100,63,35,99,106,61,10,12,2,7,80,0x0000085,165,1552,1152,336,0,0,0,0,0,0,0,998,5000,756,1,999,1,6961,1,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3157,'RUIN_BELIEVER1','Ruin Grace Believer','Ruin Grace Believer',100,61350,1,4666,3874,1,993,250,91,50,88,61,51,62,136,60,10,12,1,7,40,0x0000085,200,800,2112,768,0,0,0,0,0,0,0,6753,10000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3158,'RUIN_BELIEVER2','Ruin Grace Believer','Ruin Grace Believer',100,61350,1,4666,3874,1,993,250,91,50,88,61,51,62,136,60,10,12,1,7,40,0x0000085,200,800,2112,768,0,0,0,0,0,0,0,6753,10000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3159,'ILLEGAL_PROMOTION','Illegal Promotion','Illegal Promotion',100,10,1,0,0,1,1,1,1,50,1,1,1,1,1,1,10,12,0,0,40,0x0370020,200,800,2112,768,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
 #3160,BOILED_RICE_DUANWU
 #3160,BOILED_RICE_DUANWU
 #3161,BOMB
 #3161,BOMB
 #3162,ELEPHANT
 #3162,ELEPHANT
@@ -2472,15 +2472,15 @@ REPLACE INTO `mob_db_re` VALUES (3244,'V_B_GERTIE','Shadow Chaser Gertie','Shado
 REPLACE INTO `mob_db_re` VALUES (3245,'V_B_ALPHOCCIO','Minstrel Alphoccio','Minstrel Alphoccio',186,10800000,1,3000000,3000000,1,8000,12000,240,200,240,300,140,400,300,180,10,12,1,7,84,0x6283695,100,76,864,288,0,0,0,0,0,0,0,23016,3000,20748,150,20748,500,22687,5000,6818,10000,6818,10000,6818,10000,0,0,0,0,4673,1);
 REPLACE INTO `mob_db_re` VALUES (3245,'V_B_ALPHOCCIO','Minstrel Alphoccio','Minstrel Alphoccio',186,10800000,1,3000000,3000000,1,8000,12000,240,200,240,300,140,400,300,180,10,12,1,7,84,0x6283695,100,76,864,288,0,0,0,0,0,0,0,23016,3000,20748,150,20748,500,22687,5000,6818,10000,6818,10000,6818,10000,0,0,0,0,4673,1);
 REPLACE INTO `mob_db_re` VALUES (3246,'V_B_TRENTINI','Wanderer Trentini','Wanderer Trentini',186,10800000,1,3000000,3000000,2,8000,12000,200,200,220,300,140,400,300,160,10,12,1,7,84,0x6283695,100,76,864,288,0,0,0,0,0,0,0,23016,3000,20748,150,20748,500,22687,5000,6818,10000,6818,10000,6818,10000,0,0,0,0,4683,1);
 REPLACE INTO `mob_db_re` VALUES (3246,'V_B_TRENTINI','Wanderer Trentini','Wanderer Trentini',186,10800000,1,3000000,3000000,2,8000,12000,200,200,220,300,140,400,300,160,10,12,1,7,84,0x6283695,100,76,864,288,0,0,0,0,0,0,0,23016,3000,20748,150,20748,500,22687,5000,6818,10000,6818,10000,6818,10000,0,0,0,0,4683,1);
 REPLACE INTO `mob_db_re` VALUES (3247,'CENERE_G','Cenere G','Green Cenere',150,140088,1,7635,7698,1,1897,110,91,81,70,48,40,37,100,45,10,12,0,0,24,0x0000085,300,1500,720,360,0,0,0,0,0,0,0,6561,5000,7322,500,7001,1500,7320,1000,12815,500,0,0,0,0,0,0,0,0,27014,1);
 REPLACE INTO `mob_db_re` VALUES (3247,'CENERE_G','Cenere G','Green Cenere',150,140088,1,7635,7698,1,1897,110,91,81,70,48,40,37,100,45,10,12,0,0,24,0x0000085,300,1500,720,360,0,0,0,0,0,0,0,6561,5000,7322,500,7001,1500,7320,1000,12815,500,0,0,0,0,0,0,0,0,27014,1);
-REPLACE INTO `mob_db_re` VALUES (3248,'REPAIR_ROBOT_T','Repair Robot T','Repair Robot Turbo',158,186320,1,13208,14489,1,2431,226,118,59,101,42,55,35,110,45,10,12,0,0,40,0x000008B,300,1500,500,660,0,0,0,0,0,0,0,7512,500,7507,250,998,2000,999,500,11597,1500,0,0,0,0,0,0,0,0,27015,1);
-REPLACE INTO `mob_db_re` VALUES (3249,'EXPLORATION_ROVER_T','Exploration Rover T','Explorer Robot Turbo',171,318117,1,19826,41023,3,2945,841,121,67,118,80,45,121,138,65,10,12,2,0,80,0x0000085,165,1552,1152,336,0,0,0,0,0,0,0,7512,500,7507,250,998,2000,999,500,11597,1500,0,0,0,0,0,0,0,0,27016,1);
-REPLACE INTO `mob_db_re` VALUES (3250,'SCR_MT_ROBOTS','Scr Mt Robots','Can Robot',155,30,1,61,58,1,95,2,100,99,35,42,20,12,68,3,10,12,0,0,20,0x0070085,300,2400,500,400,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,0,0,0,0,0,0,0,0,0,0,0,0,27017,1);
-REPLACE INTO `mob_db_re` VALUES (3251,'GC109','Machine Component','Machine Component',149,217650,1,6598,5931,1,2678,1257,121,71,60,132,45,35,155,15,10,12,0,0,47,0x0000085,120,1000,500,600,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,0,0,0,0,0,0,0,0,0,0,0,0,27018,1);
-REPLACE INTO `mob_db_re` VALUES (3252,'DR815','Machine Component','Machine Component',153,245670,1,7255,7011,1,3315,761,143,45,88,98,88,21,116,22,10,12,1,0,27,0x0000085,135,1500,600,500,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,0,0,0,0,0,0,0,0,0,0,0,0,27019,1);
-REPLACE INTO `mob_db_re` VALUES (3253,'SYS_MSG','Sys Msg','System message',160,100,1,0,0,1,1,1,276,99,0,0,0,188,0,0,10,12,0,0,20,0xC170081,2000,3000,600,550,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-REPLACE INTO `mob_db_re` VALUES (3254,'T_W_O','T_W_O','T_W_O',165,48000000,1,0,0,1,3955,196,158,134,90,141,7,87,267,70,10,12,2,6,67,0x6280085,150,1250,500,350,0,6832,5000,617,5000,617,5000,22699,3000,1531,500,7319,2000,0,0,0,0,0,0,0,0,0,0,0,0,27020,1);
-REPLACE INTO `mob_db_re` VALUES (3255,'GHOUL_H','Ghoul H','Smelly Ghoul',155,178652,1,10233,10598,1,2235,216,99,55,98,55,61,22,133,2,10,12,0,3,24,0x0000085,200,0,500,660,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-REPLACE INTO `mob_db_re` VALUES (3256,'ZOMBIE_H','Zombie H','Smelly Zombie',148,134615,1,6859,6903,1,1995,450,91,42,76,53,54,21,125,3,10,12,0,0,60,0x0000085,220,0,960,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3248,'REPAIR_ROBOT_T','Repair Robot T','Repair Robot Turbo',158,186320,1,13208,14489,1,2431,226,118,59,101,42,55,35,110,45,10,12,0,0,40,0x000008B,300,1500,500,660,0,0,0,0,0,0,0,7512,500,7507,250,998,2000,999,500,11597,1500,6961,50,6962,50,0,0,0,0,27015,1);
+REPLACE INTO `mob_db_re` VALUES (3249,'EXPLORATION_ROVER_T','Exploration Rover T','Explorer Robot Turbo',171,318117,1,19826,41023,3,2945,841,121,67,118,80,45,121,138,65,10,12,2,0,80,0x0000085,165,1552,1152,336,0,0,0,0,0,0,0,7512,500,7507,250,998,2000,999,500,11597,1500,6961,50,6962,50,0,0,0,0,27016,1);
+REPLACE INTO `mob_db_re` VALUES (3250,'SCR_MT_ROBOTS','Scr Mt Robots','Can Robot',155,30,1,61,58,1,95,2,100,99,35,42,20,12,68,3,10,12,0,0,20,0x0070085,300,2400,500,400,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,6961,50,6962,50,0,0,0,0,0,0,0,0,27017,1);
+REPLACE INTO `mob_db_re` VALUES (3251,'GC109','Machine Component','Machine Component',149,217650,1,6598,5931,1,2678,1257,121,71,60,132,45,35,155,15,10,12,0,0,47,0x0000085,120,1000,500,600,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,6961,50,6962,50,0,0,0,0,0,0,0,0,27018,1);
+REPLACE INTO `mob_db_re` VALUES (3252,'DR815','Machine Component','Machine Component',153,245670,1,7255,7011,1,3315,761,143,45,88,98,88,21,116,22,10,12,1,0,27,0x0000085,135,1500,600,500,0,0,0,0,0,0,0,7512,1000,7507,1500,7319,2000,6961,50,6962,50,0,0,0,0,0,0,0,0,27019,1);
+REPLACE INTO `mob_db_re` VALUES (3253,'SYS_MSG','Sys Msg','System message',160,100,1,0,0,12,1,1,276,99,0,0,0,188,0,0,10,12,2,6,27,0xC170081,2000,3000,600,550,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3254,'T_W_O','T_W_O','T_W_O',165,48000000,1,0,0,3,3955,196,158,134,90,141,7,87,267,70,10,12,2,6,67,0x6280085,150,1250,500,350,0,6832,5000,617,5000,617,5000,22699,3000,1531,500,7319,2000,0,0,0,0,0,0,0,0,0,0,0,0,27020,1);
+REPLACE INTO `mob_db_re` VALUES (3255,'GHOUL_H','Ghoul H','Smelly Ghoul',155,178652,1,10233,10598,1,2235,216,99,55,98,55,61,22,133,2,10,12,0,3,24,0x0000085,200,2050,500,660,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+REPLACE INTO `mob_db_re` VALUES (3256,'ZOMBIE_H','Zombie H','Smelly Zombie',148,134615,1,6859,6903,1,1995,450,91,42,76,53,54,21,125,3,10,12,0,0,60,0x0000085,220,2155,960,480,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
 #3257,MALE_PORING
 #3257,MALE_PORING
 #3258,FEMALE_PORING
 #3258,FEMALE_PORING
 #3259,FANTASTIC_B_UNICORN
 #3259,FANTASTIC_B_UNICORN

+ 23 - 56
sql-files/mob_skill_db_re.sql

@@ -11898,62 +11898,29 @@ REPLACE INTO `mob_skill_db_re` VALUES (3246,'V_B_TRENTINI@NPC_WIDESTONE','attack
 REPLACE INTO `mob_skill_db_re` VALUES (3246,'V_B_TRENTINI@NPC_WIDESLEEP','attack',668,5,100,1000,20000,'no','self','always',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `mob_skill_db_re` VALUES (3246,'V_B_TRENTINI@NPC_WIDESLEEP','attack',668,5,100,1000,20000,'no','self','always',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `mob_skill_db_re` VALUES (3246,'V_B_TRENTINI@NPC_WIDECONFUSE','attack',667,5,100,1000,20000,'no','target','always',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `mob_skill_db_re` VALUES (3246,'V_B_TRENTINI@NPC_WIDECONFUSE','attack',667,5,100,1000,20000,'no','target','always',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 
 
-#=================================================================
-# Phantasmagorika 15.2 Mob Skills Placeholder (Gathered from jRO)
-#=================================================================
-
-REPLACE INTO `mob_skill_db_re` VALUES (3153,'Excavator Robot@NPC_BLOODDRAIN','angry',199,1,1000,0,3000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3153,'Excavator Robot@NPC_STONESKIN','attack',675,3,10000,0,30000,'yes','self','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3153,'Excavator Robot@NPC_STUNATTACK','attack',179,5,800,1000,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3153,'Excavator Robot@NPC_ARMORBRAKE','attack',344,10,500,0,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3153,'Excavator Robot@NPC_STONESKIN','chase',675,3,10000,0,30000,'yes','self','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3153,'Excavator Robot@NPC_BLOODDRAIN','attack',199,1,500,0,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3153,'Excavator Robot@NPC_STONESKIN','idle',675,3,10000,0,30000,'yes','self','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3153,'Excavator Robot@AL_TELEPORT','idle',26,1,10000,0,0,'no','target','rudeattacked','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-
-REPLACE INTO `mob_skill_db_re` VALUES (3154,'Recon Robot@NPC_GUIDEDATTACK','attack',172,5,500,0,20000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3154,'Recon Robot@NPC_STUNATTACK','attack',179,5,800,1000,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-
-REPLACE INTO `mob_skill_db_re` VALUES (3155,'Repair Robot@NPC_STUNATTACK','any',179,5,500,1000,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3155,'Repair Robot@NPC_GUIDEDATTACK','attack',172,5,1000,0,15000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-
-REPLACE INTO `mob_skill_db_re` VALUES (3156,'Exploration Rover@NPC_SUMMONSLAVE','idle',196,5,10000,700,10000,'no','self','casttargeted','1',3157,3158,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3156,'Exploration Rover@NPC_GUIDEDATTACK','attack',172,5,1000,0,10000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3156,'Exploration Rover@NPC_SUMMONSLAVE','attack',196,5,10000,700,10000,'no','target','attackpcge','10',3157,3158,NULL,NULL,NULL,NULL,NULL);
-
-REPLACE INTO `mob_skill_db_re` VALUES (3247,'Cenere G@NPC_PETRIFYATTACK','attack',180,3,500,500,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3247,'Cenere G@MG_THUNDERSTORM','chase',21,10,3000,1000,10000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3247,'Cenere G@NPC_POISONATTACK','any',188,1,5000,0,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3247,'Cenere G@NPC_BLINDATTACK','attack',177,3,500,0,5000,'yes','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3247,'Cenere G@MG_THUNDERSTORM','attack',21,10,3000,1000,10000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-
-REPLACE INTO `mob_skill_db_re` VALUES (3248,'Repair Robot T@AL_PNEUMA','attack',25,1,2000,0,5000,'yes','self','longrangeattacked','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3248,'Repair Robot T@AL_TELEPORT','idle',26,1,10000,0,0,'no','target','rudeattacked','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3248,'Repair Robot T@NPC_CRITICALSLASH','attack',170,1,2000,0,2000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3248,'Repair Robot T@NPC_GUIDEDATTACK','attack',172,5,1000,0,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3248,'Repair Robot T@KN_TWOHANDQUICKEN','attack',60,30,10000,0,120000,'yes','target','myhpltmaxrate','40',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3248,'Repair Robot T@NPC_STUNATTACK','attack',179,5,500,1000,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3248,'Repair Robot T@AL_PNEUMA','chase',25,1,2000,0,5000,'no','self','longrangeattacked','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-
-REPLACE INTO `mob_skill_db_re` VALUES (3249,'Exploration Rover T@KN_TWOHANDQUICKEN','attack',60,30,10000,0,120000,'yes','self','myhpltmaxrate','40',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3249,'Exploration Rover T@AL_PNEUMA','chase',25,1,2000,0,5000,'no','self','longrangeattacked','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3249,'Exploration Rover T@AL_TELEPORT','walk',26,1,10000,0,0,'no','target','rudeattacked','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3249,'Exploration Rover T@NPC_CRITICALWOUND','attack',673,2,1000,0,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3249,'Exploration Rover T@NPC_GUIDEDATTACK','attack',172,5,1000,0,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3249,'Exploration Rover T@AL_PNEUMA','attack',25,1,2000,0,5000,'no','self','longrangeattacked','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-
-REPLACE INTO `mob_skill_db_re` VALUES (3253,'SYS_MSG@AL_HEAL','attack',28,10,500,500,5000,'yes','friend','friendhpltmaxrate','50',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3253,'SYS_MSG@AL_HEAL','chase',28,10,500,500,5000,'yes','friend','friendhpltmaxrate','50',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3253,'SYS_MSG@AL_HEAL','idle',28,10,500,500,5000,'yes','friend','friendhpltmaxrate','50',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-
-REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_PIERCINGATT','attack',158,10,300,0,30000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_PIERCINGATT','chase',158,10,500,0,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_SILENCEATTACK','attack',178,5,750,250,10000,'no','target','casttargeted','0',NULL,NULL,NULL,NULL,NULL,'6',NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_SILENCEATTACK','chase',178,5,750,250,3000,'no','target','casttargeted','0',NULL,NULL,NULL,NULL,NULL,'6',NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_WIDESLEEP','attack',668,5,400,0,15000,'no','self','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_WIDESTONE','attack',666,5,600,0,30000,'no','self','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_WIDESOULDRAIN','attack',680,10,1000,0,60000,'no','self','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
-REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_CRITICALWOUND','attack',673,5,150,500,45000,'no','target','always',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+# Phantasmagorika 15.2
+REPLACE INTO `mob_skill_db_re` VALUES (3124,'CHARLESTON3@NPC_AGIUP','idle',350,1,2000,0,10000,'yes','self','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3124,'CHARLESTON3@AL_HEAL','idle',28,11,10000,0,3000,'yes','self','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3124,'CHARLESTON3@HW_NAPALMVULCAN','chase',400,5,3000,500,10000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3124,'CHARLESTON3@WZ_VERMILION','chase',85,5,2000,1000,15000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3124,'CHARLESTON3@HW_NAPALMVULCAN','attack',400,5,3000,500,10000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3124,'CHARLESTON3@WZ_VERMILION','attack',85,21,1500,4000,20000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3124,'CHARLESTON3@WZ_METEOR','attack',83,11,1500,4000,20000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3125,'STEP@SM_BASH','attack',5,5,1000,0,5000,'yes','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3126,'ROCK_STEP@BS_HAMMERFALL','attack',110,5,1000,1000,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3127,'KICK_STEP@ASC_BREAKER','attack',379,5,1000,0,5000,'yes','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3128,'KICK_AND_KICK@NPC_STUNATTACK','attack',179,3,500,1000,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3253,'SYS_MSG@AL_HEAL','attack',28,11,5000,500,5000,'yes','friend','friendhpltmaxrate','50',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3253,'SYS_MSG@AL_HEAL','chase',28,11,5000,500,5000,'yes','friend','friendhpltmaxrate','50',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3253,'SYS_MSG@AL_HEAL','idle',28,11,5000,500,5000,'yes','friend','friendhpltmaxrate','50',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_PIERCINGATT','attack',158,10,3000,0,30000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_PIERCINGATT','chase',158,10,5000,0,5000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_SILENCEATTACK','attack',178,5,7500,250,10000,'no','target','casttargeted','0',NULL,NULL,NULL,NULL,NULL,'6',NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_SILENCEATTACK','chase',178,5,7500,250,3000,'no','target','casttargeted','0',NULL,NULL,NULL,NULL,NULL,'6',NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_WIDESLEEP','attack',668,5,4000,0,15000,'no','self','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_WIDESTONE','attack',666,5,6000,0,30000,'no','self','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_WIDESOULDRAIN','attack',680,10,10000,0,60000,'no','self','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+REPLACE INTO `mob_skill_db_re` VALUES (3254,'T_W_O@NPC_CRITICALWOUND','attack',673,5,1500,500,45000,'no','target','always','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 
 
 REPLACE INTO `mob_skill_db_re` VALUES (3505,'DR_BIG_EGGRING@NPC_SUMMONSLAVE','attack',196,4,10000,2000,10000,'no','self','slavele','3',3508,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `mob_skill_db_re` VALUES (3505,'DR_BIG_EGGRING@NPC_SUMMONSLAVE','attack',196,4,10000,2000,10000,'no','self','slavele','3',3508,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `mob_skill_db_re` VALUES (3505,'DR_BIG_EGGRING@NPC_SUMMONSLAVE','idle',196,4,10000,2000,10000,'no','self','slavele','3',3508,NULL,NULL,NULL,NULL,NULL,NULL);
 REPLACE INTO `mob_skill_db_re` VALUES (3505,'DR_BIG_EGGRING@NPC_SUMMONSLAVE','idle',196,4,10000,2000,10000,'no','self','slavele','3',3508,NULL,NULL,NULL,NULL,NULL,NULL);

+ 7 - 7
sql-files/upgrades/premium_storage.sql

@@ -1,20 +1,20 @@
 --
 --
--- Table structure for table `storage_1`
+-- Table structure for table `vip_storage`
 --
 --
 
 
-CREATE TABLE IF NOT EXISTS `storage_1` (
+CREATE TABLE IF NOT EXISTS `vip_storage` (
   `id` int(11) unsigned NOT NULL auto_increment,
   `id` int(11) unsigned NOT NULL auto_increment,
   `account_id` int(11) unsigned NOT NULL default '0',
   `account_id` int(11) unsigned NOT NULL default '0',
-  `nameid` smallint(5) unsigned NOT NULL default '0',
+  `nameid` int(10) unsigned NOT NULL default '0',
   `amount` smallint(11) unsigned NOT NULL default '0',
   `amount` smallint(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `identify` smallint(6) unsigned NOT NULL default '0',
   `identify` smallint(6) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
-  `card0` smallint(5) unsigned NOT NULL default '0',
-  `card1` smallint(5) unsigned NOT NULL default '0',
-  `card2` smallint(5) unsigned NOT NULL default '0',
-  `card3` smallint(5) unsigned NOT NULL default '0',
+  `card0` int(10) unsigned NOT NULL default '0',
+  `card1` int(10) unsigned NOT NULL default '0',
+  `card2` int(10) unsigned NOT NULL default '0',
+  `card3` int(10) unsigned NOT NULL default '0',
   `option_id0` smallint(5) unsigned NOT NULL default '0',
   `option_id0` smallint(5) unsigned NOT NULL default '0',
   `option_val0` smallint(5) unsigned NOT NULL default '0',
   `option_val0` smallint(5) unsigned NOT NULL default '0',
   `option_parm0` tinyint(3) unsigned NOT NULL default '0',
   `option_parm0` tinyint(3) unsigned NOT NULL default '0',

+ 11 - 0
sql-files/upgrades/upgrade_20200505.sql

@@ -0,0 +1,11 @@
+-- WL_SUMMONFB
+UPDATE `char` c, `skill` s SET `c`.skill_point = `c`.skill_point + (`s`.lv - 2), `s`.lv = 2 WHERE `s`.id = 2222 AND `s`.lv > 2 AND `c`.char_id = `s`.char_id;
+
+-- WL_SUMMONBL
+UPDATE `char` c, `skill` s SET `c`.skill_point = `c`.skill_point + (`s`.lv - 2), `s`.lv = 2 WHERE `s`.id = 2223 AND `s`.lv > 2 AND `c`.char_id = `s`.char_id;
+
+-- WL_SUMMONWB
+UPDATE `char` c, `skill` s SET `c`.skill_point = `c`.skill_point + (`s`.lv - 2), `s`.lv = 2 WHERE `s`.id = 2224 AND `s`.lv > 2 AND `c`.char_id = `s`.char_id;
+
+-- WL_SUMMONSTONE
+UPDATE `char` c, `skill` s SET `c`.skill_point = `c`.skill_point + (`s`.lv - 2), `s`.lv = 2 WHERE `s`.id = 2229 AND `s`.lv > 2 AND `c`.char_id = `s`.char_id;

+ 139 - 0
sql-files/upgrades/upgrade_20200808.sql

@@ -0,0 +1,139 @@
+ALTER TABLE `auction`
+	MODIFY `nameid` int(10) unsigned NOT NULL default '0',
+	MODIFY `card0` int(10) unsigned NOT NULL default '0',
+	MODIFY `card1` int(10) unsigned NOT NULL default '0',
+	MODIFY `card2` int(10) unsigned NOT NULL default '0',
+	MODIFY `card3` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `cart_inventory`
+	MODIFY `nameid` int(10) unsigned NOT NULL default '0',
+	MODIFY `card0` int(10) unsigned NOT NULL default '0',
+	MODIFY `card1` int(10) unsigned NOT NULL default '0',
+	MODIFY `card2` int(10) unsigned NOT NULL default '0',
+	MODIFY `card3` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `db_roulette`
+	MODIFY `item_id` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `guild_storage`
+	MODIFY `nameid` int(10) unsigned NOT NULL default '0',
+	MODIFY `card0` int(10) unsigned NOT NULL default '0',
+	MODIFY `card1` int(10) unsigned NOT NULL default '0',
+	MODIFY `card2` int(10) unsigned NOT NULL default '0',
+	MODIFY `card3` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `guild_storage_log`
+	MODIFY `nameid` int(10) unsigned NOT NULL default '0',
+	MODIFY `card0` int(10) unsigned NOT NULL default '0',
+	MODIFY `card1` int(10) unsigned NOT NULL default '0',
+	MODIFY `card2` int(10) unsigned NOT NULL default '0',
+	MODIFY `card3` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `inventory`
+	MODIFY `nameid` int(10) unsigned NOT NULL default '0',
+	MODIFY `card0` int(10) unsigned NOT NULL default '0',
+	MODIFY `card1` int(10) unsigned NOT NULL default '0',
+	MODIFY `card2` int(10) unsigned NOT NULL default '0',
+	MODIFY `card3` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `mail_attachments`
+	MODIFY `nameid` int(10) unsigned NOT NULL default '0',
+	MODIFY `card0` int(10) unsigned NOT NULL default '0',
+	MODIFY `card1` int(10) unsigned NOT NULL default '0',
+	MODIFY `card2` int(10) unsigned NOT NULL default '0',
+	MODIFY `card3` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `market`
+	MODIFY `nameid` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `pet`
+	MODIFY `egg_id` int(10) unsigned NOT NULL default '0',
+	MODIFY `equip` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `sales`
+	MODIFY `nameid` int(10) unsigned NOT NULL;
+
+ALTER TABLE `storage`
+	MODIFY `nameid` int(10) unsigned NOT NULL default '0',
+	MODIFY `card0` int(10) unsigned NOT NULL default '0',
+	MODIFY `card1` int(10) unsigned NOT NULL default '0',
+	MODIFY `card2` int(10) unsigned NOT NULL default '0',
+	MODIFY `card3` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `item_cash_db`
+	MODIFY `item_id` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `item_cash_db2`
+	MODIFY `item_id` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `item_db`
+	MODIFY `id` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `item_db_re`
+	MODIFY `id` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `item_db2`
+	MODIFY `id` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `item_db2_re`
+	MODIFY `id` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `mob_db`
+	MODIFY `MVP1id` int(10) unsigned NOT NULL default '0',
+	MODIFY `MVP2id` int(10) unsigned NOT NULL default '0',
+	MODIFY `MVP3id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop1id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop2id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop3id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop4id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop5id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop6id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop7id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop8id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop9id` int(10) unsigned NOT NULL default '0',
+	MODIFY `DropCardid` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `mob_db_re`
+	MODIFY `MVP1id` int(10) unsigned NOT NULL default '0',
+	MODIFY `MVP2id` int(10) unsigned NOT NULL default '0',
+	MODIFY `MVP3id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop1id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop2id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop3id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop4id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop5id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop6id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop7id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop8id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop9id` int(10) unsigned NOT NULL default '0',
+	MODIFY `DropCardid` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `mob_db2`
+	MODIFY `MVP1id` int(10) unsigned NOT NULL default '0',
+	MODIFY `MVP2id` int(10) unsigned NOT NULL default '0',
+	MODIFY `MVP3id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop1id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop2id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop3id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop4id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop5id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop6id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop7id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop8id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop9id` int(10) unsigned NOT NULL default '0',
+	MODIFY `DropCardid` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `mob_db2_re`
+	MODIFY `MVP1id` int(10) unsigned NOT NULL default '0',
+	MODIFY `MVP2id` int(10) unsigned NOT NULL default '0',
+	MODIFY `MVP3id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop1id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop2id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop3id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop4id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop5id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop6id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop7id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop8id` int(10) unsigned NOT NULL default '0',
+	MODIFY `Drop9id` int(10) unsigned NOT NULL default '0',
+	MODIFY `DropCardid` int(10) unsigned NOT NULL default '0';

+ 12 - 0
sql-files/upgrades/upgrade_20200808_logs.sql

@@ -0,0 +1,12 @@
+ALTER TABLE `feedinglog`
+	MODIFY `item_id` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `mvplog`
+	MODIFY `prize` int(10) unsigned NOT NULL default '0';
+
+ALTER TABLE `picklog`
+	MODIFY `nameid` int(10) unsigned NOT NULL default '0',
+	MODIFY `card0` int(10) unsigned NOT NULL default '0',
+	MODIFY `card1` int(10) unsigned NOT NULL default '0',
+	MODIFY `card2` int(10) unsigned NOT NULL default '0',
+	MODIFY `card3` int(10) unsigned NOT NULL default '0';

+ 21 - 0
sql-files/upgrades/upgrade_20200811.sql

@@ -0,0 +1,21 @@
+-- Verus police quests
+DELETE FROM `char_reg_num` WHERE `key` = 'trap_doom_prayers' AND `index` = 0;
+DELETE FROM `char_reg_num` WHERE `key` = 'count_stone_seiden' AND `index` = 0;
+-- Verus Wandering Bard quest
+DELETE FROM `char_reg_num` WHERE `key` = 'wandering_bard_quest' AND `index` = 0;
+-- To Phantasmagorika! quest
+UPDATE `char_reg_num` SET `key` = 'ep15_1_elb' WHERE `key` = 'VER_ELEVATOR' AND `value` < 100 AND `index` = 0;
+UPDATE `char_reg_num` SET `key` = 'ep15_1_elb', `value` = `value` - 94 WHERE `key` = 'VER_ELEVATOR' AND `value` >= 100 AND `value` < 1000 AND `index` = 0;
+-- Vestige quest
+UPDATE `char_reg_num` SET `key` = 'ep15_2_bslast', `value` = `value` - 999 WHERE `key` = 'VER_ELEVATOR' AND `value` >= 1000 AND `index` = 0;
+-- Krotzel's Request quests
+UPDATE `char_reg_num` SET `key` = 'ep15_2_brigan' WHERE `key` = 'VER_REPORTER' AND `index` = 0;
+-- Main quest
+INSERT INTO `char_reg_num` (`char_id`, `key`, `index`, `value`) SELECT `char_id`, 'ep15_2_permit', 0, 1 FROM `char_reg_num` WHERE `key` = 'VER_MAIN' AND `value` >= 19 AND `index` = 0;
+UPDATE `char_reg_num` SET `key` = 'ep15_1_atnad' WHERE `key` = 'VER_MAIN' AND `value` < 31 AND `index` = 0;
+UPDATE `char_reg_num` SET `key` = 'ep15_1_atnad', `value` = 30 WHERE `key` = 'VER_MAIN' AND `value` > 30 AND `value` < 37 AND `index` = 0;
+UPDATE `char_reg_num` SET `key` = 'ep15_1_atnad', `value` = `value` - 6 WHERE `key` = 'VER_MAIN' AND `value` > 36 AND `index` = 0;
+DELETE FROM `char_reg_num` WHERE `key` = 'VERUS_DAILY_QUEST' AND `index` = 0;
+-- Memory quest
+DELETE FROM `char_reg_num` WHERE `key` = 'recorder_quest_type' AND `index` = 0;
+DELETE FROM `char_reg_num` WHERE `key` = 'recorder_quest_status' AND `index` = 0;

+ 17 - 16
src/char/char.cpp

@@ -586,7 +586,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
 	}
 	}
 
 
 	SqlStmt_BindColumn(stmt, 0, SQLDT_INT,       &item.id,          0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 0, SQLDT_INT,       &item.id,          0, NULL, NULL);
-	SqlStmt_BindColumn(stmt, 1, SQLDT_USHORT,    &item.nameid,      0, NULL, NULL);
+	SqlStmt_BindColumn(stmt, 1, SQLDT_UINT,    &item.nameid,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT,     &item.amount,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT,     &item.amount,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 3, SQLDT_UINT,      &item.equip,       0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 3, SQLDT_UINT,      &item.equip,       0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,      &item.identify,    0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,      &item.identify,    0, NULL, NULL);
@@ -600,7 +600,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
 		SqlStmt_BindColumn(stmt, 11, SQLDT_UINT, &item.equipSwitch, 0, NULL, NULL);
 		SqlStmt_BindColumn(stmt, 11, SQLDT_UINT, &item.equipSwitch, 0, NULL, NULL);
 	}
 	}
 	for( i = 0; i < MAX_SLOTS; ++i )
 	for( i = 0; i < MAX_SLOTS; ++i )
-		SqlStmt_BindColumn(stmt, 10+offset+i, SQLDT_USHORT, &item.card[i], 0, NULL, NULL);
+		SqlStmt_BindColumn(stmt, 10+offset+i, SQLDT_UINT, &item.card[i], 0, NULL, NULL);
 	for( i = 0; i < MAX_ITEM_RDM_OPT; ++i ) {
 	for( i = 0; i < MAX_ITEM_RDM_OPT; ++i ) {
 		SqlStmt_BindColumn(stmt, 10+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, NULL, NULL);
 		SqlStmt_BindColumn(stmt, 10+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, NULL, NULL);
 		SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, NULL, NULL);
 		SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, NULL, NULL);
@@ -650,7 +650,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
 					if (tableswitch == TABLE_INVENTORY)
 					if (tableswitch == TABLE_INVENTORY)
 						StringBuf_Printf(&buf, ", `favorite`='%d', `equip_switch`='%u'", items[i].favorite, items[i].equipSwitch);
 						StringBuf_Printf(&buf, ", `favorite`='%d', `equip_switch`='%u'", items[i].favorite, items[i].equipSwitch);
 					for( j = 0; j < MAX_SLOTS; ++j )
 					for( j = 0; j < MAX_SLOTS; ++j )
-						StringBuf_Printf(&buf, ", `card%d`=%hu", j, items[i].card[j]);
+						StringBuf_Printf(&buf, ", `card%d`=%u", j, items[i].card[j]);
 					for( j = 0; j < MAX_ITEM_RDM_OPT; ++j ) {
 					for( j = 0; j < MAX_ITEM_RDM_OPT; ++j ) {
 						StringBuf_Printf(&buf, ", `option_id%d`=%d", j, items[i].option[j].id);
 						StringBuf_Printf(&buf, ", `option_id%d`=%d", j, items[i].option[j].id);
 						StringBuf_Printf(&buf, ", `option_val%d`=%d", j, items[i].option[j].value);
 						StringBuf_Printf(&buf, ", `option_val%d`=%d", j, items[i].option[j].value);
@@ -706,12 +706,12 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
 		else
 		else
 			found = true;
 			found = true;
 
 
-		StringBuf_Printf(&buf, "('%d', '%hu', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" PRIu64 "'",
+		StringBuf_Printf(&buf, "('%d', '%u', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" PRIu64 "'",
 			id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id);
 			id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id);
 		if (tableswitch == TABLE_INVENTORY)
 		if (tableswitch == TABLE_INVENTORY)
 			StringBuf_Printf(&buf, ", '%d', '%u'", items[i].favorite, items[i].equipSwitch);
 			StringBuf_Printf(&buf, ", '%d', '%u'", items[i].favorite, items[i].equipSwitch);
 		for( j = 0; j < MAX_SLOTS; ++j )
 		for( j = 0; j < MAX_SLOTS; ++j )
-			StringBuf_Printf(&buf, ", '%hu'", items[i].card[j]);
+			StringBuf_Printf(&buf, ", '%u'", items[i].card[j]);
 		for( j = 0; j < MAX_ITEM_RDM_OPT; ++j ) {
 		for( j = 0; j < MAX_ITEM_RDM_OPT; ++j ) {
 			StringBuf_Printf(&buf, ", '%d'", items[i].option[j].id);
 			StringBuf_Printf(&buf, ", '%d'", items[i].option[j].id);
 			StringBuf_Printf(&buf, ", '%d'", items[i].option[j].value);
 			StringBuf_Printf(&buf, ", '%d'", items[i].option[j].value);
@@ -812,7 +812,7 @@ bool char_memitemdata_from_sql(struct s_storage* p, int max, int id, enum storag
 	}
 	}
 
 
 	SqlStmt_BindColumn(stmt, 0, SQLDT_INT,          &item.id,        0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 0, SQLDT_INT,          &item.id,        0, NULL, NULL);
-	SqlStmt_BindColumn(stmt, 1, SQLDT_USHORT,       &item.nameid,    0, NULL, NULL);
+	SqlStmt_BindColumn(stmt, 1, SQLDT_UINT,         &item.nameid,    0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT,        &item.amount,    0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT,        &item.amount,    0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 3, SQLDT_UINT,         &item.equip,     0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 3, SQLDT_UINT,         &item.equip,     0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,         &item.identify,  0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,         &item.identify,  0, NULL, NULL);
@@ -826,7 +826,7 @@ bool char_memitemdata_from_sql(struct s_storage* p, int max, int id, enum storag
 		SqlStmt_BindColumn(stmt, 11, SQLDT_UINT, &item.equipSwitch, 0, NULL, NULL);
 		SqlStmt_BindColumn(stmt, 11, SQLDT_UINT, &item.equipSwitch, 0, NULL, NULL);
 	}
 	}
 	for( i = 0; i < MAX_SLOTS; ++i )
 	for( i = 0; i < MAX_SLOTS; ++i )
-		SqlStmt_BindColumn(stmt, 10+offset+i, SQLDT_USHORT, &item.card[i],   0, NULL, NULL);
+		SqlStmt_BindColumn(stmt, 10+offset+i, SQLDT_UINT, &item.card[i],   0, NULL, NULL);
  	for( i = 0; i < MAX_ITEM_RDM_OPT; ++i ) {
  	for( i = 0; i < MAX_ITEM_RDM_OPT; ++i ) {
 		SqlStmt_BindColumn(stmt, 10+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, NULL, NULL);
 		SqlStmt_BindColumn(stmt, 10+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, NULL, NULL);
 		SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, NULL, NULL);
 		SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, NULL, NULL);
@@ -1490,7 +1490,7 @@ int char_make_new_char( struct char_session_data* sd, char* name_, int str, int
 	char_id = (int)Sql_LastInsertId(sql_handle);
 	char_id = (int)Sql_LastInsertId(sql_handle);
 	//Give the char the default items
 	//Give the char the default items
 	for (k = 0; k <= MAX_STARTITEM && tmp_start_items[k].nameid != 0; k++) {
 	for (k = 0; k <= MAX_STARTITEM && tmp_start_items[k].nameid != 0; k++) {
-		if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `equip`, `identify`) VALUES ('%d', '%hu', '%hu', '%hu', '%d')", schema_config.inventory_db, char_id, tmp_start_items[k].nameid, tmp_start_items[k].amount, tmp_start_items[k].pos, 1) )
+		if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `equip`, `identify`) VALUES ('%d', '%u', '%hu', '%u', '%d')", schema_config.inventory_db, char_id, tmp_start_items[k].nameid, tmp_start_items[k].amount, tmp_start_items[k].pos, 1) )
 			Sql_ShowDebug(sql_handle);
 			Sql_ShowDebug(sql_handle);
 	}
 	}
 
 
@@ -1504,7 +1504,7 @@ int char_make_new_char( struct char_session_data* sd, char* name_, int str, int
 int char_divorce_char_sql(int partner_id1, int partner_id2){
 int char_divorce_char_sql(int partner_id1, int partner_id2){
 	if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", schema_config.char_db, partner_id1, partner_id2) )
 	if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", schema_config.char_db, partner_id1, partner_id2) )
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
-	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%hu' OR `nameid`='%hu') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", schema_config.inventory_db, WEDDING_RING_M, WEDDING_RING_F, partner_id1, partner_id2) )
+	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%u' OR `nameid`='%u') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", schema_config.inventory_db, WEDDING_RING_M, WEDDING_RING_F, partner_id1, partner_id2) )
 		Sql_ShowDebug(sql_handle);
 		Sql_ShowDebug(sql_handle);
 	chmapif_send_ackdivorce(partner_id1, partner_id2);
 	chmapif_send_ackdivorce(partner_id1, partner_id2);
 	return 0;
 	return 0;
@@ -2739,18 +2739,18 @@ void char_set_defaults(){
 
 
 	charserv_config.start_items[0].nameid = 1201;
 	charserv_config.start_items[0].nameid = 1201;
 	charserv_config.start_items[0].amount = 1;
 	charserv_config.start_items[0].amount = 1;
-	charserv_config.start_items[0].pos = 2;
+	charserv_config.start_items[0].pos = EQP_HAND_R;
 	charserv_config.start_items[1].nameid = 2301;
 	charserv_config.start_items[1].nameid = 2301;
 	charserv_config.start_items[1].amount = 1;
 	charserv_config.start_items[1].amount = 1;
-	charserv_config.start_items[1].pos = 16;
+	charserv_config.start_items[1].pos = EQP_ARMOR;
 
 
 #if PACKETVER >= 20150101
 #if PACKETVER >= 20150101
 	charserv_config.start_items_doram[0].nameid = 1681;
 	charserv_config.start_items_doram[0].nameid = 1681;
 	charserv_config.start_items_doram[0].amount = 1;
 	charserv_config.start_items_doram[0].amount = 1;
-	charserv_config.start_items_doram[0].pos = 2;
+	charserv_config.start_items_doram[0].pos = EQP_HAND_R;
 	charserv_config.start_items_doram[1].nameid = 2301;
 	charserv_config.start_items_doram[1].nameid = 2301;
 	charserv_config.start_items_doram[1].amount = 1;
 	charserv_config.start_items_doram[1].amount = 1;
-	charserv_config.start_items_doram[1].pos = 16;
+	charserv_config.start_items_doram[1].pos = EQP_ARMOR;
 #endif
 #endif
 
 
 	charserv_config.console = 0;
 	charserv_config.console = 0;
@@ -2848,9 +2848,10 @@ void char_config_split_startitem(char *w1_value, char *w2_value, struct startite
 		}
 		}
 
 
 		// TODO: Item ID verification
 		// TODO: Item ID verification
-		start_items[i].nameid = max(0, atoi(fields[1]));
-		start_items[i].amount = max(0, atoi(fields[2]));
-		start_items[i].pos = max(0, atoi(fields[3]));
+		start_items[i].nameid = strtoul( fields[1], nullptr, 10 );
+		// TODO: Stack verification
+		start_items[i].amount = min( (uint16)strtoul( fields[2], nullptr, 10 ), MAX_AMOUNT );
+		start_items[i].pos = strtoul( fields[3], nullptr, 10 );
 
 
 		lineitem = strtok(NULL, ":"); //next lineitem
 		lineitem = strtok(NULL, ":"); //next lineitem
 		i++;
 		i++;

+ 2 - 2
src/char/int_achievement.cpp

@@ -320,8 +320,8 @@ int mapif_parse_achievement_reward(int fd){
 		struct item item;
 		struct item item;
 
 
 		memset(&item, 0, sizeof(struct item));
 		memset(&item, 0, sizeof(struct item));
-		item.nameid = RFIFOW(fd, 10);
-		item.amount = RFIFOL(fd, 12);
+		item.nameid = RFIFOL(fd, 10);
+		item.amount = RFIFOW(fd, 14);
 		item.identify = 1;
 		item.identify = 1;
 
 
 		safesnprintf(mail_sender, NAME_LENGTH, char_msg_txt(227)); // 227: GM
 		safesnprintf(mail_sender, NAME_LENGTH, char_msg_txt(227)); // 227: GM

+ 6 - 6
src/char/int_auction.cpp

@@ -51,10 +51,10 @@ void auction_save(struct auction_data *auction)
 		return;
 		return;
 
 
 	StringBuf_Init(&buf);
 	StringBuf_Init(&buf);
-	StringBuf_Printf(&buf, "UPDATE `%s` SET `seller_id` = '%d', `seller_name` = ?, `buyer_id` = '%d', `buyer_name` = ?, `price` = '%d', `buynow` = '%d', `hours` = '%d', `timestamp` = '%lu', `nameid` = '%hu', `item_name` = ?, `type` = '%d', `refine` = '%d', `attribute` = '%d'",
+	StringBuf_Printf(&buf, "UPDATE `%s` SET `seller_id` = '%d', `seller_name` = ?, `buyer_id` = '%d', `buyer_name` = ?, `price` = '%d', `buynow` = '%d', `hours` = '%d', `timestamp` = '%lu', `nameid` = '%u', `item_name` = ?, `type` = '%d', `refine` = '%d', `attribute` = '%d'",
 		schema_config.auction_db, auction->seller_id, auction->buyer_id, auction->price, auction->buynow, auction->hours, (unsigned long)auction->timestamp, auction->item.nameid, auction->type, auction->item.refine, auction->item.attribute);
 		schema_config.auction_db, auction->seller_id, auction->buyer_id, auction->price, auction->buynow, auction->hours, (unsigned long)auction->timestamp, auction->item.nameid, auction->type, auction->item.refine, auction->item.attribute);
 	for( j = 0; j < MAX_SLOTS; j++ )
 	for( j = 0; j < MAX_SLOTS; j++ )
-		StringBuf_Printf(&buf, ", `card%d` = '%hu'", j, auction->item.card[j]);
+		StringBuf_Printf(&buf, ", `card%d` = '%u'", j, auction->item.card[j]);
 	for (j = 0; j < MAX_ITEM_RDM_OPT; j++) {
 	for (j = 0; j < MAX_ITEM_RDM_OPT; j++) {
 		StringBuf_Printf(&buf, ", `option_id%d` = '%d'", j, auction->item.option[j].id);
 		StringBuf_Printf(&buf, ", `option_id%d` = '%d'", j, auction->item.option[j].id);
 		StringBuf_Printf(&buf, ", `option_val%d` = '%d'", j, auction->item.option[j].value);
 		StringBuf_Printf(&buf, ", `option_val%d` = '%d'", j, auction->item.option[j].value);
@@ -96,10 +96,10 @@ unsigned int auction_create(struct auction_data *auction)
 		StringBuf_Printf(&buf, ", `option_val%d`", j);
 		StringBuf_Printf(&buf, ", `option_val%d`", j);
 		StringBuf_Printf(&buf, ", `option_parm%d`", j);
 		StringBuf_Printf(&buf, ", `option_parm%d`", j);
 	}
 	}
-	StringBuf_Printf(&buf, ") VALUES ('%d',?,'%d',?,'%d','%d','%d','%lu','%hu',?,'%d','%d','%d','%" PRIu64 "'",
+	StringBuf_Printf(&buf, ") VALUES ('%d',?,'%d',?,'%d','%d','%d','%lu','%u',?,'%d','%d','%d','%" PRIu64 "'",
 		auction->seller_id, auction->buyer_id, auction->price, auction->buynow, auction->hours, (unsigned long)auction->timestamp, auction->item.nameid, auction->type, auction->item.refine, auction->item.attribute, auction->item.unique_id);
 		auction->seller_id, auction->buyer_id, auction->price, auction->buynow, auction->hours, (unsigned long)auction->timestamp, auction->item.nameid, auction->type, auction->item.refine, auction->item.attribute, auction->item.unique_id);
 	for( j = 0; j < MAX_SLOTS; j++ )	
 	for( j = 0; j < MAX_SLOTS; j++ )	
-		StringBuf_Printf(&buf, ",'%hu'", auction->item.card[j]);
+		StringBuf_Printf(&buf, ",'%u'", auction->item.card[j]);
 	for (j = 0; j < MAX_ITEM_RDM_OPT; ++j) {
 	for (j = 0; j < MAX_ITEM_RDM_OPT; ++j) {
 		StringBuf_Printf(&buf, ", '%d'", auction->item.option[j].id);
 		StringBuf_Printf(&buf, ", '%d'", auction->item.option[j].id);
 		StringBuf_Printf(&buf, ", '%d'", auction->item.option[j].value);
 		StringBuf_Printf(&buf, ", '%d'", auction->item.option[j].value);
@@ -227,7 +227,7 @@ void inter_auctions_fromsql(void)
 		Sql_GetData(sql_handle, 8, &data, NULL); auction->timestamp = atoi(data);
 		Sql_GetData(sql_handle, 8, &data, NULL); auction->timestamp = atoi(data);
 
 
 		item = &auction->item;
 		item = &auction->item;
-		Sql_GetData(sql_handle, 9, &data, NULL); item->nameid = atoi(data);
+		Sql_GetData(sql_handle, 9, &data, NULL); item->nameid = strtoul(data, nullptr, 10);
 		Sql_GetData(sql_handle,10, &data, NULL); safestrncpy(auction->item_name, data, ITEM_NAME_LENGTH);
 		Sql_GetData(sql_handle,10, &data, NULL); safestrncpy(auction->item_name, data, ITEM_NAME_LENGTH);
 		Sql_GetData(sql_handle,11, &data, NULL); auction->type = atoi(data);
 		Sql_GetData(sql_handle,11, &data, NULL); auction->type = atoi(data);
 
 
@@ -242,7 +242,7 @@ void inter_auctions_fromsql(void)
 		for( i = 0; i < MAX_SLOTS; i++ )
 		for( i = 0; i < MAX_SLOTS; i++ )
 		{
 		{
 			Sql_GetData(sql_handle, 15 + i, &data, NULL);
 			Sql_GetData(sql_handle, 15 + i, &data, NULL);
-			item->card[i] = atoi(data);
+			item->card[i] = strtoul(data, nullptr, 10);
 		}
 		}
 
 
 		for (i = 0; i < MAX_ITEM_RDM_OPT; i++) {
 		for (i = 0; i < MAX_ITEM_RDM_OPT; i++) {

+ 4 - 4
src/char/int_mail.cpp

@@ -127,9 +127,9 @@ int mail_savemessage(struct mail_message* msg)
 			found = true;
 			found = true;
 		}
 		}
 
 
-		StringBuf_Printf(&buf, "('%" PRIu64 "', '%hu', '%d', '%hu', '%d', '%d', '%d', '%" PRIu64 "', '%d'", (uint64)msg->id, i, msg->item[i].amount, msg->item[i].nameid, msg->item[i].refine, msg->item[i].attribute, msg->item[i].identify, msg->item[i].unique_id, msg->item[i].bound);
+		StringBuf_Printf(&buf, "('%" PRIu64 "', '%hu', '%d', '%u', '%d', '%d', '%d', '%" PRIu64 "', '%d'", (uint64)msg->id, i, msg->item[i].amount, msg->item[i].nameid, msg->item[i].refine, msg->item[i].attribute, msg->item[i].identify, msg->item[i].unique_id, msg->item[i].bound);
 		for (j = 0; j < MAX_SLOTS; j++)
 		for (j = 0; j < MAX_SLOTS; j++)
-			StringBuf_Printf(&buf, ", '%hu'", msg->item[i].card[j]);
+			StringBuf_Printf(&buf, ", '%u'", msg->item[i].card[j]);
 		for (j = 0; j < MAX_ITEM_RDM_OPT; ++j) {
 		for (j = 0; j < MAX_ITEM_RDM_OPT; ++j) {
 			StringBuf_Printf(&buf, ", '%d'", msg->item[i].option[j].id);
 			StringBuf_Printf(&buf, ", '%d'", msg->item[i].option[j].id);
 			StringBuf_Printf(&buf, ", '%d'", msg->item[i].option[j].value);
 			StringBuf_Printf(&buf, ", '%d'", msg->item[i].option[j].value);
@@ -209,7 +209,7 @@ bool mail_loadmessage(int mail_id, struct mail_message* msg)
 
 
 	for( i = 0; i < MAIL_MAX_ITEM && SQL_SUCCESS == Sql_NextRow(sql_handle); i++ ){
 	for( i = 0; i < MAIL_MAX_ITEM && SQL_SUCCESS == Sql_NextRow(sql_handle); i++ ){
 		Sql_GetData(sql_handle,0, &data, NULL); msg->item[i].amount = (short)atoi(data);
 		Sql_GetData(sql_handle,0, &data, NULL); msg->item[i].amount = (short)atoi(data);
-		Sql_GetData(sql_handle,1, &data, NULL); msg->item[i].nameid = atoi(data);
+		Sql_GetData(sql_handle,1, &data, NULL); msg->item[i].nameid = strtoul(data, nullptr, 10);
 		Sql_GetData(sql_handle,2, &data, NULL); msg->item[i].refine = atoi(data);
 		Sql_GetData(sql_handle,2, &data, NULL); msg->item[i].refine = atoi(data);
 		Sql_GetData(sql_handle,3, &data, NULL); msg->item[i].attribute = atoi(data);
 		Sql_GetData(sql_handle,3, &data, NULL); msg->item[i].attribute = atoi(data);
 		Sql_GetData(sql_handle,4, &data, NULL); msg->item[i].identify = atoi(data);
 		Sql_GetData(sql_handle,4, &data, NULL); msg->item[i].identify = atoi(data);
@@ -218,7 +218,7 @@ bool mail_loadmessage(int mail_id, struct mail_message* msg)
 		msg->item[i].expire_time = 0;
 		msg->item[i].expire_time = 0;
 
 
 		for( j = 0; j < MAX_SLOTS; j++ ){
 		for( j = 0; j < MAX_SLOTS; j++ ){
-			Sql_GetData(sql_handle,7 + j, &data, NULL); msg->item[i].card[j] = atoi(data);
+			Sql_GetData(sql_handle,7 + j, &data, NULL); msg->item[i].card[j] = strtoul(data, nullptr, 10);
 		}
 		}
 
 
 		for( j = 0; j < MAX_ITEM_RDM_OPT; j++ ){
 		for( j = 0; j < MAX_ITEM_RDM_OPT; j++ ){

+ 7 - 7
src/char/int_pet.cpp

@@ -34,7 +34,7 @@ int inter_pet_tosql(int pet_id, struct s_pet* p)
 	{// New pet.
 	{// New pet.
 		if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` "
 		if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` "
 			"(`class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incubate`,`autofeed`) "
 			"(`class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incubate`,`autofeed`) "
-			"VALUES ('%d', '%s', '%d', '%d', '%d', '%hu', '%hu', '%d', '%d', '%d', '%d', '%d')",
+			"VALUES ('%d', '%s', '%d', '%d', '%d', '%u', '%u', '%d', '%d', '%d', '%d', '%d')",
 			schema_config.pet_db, p->class_, esc_name, p->account_id, p->char_id, p->level, p->egg_id,
 			schema_config.pet_db, p->class_, esc_name, p->account_id, p->char_id, p->level, p->egg_id,
 			p->equip, p->intimate, p->hungry, p->rename_flag, p->incubate, p->autofeed) )
 			p->equip, p->intimate, p->hungry, p->rename_flag, p->incubate, p->autofeed) )
 		{
 		{
@@ -45,7 +45,7 @@ int inter_pet_tosql(int pet_id, struct s_pet* p)
 	}
 	}
 	else
 	else
 	{// Update pet.
 	{// Update pet.
-		if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `class`='%d',`name`='%s',`account_id`='%d',`char_id`='%d',`level`='%d',`egg_id`='%hu',`equip`='%hu',`intimate`='%d',`hungry`='%d',`rename_flag`='%d',`incubate`='%d',`autofeed`='%d' WHERE `pet_id`='%d'",
+		if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `class`='%d',`name`='%s',`account_id`='%d',`char_id`='%d',`level`='%d',`egg_id`='%u',`equip`='%u',`intimate`='%d',`hungry`='%d',`rename_flag`='%d',`incubate`='%d',`autofeed`='%d' WHERE `pet_id`='%d'",
 			schema_config.pet_db, p->class_, esc_name, p->account_id, p->char_id, p->level, p->egg_id,
 			schema_config.pet_db, p->class_, esc_name, p->account_id, p->char_id, p->level, p->egg_id,
 			p->equip, p->intimate, p->hungry, p->rename_flag, p->incubate, p->autofeed, p->pet_id) )
 			p->equip, p->intimate, p->hungry, p->rename_flag, p->incubate, p->autofeed, p->pet_id) )
 		{
 		{
@@ -85,8 +85,8 @@ int inter_pet_fromsql(int pet_id, struct s_pet* p)
 		Sql_GetData(sql_handle,  3, &data, NULL); p->account_id = atoi(data);
 		Sql_GetData(sql_handle,  3, &data, NULL); p->account_id = atoi(data);
 		Sql_GetData(sql_handle,  4, &data, NULL); p->char_id = atoi(data);
 		Sql_GetData(sql_handle,  4, &data, NULL); p->char_id = atoi(data);
 		Sql_GetData(sql_handle,  5, &data, NULL); p->level = atoi(data);
 		Sql_GetData(sql_handle,  5, &data, NULL); p->level = atoi(data);
-		Sql_GetData(sql_handle,  6, &data, NULL); p->egg_id = atoi(data);
-		Sql_GetData(sql_handle,  7, &data, NULL); p->equip = atoi(data);
+		Sql_GetData(sql_handle,  6, &data, NULL); p->egg_id = strtoul(data, nullptr, 10);
+		Sql_GetData(sql_handle,  7, &data, NULL); p->equip = strtoul(data, nullptr, 10);
 		Sql_GetData(sql_handle,  8, &data, NULL); p->intimate = atoi(data);
 		Sql_GetData(sql_handle,  8, &data, NULL); p->intimate = atoi(data);
 		Sql_GetData(sql_handle,  9, &data, NULL); p->hungry = atoi(data);
 		Sql_GetData(sql_handle,  9, &data, NULL); p->hungry = atoi(data);
 		Sql_GetData(sql_handle, 10, &data, NULL); p->rename_flag = atoi(data);
 		Sql_GetData(sql_handle, 10, &data, NULL); p->rename_flag = atoi(data);
@@ -184,7 +184,7 @@ int mapif_delete_pet_ack(int fd, int flag){
 	return 0;
 	return 0;
 }
 }
 
 
-int mapif_create_pet(int fd, uint32 account_id, uint32 char_id, short pet_class, short pet_lv, unsigned short pet_egg_id, unsigned short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name)
+int mapif_create_pet(int fd, uint32 account_id, uint32 char_id, short pet_class, short pet_lv, t_itemid pet_egg_id, t_itemid pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name)
 {
 {
 	memset(pet_pt, 0, sizeof(struct s_pet));
 	memset(pet_pt, 0, sizeof(struct s_pet));
 	safestrncpy(pet_pt->name, pet_name, NAME_LENGTH);
 	safestrncpy(pet_pt->name, pet_name, NAME_LENGTH);
@@ -280,8 +280,8 @@ int mapif_delete_pet(int fd, int pet_id){
 
 
 int mapif_parse_CreatePet(int fd){
 int mapif_parse_CreatePet(int fd){
 	RFIFOHEAD(fd);
 	RFIFOHEAD(fd);
-	mapif_create_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOW(fd, 14), RFIFOW(fd, 16), RFIFOW(fd, 18),
-		RFIFOW(fd, 20), RFIFOB(fd, 22), RFIFOB(fd, 23), RFIFOCP(fd, 24));
+	mapif_create_pet(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOW(fd, 10), RFIFOW(fd, 12), RFIFOL(fd, 14), RFIFOL(fd, 18), RFIFOW(fd, 22),
+		RFIFOW(fd, 24), RFIFOB(fd, 26), RFIFOB(fd, 27), RFIFOCP(fd, 28));
 	return 0;
 	return 0;
 }
 }
 
 

+ 2 - 2
src/char/int_storage.cpp

@@ -356,7 +356,7 @@ bool mapif_parse_itembound_retrieve(int fd)
 	}
 	}
 
 
 	SqlStmt_BindColumn(stmt, 0, SQLDT_INT,       &item.id,          0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 0, SQLDT_INT,       &item.id,          0, NULL, NULL);
-	SqlStmt_BindColumn(stmt, 1, SQLDT_USHORT,    &item.nameid,      0, NULL, NULL);
+	SqlStmt_BindColumn(stmt, 1, SQLDT_UINT,      &item.nameid,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT,     &item.amount,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT,     &item.amount,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 3, SQLDT_UINT,      &item.equip,       0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 3, SQLDT_UINT,      &item.equip,       0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,      &item.identify,    0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,      &item.identify,    0, NULL, NULL);
@@ -365,7 +365,7 @@ bool mapif_parse_itembound_retrieve(int fd)
 	SqlStmt_BindColumn(stmt, 7, SQLDT_UINT,      &item.expire_time, 0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 7, SQLDT_UINT,      &item.expire_time, 0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 8, SQLDT_UINT,      &item.bound,       0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 8, SQLDT_UINT,      &item.bound,       0, NULL, NULL);
 	for( j = 0; j < MAX_SLOTS; ++j )
 	for( j = 0; j < MAX_SLOTS; ++j )
-		SqlStmt_BindColumn(stmt, 9+j, SQLDT_USHORT, &item.card[j], 0, NULL, NULL);
+		SqlStmt_BindColumn(stmt, 9+j, SQLDT_UINT, &item.card[j], 0, NULL, NULL);
 	for( j = 0; j < MAX_ITEM_RDM_OPT; ++j ) {
 	for( j = 0; j < MAX_ITEM_RDM_OPT; ++j ) {
 		SqlStmt_BindColumn(stmt, 9+MAX_SLOTS+j*3, SQLDT_SHORT, &item.option[j].id, 0, NULL, NULL);
 		SqlStmt_BindColumn(stmt, 9+MAX_SLOTS+j*3, SQLDT_SHORT, &item.option[j].id, 0, NULL, NULL);
 		SqlStmt_BindColumn(stmt, 10+MAX_SLOTS+j*3, SQLDT_SHORT, &item.option[j].value, 0, NULL, NULL);
 		SqlStmt_BindColumn(stmt, 10+MAX_SLOTS+j*3, SQLDT_SHORT, &item.option[j].value, 0, NULL, NULL);

+ 4 - 4
src/char/inter.cpp

@@ -62,7 +62,7 @@ int inter_recv_packet_length[] = {
 	-1,-1,10,10,  0,-1,12, 0,  0, 0, 0, 0,  0, 0,  0, 0,	// 3050-  Auction System [Zephyrus]
 	-1,-1,10,10,  0,-1,12, 0,  0, 0, 0, 0,  0, 0,  0, 0,	// 3050-  Auction System [Zephyrus]
 	 6,-1, 6,-1, 16+NAME_LENGTH+ACHIEVEMENT_NAME_LENGTH, 0, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0,	// 3060-  Quest system [Kevin] [Inkfish] / Achievements [Aleos]
 	 6,-1, 6,-1, 16+NAME_LENGTH+ACHIEVEMENT_NAME_LENGTH, 0, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0,	// 3060-  Quest system [Kevin] [Inkfish] / Achievements [Aleos]
 	-1,10, 6,-1,  0, 0, 0, 0,  0, 0, 0, 0, -1,10,  6,-1,	// 3070-  Mercenary packets [Zephyrus], Elemental packets [pakpil]
 	-1,10, 6,-1,  0, 0, 0, 0,  0, 0, 0, 0, -1,10,  6,-1,	// 3070-  Mercenary packets [Zephyrus], Elemental packets [pakpil]
-	48,14,-1, 6,  0, 0, 0, 0,  0, 0,13,-1,  0, 0,  0, 0,	// 3080-  Pet System, Storage
+	52,14,-1, 6,  0, 0, 0, 0,  0, 0,13,-1,  0, 0,  0, 0,	// 3080-  Pet System, Storage
 	-1,10,-1, 6,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0,	// 3090-  Homunculus packets [albator]
 	-1,10,-1, 6,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0,	// 3090-  Homunculus packets [albator]
 	 2,-1, 6, 6,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0,	// 30A0-  Clan packets
 	 2,-1, 6, 6,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0,  0, 0,	// 30A0-  Clan packets
 };
 };
@@ -1125,13 +1125,13 @@ int mapif_parse_broadcast(int fd)
 
 
 /**
 /**
  * Parse received item broadcast and sends it to all connected map-serves
  * Parse received item broadcast and sends it to all connected map-serves
- * ZI 3009 <cmd>.W <len>.W <nameid>.W <source>.W <type>.B <name>.24B <srcname>.24B
- * IZ 3809 <cmd>.W <len>.W <nameid>.W <source>.W <type>.B <name>.24B <srcname>.24B
+ * ZI 3009 <cmd>.W <len>.W <nameid>.L <source>.W <type>.B <name>.24B <srcname>.24B
+ * IZ 3809 <cmd>.W <len>.W <nameid>.L <source>.W <type>.B <name>.24B <srcname>.24B
  * @param fd
  * @param fd
  * @return
  * @return
  **/
  **/
 int mapif_parse_broadcast_item(int fd) {
 int mapif_parse_broadcast_item(int fd) {
-	unsigned char buf[9 + NAME_LENGTH*2];
+	unsigned char buf[11 + NAME_LENGTH*2];
 
 
 	memcpy(WBUFP(buf, 0), RFIFOP(fd, 0), RFIFOW(fd,2));
 	memcpy(WBUFP(buf, 0), RFIFOP(fd, 0), RFIFOW(fd,2));
 	WBUFW(buf, 0) = 0x3809;
 	WBUFW(buf, 0) = 0x3809;

+ 12 - 8
src/common/mmo.hpp

@@ -52,6 +52,9 @@
 		#define MAX_CHARS 9
 		#define MAX_CHARS 9
 	#endif
 	#endif
 #endif
 #endif
+
+typedef uint32 t_itemid;
+
 /** Number of slots carded equipment can have. Never set to less than 4 as they are also used to keep the data of forged items/equipment. [Skotlex]
 /** Number of slots carded equipment can have. Never set to less than 4 as they are also used to keep the data of forged items/equipment. [Skotlex]
 * Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size. */
 * Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size. */
 #define MAX_SLOTS 4
 #define MAX_SLOTS 4
@@ -90,8 +93,8 @@
 
 
 #define MAX_STATUS_TYPE 5
 #define MAX_STATUS_TYPE 5
 
 
-#define WEDDING_RING_M 2634
-#define WEDDING_RING_F 2635
+const t_itemid WEDDING_RING_M = 2634;
+const t_itemid WEDDING_RING_F = 2635;
 
 
 //For character names, title names, guilds, maps, etc.
 //For character names, title names, guilds, maps, etc.
 //Includes null-terminator as it is the length of the array.
 //Includes null-terminator as it is the length of the array.
@@ -248,13 +251,13 @@ struct achievement {
 
 
 struct item {
 struct item {
 	int id;
 	int id;
-	unsigned short nameid;
+	t_itemid nameid;
 	short amount;
 	short amount;
 	unsigned int equip; // location(s) where item is equipped (using enum equip_pos for bitmasking)
 	unsigned int equip; // location(s) where item is equipped (using enum equip_pos for bitmasking)
 	char identify;
 	char identify;
 	char refine;
 	char refine;
 	char attribute;
 	char attribute;
-	unsigned short card[MAX_SLOTS];
+	t_itemid card[MAX_SLOTS];
 	struct s_item_randomoption option[MAX_ITEM_RDM_OPT];		// max of 5 random options can be supported.
 	struct s_item_randomoption option[MAX_ITEM_RDM_OPT];		// max of 5 random options can be supported.
 	unsigned int expire_time;
 	unsigned int expire_time;
 	char favorite, bound;
 	char favorite, bound;
@@ -298,8 +301,9 @@ struct point {
 };
 };
 
 
 struct startitem {
 struct startitem {
-	unsigned short nameid, amount;
-	short pos;
+	t_itemid nameid;
+	unsigned short amount;
+	uint32 pos;
 };
 };
 
 
 enum e_skill_flag
 enum e_skill_flag
@@ -404,8 +408,8 @@ struct s_pet {
 	int pet_id;
 	int pet_id;
 	short class_;
 	short class_;
 	short level;
 	short level;
-	unsigned short egg_id;//pet egg id
-	unsigned short equip;//pet equip name_id
+	t_itemid egg_id;//pet egg id
+	t_itemid equip;//pet equip name_id
 	short intimate;//pet friendly
 	short intimate;//pet friendly
 	short hungry;//pet hungry
 	short hungry;//pet hungry
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];

+ 5 - 5
src/map/achievement.cpp

@@ -188,7 +188,7 @@ uint64 AchievementDatabase::parseBodyNode(const YAML::Node &node){
 		}
 		}
 
 
 		if( achievement->condition ){
 		if( achievement->condition ){
-			aFree( achievement->condition );
+			script_free_code( achievement->condition );
 			achievement->condition = nullptr;
 			achievement->condition = nullptr;
 		}
 		}
 
 
@@ -241,14 +241,14 @@ uint64 AchievementDatabase::parseBodyNode(const YAML::Node &node){
 
 
 		// TODO: not camel case
 		// TODO: not camel case
 		if( this->nodeExists( rewardNode, "ItemID" ) ){
 		if( this->nodeExists( rewardNode, "ItemID" ) ){
-			uint16 itemId;
+			t_itemid itemId;
 
 
-			if( !this->asUInt16( rewardNode, "ItemID", itemId ) ){
+			if( !this->asUInt32( rewardNode, "ItemID", itemId ) ){
 				return 0;
 				return 0;
 			}
 			}
 
 
 			if( !itemdb_exists( itemId ) ){
 			if( !itemdb_exists( itemId ) ){
-				this->invalidWarning( rewardNode["ItemID"], "Unknown item with ID %hu.\n", itemId );
+				this->invalidWarning( rewardNode["ItemID"], "Unknown item with ID %u.\n", itemId );
 				return 0;
 				return 0;
 			}
 			}
 
 
@@ -278,7 +278,7 @@ uint64 AchievementDatabase::parseBodyNode(const YAML::Node &node){
 			}
 			}
 
 
 			if( achievement->rewards.script ){
 			if( achievement->rewards.script ){
-				aFree( achievement->rewards.script );
+				script_free_code( achievement->rewards.script );
 				achievement->rewards.script = nullptr;
 				achievement->rewards.script = nullptr;
 			}
 			}
 
 

+ 2 - 1
src/map/achievement.hpp

@@ -79,7 +79,8 @@ struct s_achievement_db {
 	struct script_code* condition;
 	struct script_code* condition;
 	int16 mapindex;
 	int16 mapindex;
 	struct ach_reward {
 	struct ach_reward {
-		unsigned short nameid, amount;
+		t_itemid nameid;
+		unsigned short amount;
 		struct script_code *script;
 		struct script_code *script;
 		uint32 title_id;
 		uint32 title_id;
 		ach_reward();
 		ach_reward();

+ 39 - 31
src/map/atcommand.cpp

@@ -1378,7 +1378,7 @@ ACMD_FUNC(item)
 	itemlist = strtok(item_name, ":");
 	itemlist = strtok(item_name, ":");
 	while (itemlist != NULL && j<10) {
 	while (itemlist != NULL && j<10) {
 		if ((item_data[j] = itemdb_searchname(itemlist)) == NULL &&
 		if ((item_data[j] = itemdb_searchname(itemlist)) == NULL &&
-		    (item_data[j] = itemdb_exists(atoi(itemlist))) == NULL){
+		    (item_data[j] = itemdb_exists( strtoul( itemlist, nullptr, 10 ) ) ) == NULL){
 			clif_displaymessage(fd, msg_txt(sd,19)); // Invalid item ID or name.
 			clif_displaymessage(fd, msg_txt(sd,19)); // Invalid item ID or name.
 			return -1;
 			return -1;
 		}
 		}
@@ -1391,7 +1391,7 @@ ACMD_FUNC(item)
 	get_count = number;
 	get_count = number;
 
 
 	for(j--; j>=0; j--){ //produce items in list
 	for(j--; j>=0; j--){ //produce items in list
-		unsigned short item_id = item_data[j]->nameid;
+		t_itemid item_id = item_data[j]->nameid;
 		//Check if it's stackable.
 		//Check if it's stackable.
 		if (!itemdb_isstackable2(item_data[j]))
 		if (!itemdb_isstackable2(item_data[j]))
 			get_count = 1;
 			get_count = 1;
@@ -1422,7 +1422,7 @@ ACMD_FUNC(item2)
 	struct item item_tmp;
 	struct item item_tmp;
 	struct item_data *item_data;
 	struct item_data *item_data;
 	char item_name[100];
 	char item_name[100];
-	unsigned short item_id;
+	t_itemid item_id;
 	int number = 0, bound = BOUND_NONE;
 	int number = 0, bound = BOUND_NONE;
 	int identify = 0, refine = 0, attr = 0;
 	int identify = 0, refine = 0, attr = 0;
 	int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
 	int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
@@ -1460,7 +1460,7 @@ ACMD_FUNC(item2)
 
 
 	item_id = 0;
 	item_id = 0;
 	if ((item_data = itemdb_searchname(item_name)) != NULL ||
 	if ((item_data = itemdb_searchname(item_name)) != NULL ||
-	    (item_data = itemdb_exists(atoi(item_name))) != NULL)
+	    (item_data = itemdb_exists(strtoul(item_name, nullptr, 10))) != NULL)
 		item_id = item_data->nameid;
 		item_id = item_data->nameid;
 
 
 	if (item_id > 500) {
 	if (item_id > 500) {
@@ -2373,7 +2373,7 @@ ACMD_FUNC(refine)
 ACMD_FUNC(produce)
 ACMD_FUNC(produce)
 {
 {
 	char item_name[100];
 	char item_name[100];
-	unsigned short item_id;
+	t_itemid item_id;
 	int attribute = 0, star = 0;
 	int attribute = 0, star = 0;
 	struct item_data *item_data;
 	struct item_data *item_data;
 	struct item tmp_item;
 	struct item tmp_item;
@@ -2391,7 +2391,7 @@ ACMD_FUNC(produce)
 	}
 	}
 
 
 	if ( (item_data = itemdb_searchname(item_name)) == NULL &&
 	if ( (item_data = itemdb_searchname(item_name)) == NULL &&
-		 (item_data = itemdb_exists(atoi(item_name))) == NULL ) {
+		 (item_data = itemdb_exists( strtoul( item_name, nullptr, 10 ) ) ) == NULL ) {
 		clif_displaymessage(fd, msg_txt(sd,170)); //This item is not an equipment.
 		clif_displaymessage(fd, msg_txt(sd,170)); //This item is not an equipment.
 		return -1;
 		return -1;
 	}
 	}
@@ -2419,7 +2419,7 @@ ACMD_FUNC(produce)
 		if ((flag = pc_additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
 		if ((flag = pc_additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
 			clif_additem(sd, 0, 0, flag);
 			clif_additem(sd, 0, 0, flag);
 	} else {
 	} else {
-		sprintf(atcmd_output, msg_txt(sd,169), item_id, item_data->name); // The item (%hu: '%s') is not equipable.
+		sprintf(atcmd_output, msg_txt(sd,169), item_id, item_data->name); // The item (%u: '%s') is not equipable.
 		clif_displaymessage(fd, atcmd_output);
 		clif_displaymessage(fd, atcmd_output);
 		return -1;
 		return -1;
 	}
 	}
@@ -2827,10 +2827,9 @@ ACMD_FUNC(makeegg) {
 		return -1;
 		return -1;
 	}
 	}
 
 
-	if ((item_data = itemdb_searchname(message)) != NULL) // for egg name
-		id = item_data->nameid;
-	else
-	if ((id = mobdb_searchname(message)) != 0) // for monster name
+
+	// for monster name
+	if ((id = mobdb_searchname(message)) != 0)
 		;
 		;
 	else
 	else
 		id = atoi(message);
 		id = atoi(message);
@@ -2838,7 +2837,16 @@ ACMD_FUNC(makeegg) {
 	std::shared_ptr<s_pet_db> pet = pet_db.find(id);
 	std::shared_ptr<s_pet_db> pet = pet_db.find(id);
 
 
 	if( pet == nullptr ){
 	if( pet == nullptr ){
-		pet = pet_db_search(id, PET_EGG);
+		t_itemid nameid;
+
+		// for egg name
+		if( ( item_data = itemdb_searchname( message ) ) != nullptr ){
+			nameid = item_data->nameid;
+		}else{
+			nameid = strtoul( message, nullptr, 10 );
+		}
+
+		pet = pet_db_search( nameid, PET_EGG );
 	}
 	}
 
 
 	if (pet != nullptr) {
 	if (pet != nullptr) {
@@ -3723,7 +3731,7 @@ ACMD_FUNC(idsearch)
 		clif_displaymessage(fd, atcmd_output);
 		clif_displaymessage(fd, atcmd_output);
 	}
 	}
 	for(i = 0; i < match; i++) {
 	for(i = 0; i < match; i++) {
-		sprintf(atcmd_output, msg_txt(sd,78), item_array[i]->jname, item_array[i]->nameid); // %s: %d
+		sprintf(atcmd_output, msg_txt(sd,78), item_array[i]->jname, item_array[i]->nameid); // %s: %u
 		clif_displaymessage(fd, atcmd_output);
 		clif_displaymessage(fd, atcmd_output);
 	}
 	}
 	sprintf(atcmd_output, msg_txt(sd,79), match); // It is %d affair above.
 	sprintf(atcmd_output, msg_txt(sd,79), match); // It is %d affair above.
@@ -5967,7 +5975,7 @@ ACMD_FUNC(skilltree)
 void getring (struct map_session_data* sd)
 void getring (struct map_session_data* sd)
 {
 {
 	char flag = 0;
 	char flag = 0;
-	unsigned short item_id;
+	t_itemid item_id;
 	struct item item_tmp;
 	struct item item_tmp;
 	item_id = (sd->status.sex) ? WEDDING_RING_M : WEDDING_RING_F;
 	item_id = (sd->status.sex) ? WEDDING_RING_M : WEDDING_RING_F;
 
 
@@ -6293,7 +6301,7 @@ ACMD_FUNC(autolootitem)
 
 
 	if (action < 3) // add or remove
 	if (action < 3) // add or remove
 	{
 	{
-		if ((item_data = itemdb_exists(atoi(message))) == NULL)
+		if ((item_data = itemdb_exists(strtoul(message, nullptr, 10))) == nullptr)
 			item_data = itemdb_searchname(message);
 			item_data = itemdb_searchname(message);
 		if (!item_data) {
 		if (!item_data) {
 			// No items founds in the DB with Id or Name
 			// No items founds in the DB with Id or Name
@@ -6315,7 +6323,7 @@ ACMD_FUNC(autolootitem)
 			return -1;
 			return -1;
 		}
 		}
 		sd->state.autolootid[i] = item_data->nameid; // Autoloot Activated
 		sd->state.autolootid[i] = item_data->nameid; // Autoloot Activated
-		sprintf(atcmd_output, msg_txt(sd,1192), item_data->name, item_data->jname, item_data->nameid); // Autolooting item: '%s'/'%s' {%d}
+		sprintf(atcmd_output, msg_txt(sd,1192), item_data->name, item_data->jname, item_data->nameid); // Autolooting item: '%s'/'%s' {%u}
 		clif_displaymessage(fd, atcmd_output);
 		clif_displaymessage(fd, atcmd_output);
 		sd->state.autolooting = 1;
 		sd->state.autolooting = 1;
 		break;
 		break;
@@ -6326,7 +6334,7 @@ ACMD_FUNC(autolootitem)
 			return -1;
 			return -1;
 		}
 		}
 		sd->state.autolootid[i] = 0;
 		sd->state.autolootid[i] = 0;
-		sprintf(atcmd_output, msg_txt(sd,1194), item_data->name, item_data->jname, item_data->nameid); // Removed item: '%s'/'%s' {%d} from your autolootitem list.
+		sprintf(atcmd_output, msg_txt(sd,1194), item_data->name, item_data->jname, item_data->nameid); // Removed item: '%s'/'%s' {%u} from your autolootitem list.
 		clif_displaymessage(fd, atcmd_output);
 		clif_displaymessage(fd, atcmd_output);
 		ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] != 0);
 		ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] != 0);
 		if (i == AUTOLOOTITEM_SIZE) {
 		if (i == AUTOLOOTITEM_SIZE) {
@@ -6351,7 +6359,7 @@ ACMD_FUNC(autolootitem)
 					ShowDebug("Non-existant item %d on autolootitem list (account_id: %d, char_id: %d)", sd->state.autolootid[i], sd->status.account_id, sd->status.char_id);
 					ShowDebug("Non-existant item %d on autolootitem list (account_id: %d, char_id: %d)", sd->state.autolootid[i], sd->status.account_id, sd->status.char_id);
 					continue;
 					continue;
 				}
 				}
-				sprintf(atcmd_output, "'%s'/'%s' {%hu}", item_data->name, item_data->jname, item_data->nameid);
+				sprintf(atcmd_output, "'%s'/'%s' {%u}", item_data->name, item_data->jname, item_data->nameid);
 				clif_displaymessage(fd, atcmd_output);
 				clif_displaymessage(fd, atcmd_output);
 			}
 			}
 		}
 		}
@@ -6434,7 +6442,7 @@ ACMD_FUNC(autoloottype)
 				return -1;
 				return -1;
 			}
 			}
 			sd->state.autoloottype |= (1<<type); // Stores the type
 			sd->state.autoloottype |= (1<<type); // Stores the type
-			sprintf(atcmd_output, msg_txt(sd,1483), itemdb_typename(type), type); // Autolooting item type: '%s' {%d}
+			sprintf(atcmd_output, msg_txt(sd,1483), itemdb_typename(type), type); // Autolooting item type: '%s' {%u}
 			clif_displaymessage(fd, atcmd_output);
 			clif_displaymessage(fd, atcmd_output);
 			break;
 			break;
 		case 2:
 		case 2:
@@ -6443,7 +6451,7 @@ ACMD_FUNC(autoloottype)
 				return -1;
 				return -1;
 			}
 			}
 			sd->state.autoloottype &= ~(1<<type);
 			sd->state.autoloottype &= ~(1<<type);
-			sprintf(atcmd_output, msg_txt(sd,1485), itemdb_typename(type), type); // Removed item type: '%s' {%d} from your autoloottype list.
+			sprintf(atcmd_output, msg_txt(sd,1485), itemdb_typename(type), type); // Removed item type: '%s' {%u} from your autoloottype list.
 			clif_displaymessage(fd, atcmd_output);
 			clif_displaymessage(fd, atcmd_output);
 			break;
 			break;
 		case 3:
 		case 3:
@@ -7391,7 +7399,7 @@ ACMD_FUNC(mobinfo)
 		j = 0;
 		j = 0;
 		for (i = 0; i < MAX_MOB_DROP_TOTAL; i++) {
 		for (i = 0; i < MAX_MOB_DROP_TOTAL; i++) {
 			int droprate;
 			int droprate;
-			if (mob->dropitem[i].nameid <= 0 || mob->dropitem[i].p < 1 || (item_data = itemdb_exists(mob->dropitem[i].nameid)) == NULL)
+			if (mob->dropitem[i].nameid == 0 || mob->dropitem[i].p < 1 || (item_data = itemdb_exists(mob->dropitem[i].nameid)) == NULL)
 				continue;
 				continue;
 			droprate = mob->dropitem[i].p;
 			droprate = mob->dropitem[i].p;
 
 
@@ -7427,7 +7435,7 @@ ACMD_FUNC(mobinfo)
 			mvpremain = 100.0; //Remaining drop chance for official mvp drop mode
 			mvpremain = 100.0; //Remaining drop chance for official mvp drop mode
 			j = 0;
 			j = 0;
 			for (i = 0; i < MAX_MVP_DROP_TOTAL; i++) {
 			for (i = 0; i < MAX_MVP_DROP_TOTAL; i++) {
-				if (mob->mvpitem[i].nameid <= 0 || (item_data = itemdb_exists(mob->mvpitem[i].nameid)) == NULL)
+				if (mob->mvpitem[i].nameid == 0 || (item_data = itemdb_exists(mob->mvpitem[i].nameid)) == NULL)
 					continue;
 					continue;
 				//Because if there are 3 MVP drops at 50%, the first has a chance of 50%, the second 25% and the third 12.5%
 				//Because if there are 3 MVP drops at 50%, the first has a chance of 50%, the second 25% and the third 12.5%
 				mvppercent = (float)mob->mvpitem[i].p * mvpremain / 10000.0f;
 				mvppercent = (float)mob->mvpitem[i].p * mvpremain / 10000.0f;
@@ -7855,7 +7863,7 @@ ACMD_FUNC(iteminfo)
 		clif_displaymessage(fd, msg_txt(sd,1276)); // Please enter an item name/ID (usage: @ii/@iteminfo <item name/ID>).
 		clif_displaymessage(fd, msg_txt(sd,1276)); // Please enter an item name/ID (usage: @ii/@iteminfo <item name/ID>).
 		return -1;
 		return -1;
 	}
 	}
-	if ((item_array[0] = itemdb_exists(atoi(message))) == NULL)
+	if ((item_array[0] = itemdb_exists(strtoul(message, nullptr, 10))) == nullptr)
 		count = itemdb_searchname_array(item_array, MAX_SEARCH, message);
 		count = itemdb_searchname_array(item_array, MAX_SEARCH, message);
 
 
 	if (!count) {
 	if (!count) {
@@ -7869,7 +7877,7 @@ ACMD_FUNC(iteminfo)
 	}
 	}
 	for (i = 0; i < count; i++) {
 	for (i = 0; i < count; i++) {
 		struct item_data * item_data = item_array[i];
 		struct item_data * item_data = item_array[i];
-		sprintf(atcmd_output, msg_txt(sd,1277), // Item: '%s'/'%s'[%d] (%hu) Type: %s | Extra Effect: %s
+		sprintf(atcmd_output, msg_txt(sd,1277), // Item: '%s'/'%s'[%d] (%u) Type: %s | Extra Effect: %s
 			item_data->name,item_data->jname,item_data->slot,item_data->nameid,
 			item_data->name,item_data->jname,item_data->slot,item_data->nameid,
 			(item_data->type != IT_AMMO) ? itemdb_typename((enum item_types)item_data->type) : itemdb_typename_ammo((enum e_item_ammo)item_data->look),
 			(item_data->type != IT_AMMO) ? itemdb_typename((enum item_types)item_data->type) : itemdb_typename_ammo((enum e_item_ammo)item_data->look),
 			(item_data->script==NULL)? msg_txt(sd,1278) : msg_txt(sd,1279) // None / With script
 			(item_data->script==NULL)? msg_txt(sd,1278) : msg_txt(sd,1279) // None / With script
@@ -7906,7 +7914,7 @@ ACMD_FUNC(whodrops)
 		clif_displaymessage(fd, msg_txt(sd,1284)); // Please enter item name/ID (usage: @whodrops <item name/ID>).
 		clif_displaymessage(fd, msg_txt(sd,1284)); // Please enter item name/ID (usage: @whodrops <item name/ID>).
 		return -1;
 		return -1;
 	}
 	}
-	if ((item_array[0] = itemdb_exists(atoi(message))) == NULL)
+	if ((item_array[0] = itemdb_exists(strtoul(message, nullptr, 10))) == nullptr)
 		count = itemdb_searchname_array(item_array, MAX_SEARCH, message);
 		count = itemdb_searchname_array(item_array, MAX_SEARCH, message);
 
 
 	if (!count) {
 	if (!count) {
@@ -7920,7 +7928,7 @@ ACMD_FUNC(whodrops)
 	}
 	}
 	for (i = 0; i < count; i++) {
 	for (i = 0; i < count; i++) {
 		item_data = item_array[i];
 		item_data = item_array[i];
-		sprintf(atcmd_output, msg_txt(sd,1285), item_data->jname, item_data->slot, item_data->nameid); // Item: '%s'[%d] (ID:%hu)
+		sprintf(atcmd_output, msg_txt(sd,1285), item_data->jname, item_data->slot, item_data->nameid); // Item: '%s'[%d] (ID: %u)
 		clif_displaymessage(fd, atcmd_output);
 		clif_displaymessage(fd, atcmd_output);
 
 
 		if (item_data->mob[0].chance == 0) {
 		if (item_data->mob[0].chance == 0) {
@@ -8886,9 +8894,9 @@ ACMD_FUNC(itemlist)
 		}
 		}
 
 
 		if( it->refine )
 		if( it->refine )
-			StringBuf_Printf(&buf, "%d %s %+d (%s, id: %d)", it->amount, itd->jname, it->refine, itd->name, it->nameid);
+			StringBuf_Printf(&buf, "%d %s %+d (%s, id: %u)", it->amount, itd->jname, it->refine, itd->name, it->nameid);
 		else
 		else
-			StringBuf_Printf(&buf, "%d %s (%s, id: %d)", it->amount, itd->jname, itd->name, it->nameid);
+			StringBuf_Printf(&buf, "%d %s (%s, id: %u)", it->amount, itd->jname, itd->name, it->nameid);
 
 
 		if( it->equip ) {
 		if( it->equip ) {
 			char equipstr[CHAT_SIZE_MAX];
 			char equipstr[CHAT_SIZE_MAX];
@@ -8988,7 +8996,7 @@ ACMD_FUNC(itemlist)
 				if( counter2 != 1 )
 				if( counter2 != 1 )
 					StringBuf_AppendStr(&buf, ", ");
 					StringBuf_AppendStr(&buf, ", ");
 
 
-				StringBuf_Printf(&buf, "#%d %s (id: %d)", counter2, card->jname, card->nameid);
+				StringBuf_Printf(&buf, "#%d %s (id: %u)", counter2, card->jname, card->nameid);
 			}
 			}
 
 
 			if( counter2 > 0 )
 			if( counter2 > 0 )
@@ -9079,7 +9087,7 @@ ACMD_FUNC(stats)
 ACMD_FUNC(delitem)
 ACMD_FUNC(delitem)
 {
 {
 	char item_name[100];
 	char item_name[100];
-	unsigned short nameid;
+	t_itemid nameid;
 	int amount = 0, total, idx;
 	int amount = 0, total, idx;
 	struct item_data* id;
 	struct item_data* id;
 
 
@@ -9091,7 +9099,7 @@ ACMD_FUNC(delitem)
 		return -1;
 		return -1;
 	}
 	}
 
 
-	if( ( id = itemdb_searchname(item_name) ) != NULL || ( id = itemdb_exists(atoi(item_name)) ) != NULL )
+	if( ( id = itemdb_searchname(item_name) ) != NULL || ( id = itemdb_exists( strtoul( item_name, nullptr, 10 ) ) ) != NULL )
 	{
 	{
 		nameid = id->nameid;
 		nameid = id->nameid;
 	}
 	}

+ 82 - 79
src/map/battle.cpp

@@ -276,10 +276,18 @@ void battle_damage(struct block_list *src, struct block_list *target, int64 dama
 	if (dmg_lv > ATK_BLOCK && attack_type)
 	if (dmg_lv > ATK_BLOCK && attack_type)
 		skill_counter_additional_effect(src, target, skill_id, skill_lv, attack_type, tick);
 		skill_counter_additional_effect(src, target, skill_id, skill_lv, attack_type, tick);
 	// This is the last place where we have access to the actual damage type, so any monster events depending on type must be placed here
 	// This is the last place where we have access to the actual damage type, so any monster events depending on type must be placed here
-	if (target->type == BL_MOB && damage && (attack_type&BF_NORMAL)) {
-		// Monsters differentiate whether they have been attacked by a skill or a normal attack
+	if (target->type == BL_MOB) {
 		struct mob_data* md = BL_CAST(BL_MOB, target);
 		struct mob_data* md = BL_CAST(BL_MOB, target);
-		md->norm_attacked_id = md->attacked_id;
+
+		if (!status_isdead(target) && src != target) {
+			if (damage > 0 )
+				mobskill_event(md, src, tick, attack_type);
+			if (skill_id)
+				mobskill_event(md, src, tick, MSC_SKILLUSED|(skill_id<<16));
+		}
+
+		if (damage && (attack_type&BF_NORMAL)) // Monsters differentiate whether they have been attacked by a skill or a normal attack
+			md->norm_attacked_id = md->attacked_id;
 	}
 	}
 	map_freeblock_unlock();
 	map_freeblock_unlock();
 }
 }
@@ -593,6 +601,13 @@ int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 d
 				}
 				}
 				break;
 				break;
 		}
 		}
+
+		if (tsc->data[SC_MAGIC_POISON])
+#ifdef RENEWAL
+			ratio += 50;
+#else
+			damage += (int64)(damage * 50 / 100);
+#endif
 	}
 	}
 
 
 	if (battle_config.attr_recover == 0 && ratio < 0)
 	if (battle_config.attr_recover == 0 && ratio < 0)
@@ -1275,7 +1290,7 @@ bool battle_status_block_damage(struct block_list *src, struct block_list *targe
 		return false;
 		return false;
 	}
 	}
 
 
-	if (sc->data[SC_DODGE] && (flag&BF_LONG || sc->data[SC_SPURT]) && rnd() % 100 < 20) {
+	if (sc->data[SC_DODGE] && (flag&BF_LONG || sc->data[SC_SPURT]) && (skill_id != NPC_EARTHQUAKE || (skill_id == NPC_EARTHQUAKE && flag & NPC_EARTHQUAKE_FLAG)) && rnd() % 100 < 20) {
 		map_session_data *sd = map_id2sd(target->id);
 		map_session_data *sd = map_id2sd(target->id);
 
 
 		if (sd && pc_issit(sd))
 		if (sd && pc_issit(sd))
@@ -1285,7 +1300,7 @@ bool battle_status_block_damage(struct block_list *src, struct block_list *targe
 		return false;
 		return false;
 	}
 	}
 
 
-	if ((sce = sc->data[SC_KAUPE]) && rnd() % 100 < sce->val2) { //Kaupe blocks damage (skill or otherwise) from players, mobs, homuns, mercenaries.
+	if ((sce = sc->data[SC_KAUPE]) && (skill_id != NPC_EARTHQUAKE || (skill_id == NPC_EARTHQUAKE && flag & NPC_EARTHQUAKE_FLAG)) && rnd() % 100 < sce->val2) { //Kaupe blocks damage (skill or otherwise) from players, mobs, homuns, mercenaries.
 		clif_specialeffect(target, EF_STORMKICK4, AREA);
 		clif_specialeffect(target, EF_STORMKICK4, AREA);
 		//Shouldn't end until Breaker's non-weapon part connects.
 		//Shouldn't end until Breaker's non-weapon part connects.
 #ifndef RENEWAL
 #ifndef RENEWAL
@@ -1708,12 +1723,6 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
 			damage = div_;
 			damage = div_;
 	}
 	}
 
 
-	if( bl->type == BL_MOB && !status_isdead(bl) && src != bl) {
-		if (damage > 0 )
-			mobskill_event((TBL_MOB*)bl,src,gettick(),flag);
-		if (skill_id)
-			mobskill_event((TBL_MOB*)bl,src,gettick(),MSC_SKILLUSED|(skill_id<<16));
-	}
 	if (sd && pc_ismadogear(sd)) {
 	if (sd && pc_ismadogear(sd)) {
 		short element = skill_get_ele(skill_id, skill_lv);
 		short element = skill_get_ele(skill_id, skill_lv);
 
 
@@ -2269,13 +2278,22 @@ static int battle_range_type(struct block_list *src, struct block_list *target,
 	if (skill_get_inf2(skill_id, INF2_ISTRAP))
 	if (skill_get_inf2(skill_id, INF2_ISTRAP))
 		return BF_SHORT;
 		return BF_SHORT;
 
 
-	// When monsters use Arrow Shower or Bomb, it is always short range
-	if (src->type == BL_MOB && (skill_id == AC_SHOWER || skill_id == AM_DEMONSTRATION))
-		return BF_SHORT;
-
-	// Cast range is 7 cells and player jumps to target but skill is considered melee
-	if (skill_id == GC_CROSSIMPACT)
-		return BF_SHORT;
+	switch (skill_id) {
+		case AC_SHOWER:
+		case AM_DEMONSTRATION:
+			// When monsters use Arrow Shower or Bomb, it is always short range
+			if (src->type == BL_MOB)
+				return BF_SHORT;
+			break;
+#ifdef RENEWAL
+		case KN_BRANDISHSPEAR:
+			// Renewal changes to ranged physical damage
+			return BF_LONG;
+#endif
+		case GC_CROSSIMPACT:
+			// Cast range is 7 cells and player jumps to target but skill is considered melee
+			return BF_SHORT;
+	}
 
 
 	//Skill Range Criteria
 	//Skill Range Criteria
 	if (battle_config.skillrange_by_distance &&
 	if (battle_config.skillrange_by_distance &&
@@ -2780,6 +2798,7 @@ static bool is_attack_hitting(struct Damage* wd, struct block_list *src, struct
 			case NPC_DARKNESSATTACK:
 			case NPC_DARKNESSATTACK:
 			case NPC_UNDEADATTACK:
 			case NPC_UNDEADATTACK:
 			case NPC_TELEKINESISATTACK:
 			case NPC_TELEKINESISATTACK:
+			case NPC_EARTHQUAKE:
 			case NPC_BLEEDING:
 			case NPC_BLEEDING:
 				hitrate += hitrate * 20 / 100;
 				hitrate += hitrate * 20 / 100;
 				break;
 				break;
@@ -5612,11 +5631,6 @@ static struct Damage initialize_weapon_data(struct block_list *src, struct block
 				wd.blewcount = 0;
 				wd.blewcount = 0;
 				break;
 				break;
 
 
-#ifdef RENEWAL
-			case KN_BRANDISHSPEAR:
-				wd.flag |= BF_LONG;
-				break;
-#endif
 			case KN_AUTOCOUNTER:
 			case KN_AUTOCOUNTER:
 				wd.flag = (wd.flag&~BF_SKILLMASK)|BF_NORMAL;
 				wd.flag = (wd.flag&~BF_SKILLMASK)|BF_NORMAL;
 				break;
 				break;
@@ -6101,13 +6115,18 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 		s_ele = rnd()%ELE_ALL;
 		s_ele = rnd()%ELE_ALL;
 
 
 	switch(skill_id) {
 	switch(skill_id) {
+		case NPC_EARTHQUAKE:
+			s_ele = ELE_NEUTRAL;
+			break;
 		case LG_SHIELDSPELL:
 		case LG_SHIELDSPELL:
 			if (skill_lv == 2)
 			if (skill_lv == 2)
 				s_ele = ELE_HOLY;
 				s_ele = ELE_HOLY;
 			break;
 			break;
 		case WL_HELLINFERNO:
 		case WL_HELLINFERNO:
-			if (mflag&ELE_DARK)
+			if (mflag & 2) { // ELE_DARK
 				s_ele = ELE_DARK;
 				s_ele = ELE_DARK;
+				ad.div_ = 3;
+			}
 			break;
 			break;
 		case WM_REVERBERATION:
 		case WM_REVERBERATION:
 			if (sd)
 			if (sd)
@@ -6213,6 +6232,22 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 			case AB_RENOVATIO:
 			case AB_RENOVATIO:
 				ad.damage = status_get_lv(src) * 10 + sstatus->int_;
 				ad.damage = status_get_lv(src) * 10 + sstatus->int_;
 				break;
 				break;
+			case NPC_EARTHQUAKE:
+				if (mflag & NPC_EARTHQUAKE_FLAG) {
+					ad.flag |= NPC_EARTHQUAKE_FLAG; // Pass flag to battle_calc_damage
+					mflag &= ~NPC_EARTHQUAKE_FLAG; // Remove before NK_SPLASHSPLIT check
+				}
+
+				if (src->type == BL_PC)
+					ad.damage = sstatus->str * 2 + battle_calc_weapon_attack(src, target, skill_id, skill_lv, mflag).damage;
+				else
+					ad.damage = battle_calc_base_damage(src, sstatus, &sstatus->rhw, sc, tstatus->size, 0);
+
+				MATK_RATE(200 + 100 * skill_lv + 100 * (skill_lv / 2) + ((skill_lv > 4) ? 100 : 0));
+
+				if (nk[NK_SPLASHSPLIT] && mflag > 1)
+					ad.damage /= mflag;
+				break;
 			case NPC_ICEMINE:
 			case NPC_ICEMINE:
 			case NPC_FLAMECROSS:
 			case NPC_FLAMECROSS:
 				ad.damage = sstatus->rhw.atk * 20 * skill_lv;
 				ad.damage = sstatus->rhw.atk * 20 * skill_lv;
@@ -6320,8 +6355,8 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 					case SL_STIN: //Target size must be small (0) for full damage
 					case SL_STIN: //Target size must be small (0) for full damage
 						skillratio += (tstatus->size != SZ_SMALL ? -99 : 10 * skill_lv);
 						skillratio += (tstatus->size != SZ_SMALL ? -99 : 10 * skill_lv);
 						break;
 						break;
-					case SL_STUN: //Full damage is dealt on small/medium targets
-						skillratio += (tstatus->size != SZ_BIG ? 5 * skill_lv : -99);
+					case SL_STUN:
+						skillratio += 5 * skill_lv;
 						break;
 						break;
 					case SL_SMA: //Base damage is 40% + lv%
 					case SL_SMA: //Base damage is 40% + lv%
 						skillratio += -60 + status_get_lv(src);
 						skillratio += -60 + status_get_lv(src);
@@ -6379,9 +6414,6 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 					case NPC_ENERGYDRAIN:
 					case NPC_ENERGYDRAIN:
 						skillratio += 100 * skill_lv;
 						skillratio += 100 * skill_lv;
 						break;
 						break;
-					case NPC_EARTHQUAKE:
-						skillratio += 100 + 100 * skill_lv + 100 * (skill_lv / 2) + ((skill_lv > 4) ? 100 : 0);
-						break;
 #ifdef RENEWAL
 #ifdef RENEWAL
 					case WZ_HEAVENDRIVE:
 					case WZ_HEAVENDRIVE:
 						skillratio += 25;
 						skillratio += 25;
@@ -6429,14 +6461,13 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 						skillratio += 300 + 40 * skill_lv;
 						skillratio += 300 + 40 * skill_lv;
 						break;
 						break;
 					case WL_SOULEXPANSION:
 					case WL_SOULEXPANSION:
-						skillratio += -100 + (skill_lv + 4) * 100 + status_get_int(src);
+						skillratio += -100 + 750 + skill_lv * 150 + sstatus->int_;
 						RE_LVL_DMOD(100);
 						RE_LVL_DMOD(100);
 						break;
 						break;
 					case WL_FROSTMISTY:
 					case WL_FROSTMISTY:
-						skillratio += 100 + 100 * skill_lv;
+						skillratio += -100 + 200 + 100 * skill_lv;
 						RE_LVL_DMOD(100);
 						RE_LVL_DMOD(100);
 						break;
 						break;
-					case WL_JACKFROST:
 					case NPC_JACKFROST:
 					case NPC_JACKFROST:
 						if (tsc && tsc->data[SC_FREEZING]) {
 						if (tsc && tsc->data[SC_FREEZING]) {
 							skillratio += 900 + 300 * skill_lv;
 							skillratio += 900 + 300 * skill_lv;
@@ -6446,50 +6477,30 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 							RE_LVL_DMOD(150);
 							RE_LVL_DMOD(150);
 						}
 						}
 						break;
 						break;
+					case WL_JACKFROST:
+						if (tsc && tsc->data[SC_MISTY_FROST])
+							skillratio += -100 + 1200 + 600 * skill_lv;
+						else
+							skillratio += -100 + 1000 + 300 * skill_lv;
+						RE_LVL_DMOD(100);
+						break;
 					case WL_DRAINLIFE:
 					case WL_DRAINLIFE:
-						skillratio += -100 + 200 * skill_lv + status_get_int(src);
+						skillratio += -100 + 200 * skill_lv + sstatus->int_;
 						RE_LVL_DMOD(100);
 						RE_LVL_DMOD(100);
 						break;
 						break;
 					case WL_CRIMSONROCK:
 					case WL_CRIMSONROCK:
-						skillratio += 1200 + 300 * skill_lv;
+						skillratio += -100 + 700 + 600 * skill_lv;
 						RE_LVL_DMOD(100);
 						RE_LVL_DMOD(100);
 						break;
 						break;
 					case WL_HELLINFERNO:
 					case WL_HELLINFERNO:
-						skillratio += -100 + 300 * skill_lv;
+						skillratio += -100 + 400 * skill_lv;
+						if (mflag & 2) // ELE_DARK
+							skillratio += 200;
 						RE_LVL_DMOD(100);
 						RE_LVL_DMOD(100);
-						// Shadow: MATK [{( Skill Level x 300 ) x ( Caster Base Level / 100 ) x 4/5 }] %
-						// Fire : MATK [{( Skill Level x 300 ) x ( Caster Base Level / 100 ) /5 }] %
-						if (mflag&ELE_DARK)
-							skillratio *= 4;
-						skillratio /= 5;
 						break;
 						break;
 					case WL_COMET:
 					case WL_COMET:
-						i = (sc ? distance_xy(target->x, target->y, sc->comet_x, sc->comet_y) : 8);
-						if (i <= 3)
-							skillratio += 2400 + 500 * skill_lv; // 7 x 7 cell
-						else if (i <= 5)
-							skillratio += 1900 + 500 * skill_lv; // 11 x 11 cell
-						else if (i <= 7)
-							skillratio += 1400 + 500 * skill_lv; // 15 x 15 cell
-						else
-							skillratio += 900 + 500 * skill_lv; // 19 x 19 cell
-
-						if (sd && sd->status.party_id) {
-							struct map_session_data* psd;
-							int p_sd[MAX_PARTY], c;
-
-							c = 0;
-							memset(p_sd, 0, sizeof(p_sd));
-							party_foreachsamemap(skill_check_condition_char_sub, sd, 3, &sd->bl, &c, &p_sd, skill_id);
-							c = (c > 1 ? rnd()%c : 0);
-
-							if( (psd = map_id2sd(p_sd[c])) && pc_checkskill(psd,WL_COMET) > 0 ){
-								skillratio = skill_lv * 400; //MATK [{( Skill Level x 400 ) x ( Caster's Base Level / 120 )} + 2500 ] %
-								RE_LVL_DMOD(120);
-								skillratio += 2500;
-								status_zap(&psd->bl, 0, skill_get_sp(skill_id, skill_lv) / 2);
-							}
-						}
+						skillratio += -100 + 2500 + 500 * skill_lv;
+						RE_LVL_DMOD(100);
 						break;
 						break;
 					case WL_CHAINLIGHTNING_ATK:
 					case WL_CHAINLIGHTNING_ATK:
 						skillratio += 400 + 100 * skill_lv;
 						skillratio += 400 + 100 * skill_lv;
@@ -6498,7 +6509,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 							skillratio += 100 * mflag;
 							skillratio += 100 * mflag;
 						break;
 						break;
 					case WL_EARTHSTRAIN:
 					case WL_EARTHSTRAIN:
-						skillratio += 1900 + 100 * skill_lv;
+						skillratio += -100 + 1000 + 600 * skill_lv;
 						RE_LVL_DMOD(100);
 						RE_LVL_DMOD(100);
 						break;
 						break;
 					case WL_TETRAVORTEX_FIRE:
 					case WL_TETRAVORTEX_FIRE:
@@ -6515,7 +6526,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 					case WL_SUMMON_ATK_WIND:
 					case WL_SUMMON_ATK_WIND:
 					case WL_SUMMON_ATK_GROUND:
 					case WL_SUMMON_ATK_GROUND:
 						skillratio += -100 + (1 + skill_lv) / 2 * (status_get_lv(src) + (sd ? sd->status.job_level : 0));
 						skillratio += -100 + (1 + skill_lv) / 2 * (status_get_lv(src) + (sd ? sd->status.job_level : 0));
-						RE_LVL_DMOD(100);
+						RE_LVL_DMOD(100); // ! TODO: Confirm new formula
 						break;
 						break;
 					case LG_RAYOFGENESIS:
 					case LG_RAYOFGENESIS:
 						skillratio += -100 + 200 * skill_lv;
 						skillratio += -100 + 200 * skill_lv;
@@ -6746,16 +6757,6 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 				ad.damage = ad.damage * (100-mdef)/100 - mdef2;
 				ad.damage = ad.damage * (100-mdef)/100 - mdef2;
 #endif
 #endif
 		}
 		}
-#if 0 // Doesn't seem to be official
-		if (skill_id == NPC_EARTHQUAKE) {
-			//Adds atk2 to the damage, should be influenced by number of hits and skill-ratio, but not mdef reductions. [Skotlex]
-			//Also divide the extra bonuses from atk2 based on the number in range [Kevin]
-			if(mflag>0)
-				ad.damage+= (sstatus->rhw.atk2*skillratio/100)/mflag;
-			else
-				ShowError("Zero range by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id));
-		}
-#endif
 		if(ad.damage<1)
 		if(ad.damage<1)
 			ad.damage=1;
 			ad.damage=1;
 		else if(sc) { //only applies when hit
 		else if(sc) { //only applies when hit
@@ -8914,7 +8915,7 @@ static const struct _battle_data {
 	{ "fame_pharmacy_10",                   &battle_config.fame_pharmacy_10,                50,     0,      INT_MAX,        },
 	{ "fame_pharmacy_10",                   &battle_config.fame_pharmacy_10,                50,     0,      INT_MAX,        },
 	{ "mail_delay",                         &battle_config.mail_delay,                      1000,   1000,   INT_MAX,        },
 	{ "mail_delay",                         &battle_config.mail_delay,                      1000,   1000,   INT_MAX,        },
 	{ "at_monsterignore",                   &battle_config.autotrade_monsterignore,         0,      0,      1,              },
 	{ "at_monsterignore",                   &battle_config.autotrade_monsterignore,         0,      0,      1,              },
-	{ "idletime_option",                    &battle_config.idletime_option,                 0x1F,   0x1,    0xFFF,          },
+	{ "idletime_option",                    &battle_config.idletime_option,                 0x7C1F, 1,      0xFFFF,         },
 	{ "spawn_direction",                    &battle_config.spawn_direction,                 0,      0,      1,              },
 	{ "spawn_direction",                    &battle_config.spawn_direction,                 0,      0,      1,              },
 	{ "arrow_shower_knockback",             &battle_config.arrow_shower_knockback,          1,      0,      1,              },
 	{ "arrow_shower_knockback",             &battle_config.arrow_shower_knockback,          1,      0,      1,              },
 	{ "devotion_rdamage_skill_only",        &battle_config.devotion_rdamage_skill_only,     1,      0,      1,              },
 	{ "devotion_rdamage_skill_only",        &battle_config.devotion_rdamage_skill_only,     1,      0,      1,              },
@@ -8938,6 +8939,7 @@ static const struct _battle_data {
 	{ "monster_eye_range_bonus",            &battle_config.mob_eye_range_bonus,             0,      0,      10,             },
 	{ "monster_eye_range_bonus",            &battle_config.mob_eye_range_bonus,             0,      0,      10,             },
 	{ "monster_stuck_warning",              &battle_config.mob_stuck_warning,               0,      0,      1,              },
 	{ "monster_stuck_warning",              &battle_config.mob_stuck_warning,               0,      0,      1,              },
 	{ "skill_eightpath_algorithm",          &battle_config.skill_eightpath_algorithm,       1,      0,      1,              },
 	{ "skill_eightpath_algorithm",          &battle_config.skill_eightpath_algorithm,       1,      0,      1,              },
+	{ "skill_eightpath_same_cell",          &battle_config.skill_eightpath_same_cell,       1,      0,      1,              },
 	{ "death_penalty_maxlv",                &battle_config.death_penalty_maxlv,             0,      0,      3,              },
 	{ "death_penalty_maxlv",                &battle_config.death_penalty_maxlv,             0,      0,      3,              },
 	{ "exp_cost_redemptio",                 &battle_config.exp_cost_redemptio,              1,      0,      100,            },
 	{ "exp_cost_redemptio",                 &battle_config.exp_cost_redemptio,              1,      0,      100,            },
 	{ "exp_cost_redemptio_limit",           &battle_config.exp_cost_redemptio_limit,        5,      0,      MAX_PARTY,      },
 	{ "exp_cost_redemptio_limit",           &battle_config.exp_cost_redemptio_limit,        5,      0,      MAX_PARTY,      },
@@ -9003,6 +9005,7 @@ static const struct _battle_data {
 	{ "at_logout_event",                    &battle_config.at_logout_event,                 1,      0,      1,              },
 	{ "at_logout_event",                    &battle_config.at_logout_event,                 1,      0,      1,              },
 	{ "homunculus_starving_rate",           &battle_config.homunculus_starving_rate,        10,     0,      100,            },
 	{ "homunculus_starving_rate",           &battle_config.homunculus_starving_rate,        10,     0,      100,            },
 	{ "homunculus_starving_delay",          &battle_config.homunculus_starving_delay,       20000,  0,      INT_MAX,        },
 	{ "homunculus_starving_delay",          &battle_config.homunculus_starving_delay,       20000,  0,      INT_MAX,        },
+	{ "drop_connection_on_quit",            &battle_config.drop_connection_on_quit,         0,      0,      1,              },
 	{ "blocking_play_delay",                &battle_config.blocking_play_delay,             20000,  0,      INT_MAX,        },
 	{ "blocking_play_delay",                &battle_config.blocking_play_delay,             20000,  0,      INT_MAX,        },
 
 
 #include "../custom/battle_config_init.inc"
 #include "../custom/battle_config_init.inc"

+ 2 - 0
src/map/battle.hpp

@@ -622,6 +622,7 @@ struct Battle_Config
 	int mob_eye_range_bonus; //Vulture's Eye and Snake's Eye range bonus
 	int mob_eye_range_bonus; //Vulture's Eye and Snake's Eye range bonus
 	int mob_stuck_warning; //Show warning if a monster is stuck too long
 	int mob_stuck_warning; //Show warning if a monster is stuck too long
 	int skill_eightpath_algorithm; //Official path algorithm
 	int skill_eightpath_algorithm; //Official path algorithm
+	int skill_eightpath_same_cell;
 	int death_penalty_maxlv;
 	int death_penalty_maxlv;
 	int exp_cost_redemptio;
 	int exp_cost_redemptio;
 	int exp_cost_redemptio_limit;
 	int exp_cost_redemptio_limit;
@@ -687,6 +688,7 @@ struct Battle_Config
 	int at_logout_event;
 	int at_logout_event;
 	int homunculus_starving_rate;
 	int homunculus_starving_rate;
 	int homunculus_starving_delay;
 	int homunculus_starving_delay;
+	int drop_connection_on_quit;
 	int blocking_play_delay;
 	int blocking_play_delay;
 
 
 #include "../custom/battle_config_struct.inc"
 #include "../custom/battle_config_struct.inc"

+ 6 - 6
src/map/buyingstore.cpp

@@ -51,7 +51,7 @@ enum e_buyingstore_failure
 
 
 
 
 static unsigned int buyingstore_nextid = 0;
 static unsigned int buyingstore_nextid = 0;
-static const unsigned short buyingstore_blankslots[MAX_SLOTS] = { 0 };  // used when checking whether or not an item's card slots are blank
+static const t_itemid buyingstore_blankslots[MAX_SLOTS] = { 0 };  // used when checking whether or not an item's card slots are blank
 
 
 
 
 /// Returns unique buying store id
 /// Returns unique buying store id
@@ -198,7 +198,7 @@ int8 buyingstore_create( struct map_session_data* sd, int zenylimit, unsigned ch
 
 
 			// duplicate
 			// duplicate
 			if( listidx != i ){
 			if( listidx != i ){
-				ShowWarning( "buyingstore_create: Found duplicate item on buying list (nameid=%hu, amount=%hu, account_id=%d, char_id=%d).\n", item->itemId, item->amount, sd->status.account_id, sd->status.char_id );
+				ShowWarning( "buyingstore_create: Found duplicate item on buying list (nameid=%u, amount=%hu, account_id=%d, char_id=%d).\n", item->itemId, item->amount, sd->status.account_id, sd->status.char_id );
 				break;
 				break;
 			}
 			}
 		}
 		}
@@ -241,7 +241,7 @@ int8 buyingstore_create( struct map_session_data* sd, int zenylimit, unsigned ch
 	StringBuf_Init(&buf);
 	StringBuf_Init(&buf);
 	StringBuf_Printf(&buf, "INSERT INTO `%s`(`buyingstore_id`,`index`,`item_id`,`amount`,`price`) VALUES", buyingstore_items_table);
 	StringBuf_Printf(&buf, "INSERT INTO `%s`(`buyingstore_id`,`index`,`item_id`,`amount`,`price`) VALUES", buyingstore_items_table);
 	for (i = 0; i < sd->buyingstore.slots; i++){
 	for (i = 0; i < sd->buyingstore.slots; i++){
-		StringBuf_Printf(&buf, "(%d,%d,%hu,%d,%d)", sd->buyer_id, i, sd->buyingstore.items[i].nameid, sd->buyingstore.items[i].amount, sd->buyingstore.items[i].price);
+		StringBuf_Printf(&buf, "(%d,%d,%u,%d,%d)", sd->buyer_id, i, sd->buyingstore.items[i].nameid, sd->buyingstore.items[i].amount, sd->buyingstore.items[i].price);
 		if (i < sd->buyingstore.slots-1)
 		if (i < sd->buyingstore.slots-1)
 			StringBuf_AppendStr(&buf, ",");
 			StringBuf_AppendStr(&buf, ",");
 	}
 	}
@@ -377,7 +377,7 @@ void buyingstore_trade( struct map_session_data* sd, uint32 account_id, unsigned
 		for( int k = 0; k < i; k++ ){
 		for( int k = 0; k < i; k++ ){
 			// duplicate
 			// duplicate
 			if( itemlist[k].index == item->index && k != i ){
 			if( itemlist[k].index == item->index && k != i ){
-				ShowWarning( "buyingstore_trade: Found duplicate item on selling list (prevnameid=%hu, prevamount=%hu, nameid=%hu, amount=%hu, account_id=%d, char_id=%d).\n", itemlist[k].itemId, itemlist[k].amount, item->itemId, item->amount, sd->status.account_id, sd->status.char_id );
+				ShowWarning( "buyingstore_trade: Found duplicate item on selling list (prevnameid=%u, prevamount=%hu, nameid=%u, amount=%hu, account_id=%d, char_id=%d).\n", itemlist[k].itemId, itemlist[k].amount, item->itemId, item->amount, sd->status.account_id, sd->status.char_id );
 				clif_buyingstore_trade_failed_seller( sd, BUYINGSTORE_TRADE_SELLER_FAILED, item->itemId );
 				clif_buyingstore_trade_failed_seller( sd, BUYINGSTORE_TRADE_SELLER_FAILED, item->itemId );
 				return;
 				return;
 			}
 			}
@@ -509,7 +509,7 @@ void buyingstore_trade( struct map_session_data* sd, uint32 account_id, unsigned
 
 
 
 
 /// Checks if an item is being bought in given player's buying store.
 /// Checks if an item is being bought in given player's buying store.
-bool buyingstore_search(struct map_session_data* sd, unsigned short nameid)
+bool buyingstore_search(struct map_session_data* sd, t_itemid nameid)
 {
 {
 	unsigned int i;
 	unsigned int i;
 
 
@@ -729,7 +729,7 @@ void do_init_buyingstore_autotrade( void ) {
 				while (SQL_SUCCESS == Sql_NextRow(mmysql_handle) && j < at->count) {
 				while (SQL_SUCCESS == Sql_NextRow(mmysql_handle) && j < at->count) {
 					char *data;
 					char *data;
 					CREATE(at->entries[j], struct s_autotrade_entry, 1);
 					CREATE(at->entries[j], struct s_autotrade_entry, 1);
-					Sql_GetData(mmysql_handle, 0, &data, NULL); at->entries[j]->item_id = atoi(data);
+					Sql_GetData(mmysql_handle, 0, &data, NULL); at->entries[j]->item_id = strtoul(data, nullptr, 10);
 					Sql_GetData(mmysql_handle, 1, &data, NULL); at->entries[j]->amount = atoi(data);
 					Sql_GetData(mmysql_handle, 1, &data, NULL); at->entries[j]->amount = atoi(data);
 					Sql_GetData(mmysql_handle, 2, &data, NULL); at->entries[j]->price = atoi(data);
 					Sql_GetData(mmysql_handle, 2, &data, NULL); at->entries[j]->price = atoi(data);
 					j++;
 					j++;

+ 3 - 3
src/map/buyingstore.hpp

@@ -17,7 +17,7 @@ struct s_buyingstore_item
 {
 {
 	int price;
 	int price;
 	unsigned short amount;
 	unsigned short amount;
-	unsigned short nameid;
+	t_itemid nameid;
 };
 };
 
 
 struct s_buyingstore
 struct s_buyingstore
@@ -33,7 +33,7 @@ struct s_autotrade_entry {
 	uint16 amount; ///< Amount
 	uint16 amount; ///< Amount
 	uint32 price; ///< Price
 	uint32 price; ///< Price
 	uint16 index; ///< Item index in cart
 	uint16 index; ///< Item index in cart
-	uint32 item_id; ///< Item ID (for buyingstore)
+	t_itemid item_id; ///< Item ID (for buyingstore)
 };
 };
 
 
 /// Struct of autotrader
 /// Struct of autotrader
@@ -60,7 +60,7 @@ int8 buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
 void buyingstore_close(struct map_session_data* sd);
 void buyingstore_close(struct map_session_data* sd);
 void buyingstore_open(struct map_session_data* sd, uint32 account_id);
 void buyingstore_open(struct map_session_data* sd, uint32 account_id);
 void buyingstore_trade(struct map_session_data* sd, uint32 account_id, unsigned int buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, unsigned int count);
 void buyingstore_trade(struct map_session_data* sd, uint32 account_id, unsigned int buyer_id, const struct PACKET_CZ_REQ_TRADE_BUYING_STORE_sub* itemlist, unsigned int count);
-bool buyingstore_search(struct map_session_data* sd, unsigned short nameid);
+bool buyingstore_search(struct map_session_data* sd, t_itemid nameid);
 bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_store_search* s);
 bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_store_search* s);
 DBMap *buyingstore_getdb(void);
 DBMap *buyingstore_getdb(void);
 void do_final_buyingstore(void);
 void do_final_buyingstore(void);

+ 15 - 15
src/map/cashshop.cpp

@@ -33,13 +33,13 @@ extern char sales_table[32];
  */
  */
 static bool cashshop_parse_dbrow(char* fields[], int columns, int current) {
 static bool cashshop_parse_dbrow(char* fields[], int columns, int current) {
 	uint16 tab = atoi(fields[0]);
 	uint16 tab = atoi(fields[0]);
-	unsigned short nameid = atoi(fields[1]);
+	t_itemid nameid = strtoul(fields[1], nullptr, 10);
 	uint32 price = atoi(fields[2]);
 	uint32 price = atoi(fields[2]);
 	int j;
 	int j;
 	struct cash_item_data* cid;
 	struct cash_item_data* cid;
 
 
 	if( !itemdb_exists( nameid ) ){
 	if( !itemdb_exists( nameid ) ){
-		ShowWarning( "cashshop_parse_dbrow: Invalid ID %hu in line '%d', skipping...\n", nameid, current );
+		ShowWarning( "cashshop_parse_dbrow: Invalid ID %u in line '%d', skipping...\n", nameid, current );
 		return 0;
 		return 0;
 	}
 	}
 
 
@@ -151,32 +151,32 @@ static int cashshop_read_db_sql( void ){
 
 
 #if PACKETVER_SUPPORTS_SALES
 #if PACKETVER_SUPPORTS_SALES
 static bool sale_parse_dbrow( char* fields[], int columns, int current ){
 static bool sale_parse_dbrow( char* fields[], int columns, int current ){
-	unsigned short nameid = atoi(fields[0]);
+	t_itemid nameid = strtoul(fields[0], nullptr, 10);
 	int start = atoi(fields[1]), end = atoi(fields[2]), amount = atoi(fields[3]), i;
 	int start = atoi(fields[1]), end = atoi(fields[2]), amount = atoi(fields[3]), i;
 	time_t now = time(NULL);
 	time_t now = time(NULL);
 	struct sale_item_data* sale_item = NULL;
 	struct sale_item_data* sale_item = NULL;
 
 
 	if( !itemdb_exists(nameid) ){
 	if( !itemdb_exists(nameid) ){
-		ShowWarning( "sale_parse_dbrow: Invalid ID %hu in line '%d', skipping...\n", nameid, current );
+		ShowWarning( "sale_parse_dbrow: Invalid ID %u in line '%d', skipping...\n", nameid, current );
 		return false;
 		return false;
 	}
 	}
 
 
 	ARR_FIND( 0, cash_shop_items[CASHSHOP_TAB_SALE].count, i, cash_shop_items[CASHSHOP_TAB_SALE].item[i]->nameid == nameid );
 	ARR_FIND( 0, cash_shop_items[CASHSHOP_TAB_SALE].count, i, cash_shop_items[CASHSHOP_TAB_SALE].item[i]->nameid == nameid );
 
 
 	if( i == cash_shop_items[CASHSHOP_TAB_SALE].count ){
 	if( i == cash_shop_items[CASHSHOP_TAB_SALE].count ){
-		ShowWarning( "sale_parse_dbrow: ID %hu is not registered in the limited tab in line '%d', skipping...\n", nameid, current );
+		ShowWarning( "sale_parse_dbrow: ID %u is not registered in the limited tab in line '%d', skipping...\n", nameid, current );
 		return false;
 		return false;
 	}
 	}
 
 
 	// Check if the end is after the start
 	// Check if the end is after the start
 	if( start >= end ){
 	if( start >= end ){
-		ShowWarning( "sale_parse_dbrow: Sale for item %hu was ignored, because the timespan was not correct.\n", nameid );
+		ShowWarning( "sale_parse_dbrow: Sale for item %u was ignored, because the timespan was not correct.\n", nameid );
 		return false;
 		return false;
 	}
 	}
 
 
 	// Check if it is already in the past
 	// Check if it is already in the past
 	if( end < now ){
 	if( end < now ){
-		ShowWarning( "sale_parse_dbrow: An outdated sale for item %hu was ignored.\n", nameid );
+		ShowWarning( "sale_parse_dbrow: An outdated sale for item %u was ignored.\n", nameid );
 		return false;
 		return false;
 	}
 	}
 
 
@@ -267,7 +267,7 @@ static TIMER_FUNC(sale_start_timer){
 	return 1;
 	return 1;
 }
 }
 
 
-enum e_sale_add_result sale_add_item( uint16 nameid, int32 count, time_t from, time_t to ){
+enum e_sale_add_result sale_add_item( t_itemid nameid, int32 count, time_t from, time_t to ){
 	int i;
 	int i;
 	struct sale_item_data* sale_item;
 	struct sale_item_data* sale_item;
 
 
@@ -299,7 +299,7 @@ enum e_sale_add_result sale_add_item( uint16 nameid, int32 count, time_t from, t
 		return SALE_ADD_DUPLICATE;
 		return SALE_ADD_DUPLICATE;
 	}
 	}
 	
 	
-	if( SQL_ERROR == Sql_Query(mmysql_handle, "INSERT INTO `%s`(`nameid`,`start`,`end`,`amount`) VALUES ( '%d', FROM_UNIXTIME(%d), FROM_UNIXTIME(%d), '%d' )", sales_table, nameid, (uint32)from, (uint32)to, count) ){
+	if( SQL_ERROR == Sql_Query(mmysql_handle, "INSERT INTO `%s`(`nameid`,`start`,`end`,`amount`) VALUES ( '%u', FROM_UNIXTIME(%d), FROM_UNIXTIME(%d), '%d' )", sales_table, nameid, (uint32)from, (uint32)to, count) ){
 		Sql_ShowDebug(mmysql_handle);
 		Sql_ShowDebug(mmysql_handle);
 		return SALE_ADD_FAILED;
 		return SALE_ADD_FAILED;
 	}
 	}
@@ -318,7 +318,7 @@ enum e_sale_add_result sale_add_item( uint16 nameid, int32 count, time_t from, t
 	return SALE_ADD_SUCCESS;
 	return SALE_ADD_SUCCESS;
 }
 }
 
 
-bool sale_remove_item( uint16 nameid ){
+bool sale_remove_item( t_itemid nameid ){
 	struct sale_item_data* sale_item;
 	struct sale_item_data* sale_item;
 	int i;
 	int i;
 
 
@@ -330,7 +330,7 @@ bool sale_remove_item( uint16 nameid ){
 	}
 	}
 
 
 	// Delete it from the database
 	// Delete it from the database
-	if( SQL_ERROR == Sql_Query(mmysql_handle, "DELETE FROM `%s` WHERE `nameid` = '%d'", sales_table, nameid ) ){
+	if( SQL_ERROR == Sql_Query(mmysql_handle, "DELETE FROM `%s` WHERE `nameid` = '%u'", sales_table, nameid ) ){
 		Sql_ShowDebug(mmysql_handle);
 		Sql_ShowDebug(mmysql_handle);
 		return false;
 		return false;
 	}
 	}
@@ -371,7 +371,7 @@ bool sale_remove_item( uint16 nameid ){
 	return true;
 	return true;
 }
 }
 
 
-struct sale_item_data* sale_find_item( uint16 nameid, bool onsale ){
+struct sale_item_data* sale_find_item( t_itemid nameid, bool onsale ){
 	int i;
 	int i;
 	struct sale_item_data* sale_item;
 	struct sale_item_data* sale_item;
 	time_t now = time(NULL);
 	time_t now = time(NULL);
@@ -487,7 +487,7 @@ bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, s
 	new_ = 0;
 	new_ = 0;
 
 
 	for( i = 0; i < n; ++i ){
 	for( i = 0; i < n; ++i ){
-		unsigned short nameid = item_list[i].itemId;
+		t_itemid nameid = item_list[i].itemId;
 		uint32 quantity = item_list[i].amount;
 		uint32 quantity = item_list[i].amount;
 		uint16 tab = item_list[i].tab;
 		uint16 tab = item_list[i].tab;
 		int j;
 		int j;
@@ -569,7 +569,7 @@ bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, s
 	}
 	}
 
 
 	for( i = 0; i < n; ++i ){
 	for( i = 0; i < n; ++i ){
-		unsigned short nameid = item_list[i].itemId;
+		t_itemid nameid = item_list[i].itemId;
 		uint32 quantity = item_list[i].amount;
 		uint32 quantity = item_list[i].amount;
 #if PACKETVER_SUPPORTS_SALES
 #if PACKETVER_SUPPORTS_SALES
 		uint16 tab = item_list[i].tab;
 		uint16 tab = item_list[i].tab;
@@ -615,7 +615,7 @@ bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, s
 					if( new_amount == 0 ){
 					if( new_amount == 0 ){
 						sale_remove_item(sale->nameid);
 						sale_remove_item(sale->nameid);
 					}else{
 					}else{
-						if( SQL_ERROR == Sql_Query( mmysql_handle, "UPDATE `%s` SET `amount` = '%d' WHERE `nameid` = '%d'", sales_table, new_amount, nameid ) ){
+						if( SQL_ERROR == Sql_Query( mmysql_handle, "UPDATE `%s` SET `amount` = '%d' WHERE `nameid` = '%u'", sales_table, new_amount, nameid ) ){
 							Sql_ShowDebug(mmysql_handle);
 							Sql_ShowDebug(mmysql_handle);
 						}
 						}
 
 

+ 8 - 6
src/map/cashshop.hpp

@@ -4,9 +4,11 @@
 #ifndef CASHSHOP_HPP
 #ifndef CASHSHOP_HPP
 #define CASHSHOP_HPP
 #define CASHSHOP_HPP
 
 
+#include "../config/core.hpp"
+
 #include "../common/cbasetypes.hpp" // uint16, uint32
 #include "../common/cbasetypes.hpp" // uint16, uint32
+#include "../common/mmo.hpp" // t_itemid
 #include "../common/timer.hpp" // ShowWarning, ShowStatus
 #include "../common/timer.hpp" // ShowWarning, ShowStatus
-#include "../config/core.hpp"
 
 
 struct map_session_data;
 struct map_session_data;
 
 
@@ -51,7 +53,7 @@ enum CASHSHOP_BUY_RESULT
 };
 };
 
 
 struct cash_item_data{
 struct cash_item_data{
-	unsigned short nameid;
+	t_itemid nameid;
 	uint32 price;
 	uint32 price;
 };
 };
 
 
@@ -71,7 +73,7 @@ enum e_sale_add_result {
 
 
 struct sale_item_data{
 struct sale_item_data{
 	// Data
 	// Data
-	uint16 nameid;
+	t_itemid nameid;
 	time_t start;
 	time_t start;
 	time_t end;
 	time_t end;
 	uint32 amount;
 	uint32 amount;
@@ -89,9 +91,9 @@ struct sale_item_db{
 #if PACKETVER_SUPPORTS_SALES
 #if PACKETVER_SUPPORTS_SALES
 extern struct sale_item_db sale_items;
 extern struct sale_item_db sale_items;
 
 
-struct sale_item_data* sale_find_item(uint16 nameid, bool onsale);
-enum e_sale_add_result sale_add_item(uint16 nameid, int32 count, time_t from, time_t to);
-bool sale_remove_item(uint16 nameid);
+struct sale_item_data* sale_find_item(t_itemid nameid, bool onsale);
+enum e_sale_add_result sale_add_item(t_itemid nameid, int32 count, time_t from, time_t to);
+bool sale_remove_item(t_itemid nameid);
 void sale_notify_login( struct map_session_data* sd );
 void sale_notify_login( struct map_session_data* sd );
 #endif
 #endif
 
 

+ 108 - 120
src/map/clif.cpp

@@ -106,7 +106,7 @@ enum e_inventory_type{
 * @param nameid: Item ID
 * @param nameid: Item ID
 * @return item type. For IT_PETEGG will be displayed as IT_ARMOR. If Shadow Weapon of IT_SHADOWGEAR as IT_WEAPON and else as IT_ARMOR
 * @return item type. For IT_PETEGG will be displayed as IT_ARMOR. If Shadow Weapon of IT_SHADOWGEAR as IT_WEAPON and else as IT_ARMOR
 */
 */
-static inline int itemtype(unsigned short nameid) {
+static inline int itemtype(t_itemid nameid) {
 	struct item_data* id = itemdb_search(nameid); //Use itemdb_search, so non-existance item will use dummy data and won't crash the server. bugreport:8468
 	struct item_data* id = itemdb_search(nameid); //Use itemdb_search, so non-existance item will use dummy data and won't crash the server. bugreport:8468
 	int type = id->type;
 	int type = id->type;
 	if( type == IT_SHADOWGEAR ) {
 	if( type == IT_SHADOWGEAR ) {
@@ -141,8 +141,8 @@ static inline uint32 disguised_bl_id( uint32 bl_id ){
 }
 }
 
 
 #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
 #if PACKETVER_MAIN_NUM >= 20181121 || PACKETVER_RE_NUM >= 20180704 || PACKETVER_ZERO_NUM >= 20181114
-static inline uint32 client_nameid( uint32 server_nameid ){
-	uint32 view = itemdb_viewid( server_nameid );
+static inline uint32 client_nameid( t_itemid server_nameid ){
+	t_itemid view = itemdb_viewid( server_nameid );
 
 
 	if( view > 0 ){
 	if( view > 0 ){
 		return view;
 		return view;
@@ -151,12 +151,20 @@ static inline uint32 client_nameid( uint32 server_nameid ){
 	}
 	}
 }
 }
 #else
 #else
-static inline uint16 client_nameid( uint32 server_nameid ){
-	uint32 view = itemdb_viewid( server_nameid );
+static inline uint16 client_nameid( t_itemid server_nameid ){
+	t_itemid view = itemdb_viewid( server_nameid );
 
 
 	if( view > 0 ){
 	if( view > 0 ){
+		if( view > UINT16_MAX ){
+			return (uint16)UNKNOWN_ITEM_ID;
+		}
+
 		return (uint16)view;
 		return (uint16)view;
 	}else{
 	}else{
+		if( server_nameid > UINT16_MAX ){
+			return (uint16)UNKNOWN_ITEM_ID;
+		}
+
 		return (uint16)server_nameid;
 		return (uint16)server_nameid;
 	}
 	}
 }
 }
@@ -841,17 +849,15 @@ void clif_charselectok(int id, uint8 ok)
 void clif_dropflooritem( struct flooritem_data* fitem, bool canShowEffect ){
 void clif_dropflooritem( struct flooritem_data* fitem, bool canShowEffect ){
 	nullpo_retv(fitem);
 	nullpo_retv(fitem);
 
 
-	if( fitem->item.nameid <= 0 ){
+	if( fitem->item.nameid == 0 ){
 		return;
 		return;
 	}
 	}
 
 
-	int view = itemdb_viewid( fitem->item.nameid );
-
 	struct packet_dropflooritem p;
 	struct packet_dropflooritem p;
 
 
 	p.PacketType = dropflooritemType;
 	p.PacketType = dropflooritemType;
 	p.ITAID = fitem->bl.id;
 	p.ITAID = fitem->bl.id;
-	p.ITID = ( view > 0 ) ? view : fitem->item.nameid;
+	p.ITID = client_nameid( fitem->item.nameid );
 #if PACKETVER >= 20130000 /* not sure date */
 #if PACKETVER >= 20130000 /* not sure date */
 	p.type = itemtype( fitem->item.nameid );
 	p.type = itemtype( fitem->item.nameid );
 #endif
 #endif
@@ -963,7 +969,7 @@ void clif_clearunit_delayed(struct block_list* bl, clr_type type, t_tick tick)
 	add_timer(tick, clif_clearunit_delayed_sub, (int)type, (intptr_t)tbl);
 	add_timer(tick, clif_clearunit_delayed_sub, (int)type, (intptr_t)tbl);
 }
 }
 
 
-void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand)
+void clif_get_weapon_view(struct map_session_data* sd, t_itemid *rhand, t_itemid *lhand)
 {
 {
 	if(sd->sc.option&OPTION_COSTUME)
 	if(sd->sc.option&OPTION_COSTUME)
 	{
 	{
@@ -2183,6 +2189,7 @@ void clif_parse_NPCShopClosed(int fd, struct map_session_data *sd) {
  * Presents list of items, that can be sold to a Market shop.
  * Presents list of items, that can be sold to a Market shop.
  * @author: Ind and Yommy
  * @author: Ind and Yommy
  **/
  **/
+/// 0x9d5 <packet len>.W { <name id>.W <type>.B <price>.L <qty>.L <weight>.W }* (ZC_NPC_MARKET_OPEN)
 void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) {
 void clif_npc_market_open(struct map_session_data *sd, struct npc_data *nd) {
 #if PACKETVER >= 20131223
 #if PACKETVER >= 20131223
 	nullpo_retv( sd );
 	nullpo_retv( sd );
@@ -2237,6 +2244,7 @@ void clif_parse_NPCMarketClosed(int fd, struct map_session_data *sd) {
 
 
 
 
 /// Purchase item from Market shop.
 /// Purchase item from Market shop.
+/// 0x9d7 <packet len>.W <count>.B { <name id>.W <qty>.W <price>.L }* (ZC_NPC_MARKET_PURCHASE_RESULT)
 void clif_npc_market_purchase_ack(struct map_session_data *sd, uint8 res, uint8 n, struct s_npc_buy_list *list) {
 void clif_npc_market_purchase_ack(struct map_session_data *sd, uint8 res, uint8 n, struct s_npc_buy_list *list) {
 #if PACKETVER >= 20131223
 #if PACKETVER >= 20131223
 	nullpo_retv( sd );
 	nullpo_retv( sd );
@@ -2283,6 +2291,7 @@ void clif_npc_market_purchase_ack(struct map_session_data *sd, uint8 res, uint8
 
 
 
 
 /// Purchase item from Market shop.
 /// Purchase item from Market shop.
+/// 0x9d6 <len>.W { <name id>.W <qty>.L } (CZ_NPC_MARKET_PURCHASE)
 void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) {
 void clif_parse_NPCMarketPurchase(int fd, struct map_session_data *sd) {
 #if PACKETVER >= 20131223
 #if PACKETVER >= 20131223
 	nullpo_retv( sd );
 	nullpo_retv( sd );
@@ -2639,28 +2648,12 @@ static void clif_addcards( struct EQUIPSLOTINFO* buf, struct item* item ){
 	}
 	}
 
 
 	// Normal items.
 	// Normal items.
-	if( item->card[i] > 0 && ( j = itemdb_viewid( item->card[i] ) ) > 0 ){
-		buf->card[0] = j;
-	}else{
-		buf->card[0] = item->card[i];
-	}
-
-	if( item->card[++i] > 0 && ( j = itemdb_viewid( item->card[i] ) ) > 0 ){
-		buf->card[1] = j;
-	}else{
-		buf->card[1] = item->card[i];
-	}
-
-	if( item->card[++i] > 0 && ( j = itemdb_viewid( item->card[i] ) ) > 0 ){
-		buf->card[2] = j;
-	}else{
-		buf->card[2] = item->card[i];
-	}
-
-	if( item->card[++i] > 0 && ( j = itemdb_viewid( item->card[i] ) ) > 0 ){
-		buf->card[3] = j;
-	}else{
-		buf->card[3] = item->card[i];
+	for( int k = 0; k < 4; k++, i++ ){
+		if( item->card[i] > 0 ){
+			buf->card[k] = client_nameid( item->card[i] );
+		}else{
+			buf->card[k] = 0;
+		}
 	}
 	}
 }
 }
 
 
@@ -2716,7 +2709,7 @@ void clif_additem( struct map_session_data *sd, int n, int amount, unsigned char
 	if( fail ){
 	if( fail ){
 		p = {};
 		p = {};
 	}else{
 	}else{
-		if( n < 0 || n >= MAX_INVENTORY || sd->inventory.u.items_inventory[n].nameid <= 0 || sd->inventory_data[n] == nullptr ){
+		if( n < 0 || n >= MAX_INVENTORY || sd->inventory.u.items_inventory[n].nameid == 0 || sd->inventory_data[n] == nullptr ){
 			return;
 			return;
 		}
 		}
 
 
@@ -2941,7 +2934,7 @@ void clif_inventorylist( struct map_session_data *sd ){
 	int normal = 0;
 	int normal = 0;
 
 
 	for( int i = 0; i < MAX_INVENTORY; i++ ){
 	for( int i = 0; i < MAX_INVENTORY; i++ ){
-		if( sd->inventory.u.items_inventory[i].nameid <= 0 || sd->inventory_data[i] == nullptr ){
+		if( sd->inventory.u.items_inventory[i].nameid == 0 || sd->inventory_data[i] == nullptr ){
 			continue;
 			continue;
 		}
 		}
 
 
@@ -3007,7 +3000,7 @@ void clif_inventorylist( struct map_session_data *sd ){
 /* on 20120925 onwards this is a field on clif_item_equip/normal */
 /* on 20120925 onwards this is a field on clif_item_equip/normal */
 #if PACKETVER >= 20111122 && PACKETVER < 20120925
 #if PACKETVER >= 20111122 && PACKETVER < 20120925
 	for( int i = 0; i < MAX_INVENTORY; i++ ){
 	for( int i = 0; i < MAX_INVENTORY; i++ ){
-		if( sd->inventory.u.items_inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL )
+		if( sd->inventory.u.items_inventory[i].nameid == 0 || sd->inventory_data[i] == NULL )
 			continue;
 			continue;
 
 
 		if ( sd->inventory.u.items_inventory[i].favorite )
 		if ( sd->inventory.u.items_inventory[i].favorite )
@@ -3034,7 +3027,7 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items
 	int normal = 0;
 	int normal = 0;
 
 
 	for( int i = 0; i < items_length; i++ ){
 	for( int i = 0; i < items_length; i++ ){
-		if( items[i].nameid <= 0 ){
+		if( items[i].nameid == 0 ){
 			continue;
 			continue;
 		}
 		}
 
 
@@ -3120,7 +3113,7 @@ void clif_cartlist( struct map_session_data *sd ){
 	int equip = 0;
 	int equip = 0;
 
 
 	for( int i = 0; i < MAX_CART; i++ ){
 	for( int i = 0; i < MAX_CART; i++ ){
-		if( sd->cart.u.items_cart[i].nameid <= 0 ){
+		if( sd->cart.u.items_cart[i].nameid == 0 ){
 			continue;
 			continue;
 		}
 		}
 
 
@@ -3578,7 +3571,7 @@ void clif_changestatus(struct map_session_data* sd,int type,int val)
 
 
 
 
 /// 00c3 <id>.L <type>.B <value>.B (ZC_SPRITE_CHANGE)
 /// 00c3 <id>.L <type>.B <value>.B (ZC_SPRITE_CHANGE)
-/// 01d7 <id>.L <type>.B <value>.L (ZC_SPRITE_CHANGE2)
+/// 01d7 <id>.L <type>.B <value1>.W <value2>.W (ZC_SPRITE_CHANGE2)
 void clif_sprite_change( struct block_list *bl, int id, int type, int val, int val2, enum send_target target ){
 void clif_sprite_change( struct block_list *bl, int id, int type, int val, int val2, enum send_target target ){
 	struct PACKET_ZC_SPRITE_CHANGE p;
 	struct PACKET_ZC_SPRITE_CHANGE p;
 
 
@@ -3687,7 +3680,7 @@ void clif_changelook(struct block_list *bl, int type, int val) {
 #if PACKETVER > 3
 #if PACKETVER > 3
 				if (sd) {
 				if (sd) {
 					int n;
 					int n;
-					if((n = sd->equip_index[2]) >= 0 && sd->inventory_data[n]) {
+					if((n = sd->equip_index[EQI_SHOES]) >= 0 && sd->inventory_data[n]) {
 						if(sd->inventory_data[n]->view_id > 0)
 						if(sd->inventory_data[n]->view_id > 0)
 							val = sd->inventory_data[n]->view_id;
 							val = sd->inventory_data[n]->view_id;
 						else
 						else
@@ -3875,7 +3868,7 @@ void clif_arrow_create_list( struct map_session_data *sd ){
 
 
 	int count = 0;
 	int count = 0;
 	for( int i = 0; i < MAX_SKILL_ARROW_DB; i++ ){
 	for( int i = 0; i < MAX_SKILL_ARROW_DB; i++ ){
-		short nameid = skill_arrow_db[i].nameid;
+		t_itemid nameid = skill_arrow_db[i].nameid;
 
 
 		if( !itemdb_exists( nameid ) ){
 		if( !itemdb_exists( nameid ) ){
 			continue;
 			continue;
@@ -4144,7 +4137,7 @@ void clif_useitemack( struct map_session_data *sd, int index, int amount, bool o
 		return;
 		return;
 	}
 	}
 
 
-	if( index < 0 || index >= MAX_INVENTORY || sd->inventory.u.items_inventory[index].nameid <= 0 || sd->inventory_data[index] == nullptr ){
+	if( index < 0 || index >= MAX_INVENTORY || sd->inventory.u.items_inventory[index].nameid == 0 || sd->inventory_data[index] == nullptr ){
 		return;
 		return;
 	}
 	}
 
 
@@ -4479,7 +4472,7 @@ void clif_tradeadditem( struct map_session_data* sd, struct map_session_data* ts
 	if( index ){
 	if( index ){
 		index = server_index( index );
 		index = server_index( index );
 
 
-		if( index >= MAX_INVENTORY || sd->inventory.u.items_inventory[index].nameid <= 0 || sd->inventory_data[index] == nullptr ){
+		if( index >= MAX_INVENTORY || sd->inventory.u.items_inventory[index].nameid == 0 || sd->inventory_data[index] == nullptr ){
 			return;
 			return;
 		}
 		}
 
 
@@ -5082,11 +5075,10 @@ void clif_getareachar_item( struct map_session_data* sd,struct flooritem_data* f
 	nullpo_retv( fitem );
 	nullpo_retv( fitem );
 
 
 	struct PACKET_ZC_ITEM_ENTRY p;
 	struct PACKET_ZC_ITEM_ENTRY p;
-	int view = itemdb_viewid( fitem->item.nameid );
 
 
-	p.packetType = 0x9d;
+	p.packetType = HEADER_ZC_ITEM_ENTRY;
 	p.AID = fitem->bl.id;
 	p.AID = fitem->bl.id;
-	p.itemId = view > 0 ? view : fitem->item.nameid;
+	p.itemId = client_nameid( fitem->item.nameid );
 	p.identify = fitem->item.identify;
 	p.identify = fitem->item.identify;
 	p.x = fitem->bl.x;
 	p.x = fitem->bl.x;
 	p.y = fitem->bl.y;
 	p.y = fitem->bl.y;
@@ -5631,7 +5623,7 @@ void clif_skillcastcancel(struct block_list* bl)
 /// if(result!=0) doesn't display any of the previous messages
 /// if(result!=0) doesn't display any of the previous messages
 /// Note: when this packet is received an unknown flag is always set to 0,
 /// Note: when this packet is received an unknown flag is always set to 0,
 /// suggesting this is an ACK packet for the UseSkill packets and should be sent on success too [FlavioJS]
 /// suggesting this is an ACK packet for the UseSkill packets and should be sent on success too [FlavioJS]
-void clif_skill_fail( struct map_session_data *sd, uint16 skill_id, enum useskill_fail_cause cause, int btype, int itemId ){
+void clif_skill_fail( struct map_session_data *sd, uint16 skill_id, enum useskill_fail_cause cause, int btype, t_itemid itemId ){
 	nullpo_retv( sd );
 	nullpo_retv( sd );
 
 
 	int fd = sd->fd;
 	int fd = sd->fd;
@@ -5654,7 +5646,7 @@ void clif_skill_fail( struct map_session_data *sd, uint16 skill_id, enum useskil
 
 
 	struct PACKET_ZC_ACK_TOUSESKILL p;
 	struct PACKET_ZC_ACK_TOUSESKILL p;
 
 
-	p.packetType = 0x110;
+	p.packetType = HEADER_ZC_ACK_TOUSESKILL;
 	p.skillId = skill_id;
 	p.skillId = skill_id;
 	p.btype = btype;
 	p.btype = btype;
 	p.itemId = itemId;
 	p.itemId = itemId;
@@ -6637,10 +6629,10 @@ void clif_refine(int fd, int fail, int index, int val)
 ///     1 = "weapon upgraded: %s" MsgStringTable[912] in rgb(0,205,205)
 ///     1 = "weapon upgraded: %s" MsgStringTable[912] in rgb(0,205,205)
 ///     2 = "cannot upgrade %s until you level up the upgrade weapon skill" MsgStringTable[913] in rgb(255,200,200)
 ///     2 = "cannot upgrade %s until you level up the upgrade weapon skill" MsgStringTable[913] in rgb(255,200,200)
 ///     3 = "you lack the item %s to upgrade the weapon" MsgStringTable[914] in rgb(255,200,200)
 ///     3 = "you lack the item %s to upgrade the weapon" MsgStringTable[914] in rgb(255,200,200)
-void clif_upgrademessage( struct map_session_data* sd, int result, unsigned short item_id ){
+void clif_upgrademessage( struct map_session_data* sd, int result, t_itemid item_id ){
 	struct PACKET_ZC_ACK_WEAPONREFINE p;
 	struct PACKET_ZC_ACK_WEAPONREFINE p;
 
 
-	p.packetType = 0x223;
+	p.packetType = HEADER_ZC_ACK_WEAPONREFINE;
 	p.result = result;
 	p.result = result;
 	p.itemId = client_nameid( item_id );
 	p.itemId = client_nameid( item_id );
 
 
@@ -6829,7 +6821,7 @@ void clif_item_identify_list(struct map_session_data *sd)
 	WFIFOW(fd,0)=0x177;
 	WFIFOW(fd,0)=0x177;
 	for(i=c=0;i<MAX_INVENTORY;i++){
 	for(i=c=0;i<MAX_INVENTORY;i++){
 		if(sd->inventory.u.items_inventory[i].nameid > 0 && !sd->inventory.u.items_inventory[i].identify){
 		if(sd->inventory.u.items_inventory[i].nameid > 0 && !sd->inventory.u.items_inventory[i].identify){
-			WFIFOW(fd,c*2+4)=i+2;
+			WFIFOW(fd,c*2+4)=client_index(i);
 			c++;
 			c++;
 		}
 		}
 	}
 	}
@@ -6884,7 +6876,7 @@ void clif_item_repair_list( struct map_session_data *sd,struct map_session_data
 	for( int i = 0; i < MAX_INVENTORY; i++ ){
 	for( int i = 0; i < MAX_INVENTORY; i++ ){
 		if( dstsd->inventory.u.items_inventory[i].nameid > 0 && dstsd->inventory.u.items_inventory[i].attribute != 0 && !itemdb_ishatched_egg( &dstsd->inventory.u.items_inventory[i] ) ){ // && skill_can_repair(sd,nameid)){
 		if( dstsd->inventory.u.items_inventory[i].nameid > 0 && dstsd->inventory.u.items_inventory[i].attribute != 0 && !itemdb_ishatched_egg( &dstsd->inventory.u.items_inventory[i] ) ){ // && skill_can_repair(sd,nameid)){
 			p->items[c].index = i;
 			p->items[c].index = i;
-			p->items[c].itemId = dstsd->inventory.u.items_inventory[i].nameid;
+			p->items[c].itemId = client_nameid( dstsd->inventory.u.items_inventory[i].nameid );
 			p->items[c].refine = dstsd->inventory.u.items_inventory[i].refine;
 			p->items[c].refine = dstsd->inventory.u.items_inventory[i].refine;
 			clif_addcards( &p->items[c].slot, &dstsd->inventory.u.items_inventory[i] );
 			clif_addcards( &p->items[c].slot, &dstsd->inventory.u.items_inventory[i] );
 			c++;
 			c++;
@@ -7030,7 +7022,7 @@ void clif_cart_additem( struct map_session_data *sd, int n, int amount ){
 		return;
 		return;
 	}
 	}
 
 
-	if( n < 0 || n >= MAX_CART || sd->cart.u.items_cart[n].nameid <= 0 ){
+	if( n < 0 || n >= MAX_CART || sd->cart.u.items_cart[n].nameid == 0 ){
 		return;
 		return;
 	}
 	}
 
 
@@ -7992,14 +7984,14 @@ void clif_movetoattack(struct map_session_data *sd,struct block_list *bl)
 ///     1 = failure
 ///     1 = failure
 ///     2 = success (alchemist)
 ///     2 = success (alchemist)
 ///     3 = failure (alchemist)
 ///     3 = failure (alchemist)
-void clif_produceeffect(struct map_session_data* sd,int flag, unsigned short nameid){
+void clif_produceeffect(struct map_session_data* sd,int flag, t_itemid nameid){
 	nullpo_retv( sd );
 	nullpo_retv( sd );
 
 
 	clif_solved_charname( sd->fd, sd->status.char_id, sd->status.name );
 	clif_solved_charname( sd->fd, sd->status.char_id, sd->status.name );
 
 
 	struct PACKET_ZC_ACK_REQMAKINGITEM p;
 	struct PACKET_ZC_ACK_REQMAKINGITEM p;
 
 
-	p.packetType = 0x18f;
+	p.packetType = HEADER_ZC_ACK_REQMAKINGITEM;
 	p.result = flag;
 	p.result = flag;
 	p.itemId = client_nameid( nameid );
 	p.itemId = client_nameid( nameid );
 
 
@@ -8056,11 +8048,11 @@ void clif_sendegg(struct map_session_data *sd)
 	WFIFOHEAD(fd, MAX_INVENTORY * 2 + 4);
 	WFIFOHEAD(fd, MAX_INVENTORY * 2 + 4);
 	WFIFOW(fd,0)=0x1a6;
 	WFIFOW(fd,0)=0x1a6;
 	for(i=0,n=0;i<MAX_INVENTORY;i++){
 	for(i=0,n=0;i<MAX_INVENTORY;i++){
-		if(sd->inventory.u.items_inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL ||
+		if(sd->inventory.u.items_inventory[i].nameid == 0 || sd->inventory_data[i] == NULL ||
 		   sd->inventory_data[i]->type != IT_PETEGG ||
 		   sd->inventory_data[i]->type != IT_PETEGG ||
 		   sd->inventory.u.items_inventory[i].amount <= 0)
 		   sd->inventory.u.items_inventory[i].amount <= 0)
 			continue;
 			continue;
-		WFIFOW(fd,n*2+4)=i+2;
+		WFIFOW(fd,n*2+4)=client_index(i);
 		n++;
 		n++;
 	}
 	}
 	WFIFOW(fd,2)=4+n*2;
 	WFIFOW(fd,2)=4+n*2;
@@ -8348,10 +8340,10 @@ void clif_mvp_effect(struct map_session_data *sd)
 
 
 /// MVP item reward message (ZC_MVP_GETTING_ITEM).
 /// MVP item reward message (ZC_MVP_GETTING_ITEM).
 /// 010a <name id>.W
 /// 010a <name id>.W
-void clif_mvp_item( struct map_session_data *sd, unsigned short nameid ){
+void clif_mvp_item( struct map_session_data *sd, t_itemid nameid ){
 	struct PACKET_ZC_MVP_GETTING_ITEM p;
 	struct PACKET_ZC_MVP_GETTING_ITEM p;
 
 
-	p.packetType = 0x10a;
+	p.packetType = HEADER_ZC_MVP_GETTING_ITEM;
 	p.itemId = client_nameid( nameid );
 	p.itemId = client_nameid( nameid );
 
 
 	clif_send( &p, sizeof( p ), &sd->bl, SELF );
 	clif_send( &p, sizeof( p ), &sd->bl, SELF );
@@ -10085,7 +10077,7 @@ void clif_viewequip_ack( struct map_session_data* sd, struct map_session_data* t
 		int k = tsd->equip_index[i];
 		int k = tsd->equip_index[i];
 
 
 		if( k >= 0 ){
 		if( k >= 0 ){
-			if( tsd->inventory.u.items_inventory[k].nameid <= 0 || tsd->inventory_data[k] == NULL ){ // Item doesn't exist
+			if( tsd->inventory.u.items_inventory[k].nameid == 0 || tsd->inventory_data[k] == NULL ){ // Item doesn't exist
 				continue;
 				continue;
 			}
 			}
 
 
@@ -11064,6 +11056,11 @@ void clif_parse_progressbar(int fd, struct map_session_data * sd){
 	sd->progressbar.npc_id = 0;
 	sd->progressbar.npc_id = 0;
 	sd->progressbar.timeout = 0;
 	sd->progressbar.timeout = 0;
 	sd->state.workinprogress = WIP_DISABLE_NONE;
 	sd->state.workinprogress = WIP_DISABLE_NONE;
+
+	if( battle_config.idletime_option&IDLE_NPC_PROGRESS ){
+		sd->idletime = last_tick;
+	}
+
 	npc_scriptcont(sd, npc_id, closing);
 	npc_scriptcont(sd, npc_id, closing);
 }
 }
 
 
@@ -11165,9 +11162,12 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd)
 	if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC_SUHIDE] && !sd->sc.data[SC_NEWMOON] &&
 	if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && !sd->sc.data[SC_SUHIDE] && !sd->sc.data[SC_NEWMOON] &&
 		(!battle_config.prevent_logout || sd->canlog_tick == 0 || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) )
 		(!battle_config.prevent_logout || sd->canlog_tick == 0 || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) )
 	{
 	{
-		set_eof(fd);
 		pc_damage_log_clear(sd,0);
 		pc_damage_log_clear(sd,0);
 		clif_disconnect_ack(sd, 0);
 		clif_disconnect_ack(sd, 0);
+		flush_fifo( fd );
+		if( battle_config.drop_connection_on_quit ){
+			set_eof( fd );
+		}
 	} else {
 	} else {
 		clif_disconnect_ack(sd, 1);
 		clif_disconnect_ack(sd, 1);
 	}
 	}
@@ -12916,6 +12916,11 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd){
 	}
 	}
 
 
 	sd->npc_menu = select;
 	sd->npc_menu = select;
+
+	if( battle_config.idletime_option&IDLE_NPC_MENU ){
+		sd->idletime = last_tick;
+	}
+
 	npc_scriptcont(sd,npc_id, false);
 	npc_scriptcont(sd,npc_id, false);
 }
 }
 
 
@@ -12924,6 +12929,10 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd){
 /// 00b9 <npc id>.L
 /// 00b9 <npc id>.L
 void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd)
 void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd)
 {
 {
+	if( battle_config.idletime_option&IDLE_NPC_NEXT ){
+		sd->idletime = last_tick;
+	}
+
 	npc_scriptcont(sd,RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), false);
 	npc_scriptcont(sd,RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), false);
 }
 }
 
 
@@ -12936,6 +12945,11 @@ void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd){
 	int amount = (int)RFIFOL(fd,info->pos[1]);
 	int amount = (int)RFIFOL(fd,info->pos[1]);
 
 
 	sd->npc_amount = amount;
 	sd->npc_amount = amount;
+
+	if( battle_config.idletime_option&IDLE_NPC_INPUT ){
+		sd->idletime = last_tick;
+	}
+
 	npc_scriptcont(sd, npcid, false);
 	npc_scriptcont(sd, npcid, false);
 }
 }
 
 
@@ -12956,6 +12970,11 @@ void clif_parse_NpcStringInput(int fd, struct map_session_data* sd){
 #endif
 #endif
 
 
 	safestrncpy(sd->npc_str, message, min(message_len,CHATBOX_SIZE));
 	safestrncpy(sd->npc_str, message, min(message_len,CHATBOX_SIZE));
+
+	if( battle_config.idletime_option&IDLE_NPC_INPUT ){
+		sd->idletime = last_tick;
+	}
+
 	npc_scriptcont(sd, npcid, false);
 	npc_scriptcont(sd, npcid, false);
 }
 }
 
 
@@ -12966,6 +12985,11 @@ void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd)
 {
 {
 	if (!sd->npc_id) //Avoid parsing anything when the script was done with. [Skotlex]
 	if (!sd->npc_id) //Avoid parsing anything when the script was done with. [Skotlex]
 		return;
 		return;
+
+	if( battle_config.idletime_option&IDLE_NPC_CLOSE ){
+		sd->idletime = last_tick;
+	}
+
 	npc_scriptcont(sd, RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), true);
 	npc_scriptcont(sd, RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), true);
 }
 }
 
 
@@ -12985,7 +13009,7 @@ void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) {
 	// - Invalid item ID or item doesn't exist
 	// - Invalid item ID or item doesn't exist
 	// - Item is already identified
 	// - Item is already identified
 	if (idx < 0 || idx >= MAX_INVENTORY ||
 	if (idx < 0 || idx >= MAX_INVENTORY ||
-		sd->inventory.u.items_inventory[idx].nameid <= 0 || sd->inventory_data[idx] == NULL ||
+		sd->inventory.u.items_inventory[idx].nameid == 0 || sd->inventory_data[idx] == NULL ||
 		sd->inventory.u.items_inventory[idx].identify) {// cancel pressed
 		sd->inventory.u.items_inventory[idx].identify) {// cancel pressed
 			sd->state.workinprogress = WIP_DISABLE_NONE;
 			sd->state.workinprogress = WIP_DISABLE_NONE;
 			clif_menuskill_clear(sd);
 			clif_menuskill_clear(sd);
@@ -13016,9 +13040,6 @@ void clif_parse_SelectArrow(int fd,struct map_session_data *sd) {
 		case SA_CREATECON:
 		case SA_CREATECON:
 			skill_produce_mix(sd,SA_CREATECON,p->itemId,0,0,0,1,-1);
 			skill_produce_mix(sd,SA_CREATECON,p->itemId,0,0,0,1,-1);
 			break;
 			break;
-		case WL_READING_SB:
-			skill_spellbook(sd,p->itemId);
-			break;
 		case GC_POISONINGWEAPON:
 		case GC_POISONINGWEAPON:
 			skill_poisoningweapon(sd,p->itemId);
 			skill_poisoningweapon(sd,p->itemId);
 			break;
 			break;
@@ -14464,12 +14485,12 @@ void clif_parse_GM_Item_Monster(int fd, struct map_session_data *sd)
 	if( (id = itemdb_searchname(str)) ) {
 	if( (id = itemdb_searchname(str)) ) {
 		StringBuf_Init(&command);
 		StringBuf_Init(&command);
 		if( !itemdb_isstackable2(id) ) //Nonstackable
 		if( !itemdb_isstackable2(id) ) //Nonstackable
-			StringBuf_Printf(&command, "%citem2 %d 1 0 0 0 0 0 0 0", atcommand_symbol, id->nameid);
+			StringBuf_Printf(&command, "%citem2 %u 1 0 0 0 0 0 0 0", atcommand_symbol, id->nameid);
 		else {
 		else {
 			if (id->flag.guid)
 			if (id->flag.guid)
-				StringBuf_Printf(&command, "%citem %d 1", atcommand_symbol, id->nameid);
+				StringBuf_Printf(&command, "%citem %u 1", atcommand_symbol, id->nameid);
 			else
 			else
-				StringBuf_Printf(&command, "%citem %d 20", atcommand_symbol, id->nameid);
+				StringBuf_Printf(&command, "%citem %u 20", atcommand_symbol, id->nameid);
 		}
 		}
 		is_atcommand(fd, sd, StringBuf_Value(&command), 1);
 		is_atcommand(fd, sd, StringBuf_Value(&command), 1);
 		StringBuf_Destroy(&command);
 		StringBuf_Destroy(&command);
@@ -16663,6 +16684,8 @@ void clif_parse_cashshop_close( int fd, struct map_session_data* sd ){
 //0846 <tabid>.W (CZ_REQ_SE_CASH_TAB_CODE))
 //0846 <tabid>.W (CZ_REQ_SE_CASH_TAB_CODE))
 //08c0 <len>.W <openIdentity>.L <itemcount>.W (ZC_ACK_SE_CASH_ITEM_LIST2)
 //08c0 <len>.W <openIdentity>.L <itemcount>.W (ZC_ACK_SE_CASH_ITEM_LIST2)
 void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) {
 void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) {
+// [4144] packet exists only in 2011 and was dropped after
+#if PACKETVER >= 20110222 && PACKETVER < 20120000
 	short tab = RFIFOW(fd, packet_db[RFIFOW(fd,0)].pos[0]);
 	short tab = RFIFOW(fd, packet_db[RFIFOW(fd,0)].pos[0]);
 	int j;
 	int j;
 
 
@@ -16681,6 +16704,7 @@ void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) {
 	}
 	}
 
 
 	WFIFOSET(fd, 10 + ( cash_shop_items[tab].count * 6 ));
 	WFIFOSET(fd, 10 + ( cash_shop_items[tab].count * 6 ));
+#endif
 }
 }
 
 
 //08ca <len>.W <itemcount> W <tabcode>.W (ZC_ACK_SCHEDULER_CASHITEM)
 //08ca <len>.W <itemcount> W <tabcode>.W (ZC_ACK_SCHEDULER_CASHITEM)
@@ -16806,7 +16830,7 @@ void clif_cashshop_ack(struct map_session_data* sd, int error)
 	WFIFOSET(fd, packet_len(0x289));
 	WFIFOSET(fd, packet_len(0x289));
 }
 }
 
 
-void clif_cashshop_result( struct map_session_data *sd, unsigned short item_id, uint16 result ){
+void clif_cashshop_result( struct map_session_data *sd, t_itemid item_id, uint16 result ){
 #if PACKETVER_MAIN_NUM >= 20101123 || PACKETVER_RE_NUM >= 20120328 || defined( PACKETVER_ZERO )
 #if PACKETVER_MAIN_NUM >= 20101123 || PACKETVER_RE_NUM >= 20120328 || defined( PACKETVER_ZERO )
 	nullpo_retv( sd );
 	nullpo_retv( sd );
 
 
@@ -17636,11 +17660,11 @@ void clif_mercenary_message(struct map_session_data* sd, int message){
 
 
 /// Notification about the remaining time of a rental item.
 /// Notification about the remaining time of a rental item.
 /// 0298 <name id>.W <seconds>.L (ZC_CASH_TIME_COUNTER)
 /// 0298 <name id>.W <seconds>.L (ZC_CASH_TIME_COUNTER)
-void clif_rental_time( struct map_session_data* sd, unsigned short nameid, int seconds ){
+void clif_rental_time( struct map_session_data* sd, t_itemid nameid, int seconds ){
 	// '<ItemName>' item will disappear in <seconds/60> minutes.
 	// '<ItemName>' item will disappear in <seconds/60> minutes.
 	struct PACKET_ZC_CASH_TIME_COUNTER p;
 	struct PACKET_ZC_CASH_TIME_COUNTER p;
 
 
-	p.packetType = 0x298;
+	p.packetType = HEADER_ZC_CASH_TIME_COUNTER;
 	p.itemId = client_nameid( nameid );
 	p.itemId = client_nameid( nameid );
 	p.seconds = seconds;
 	p.seconds = seconds;
 
 
@@ -17650,11 +17674,11 @@ void clif_rental_time( struct map_session_data* sd, unsigned short nameid, int s
 
 
 /// Deletes a rental item from client's inventory.
 /// Deletes a rental item from client's inventory.
 /// 0299 <index>.W <name id>.W (ZC_CASH_ITEM_DELETE)
 /// 0299 <index>.W <name id>.W (ZC_CASH_ITEM_DELETE)
-void clif_rental_expired( struct map_session_data* sd, int index, unsigned short nameid ){
+void clif_rental_expired( struct map_session_data* sd, int index, t_itemid nameid ){
 	// '<ItemName>' item has been deleted from the Inventory
 	// '<ItemName>' item has been deleted from the Inventory
 	struct PACKET_ZC_CASH_ITEM_DELETE p;
 	struct PACKET_ZC_CASH_ITEM_DELETE p;
 
 
-	p.packetType = 0x299;
+	p.packetType = HEADER_ZC_CASH_ITEM_DELETE;
 	p.index = client_index( index );
 	p.index = client_index( index );
 	p.itemId = client_nameid( nameid );
 	p.itemId = client_nameid( nameid );
 
 
@@ -18184,9 +18208,9 @@ void clif_party_show_picker( struct map_session_data* sd, struct item* item_data
 
 
 	struct PACKET_ZC_ITEM_PICKUP_PARTY p;
 	struct PACKET_ZC_ITEM_PICKUP_PARTY p;
 
 
-	p.packetType = 0x2b8;
+	p.packetType = HEADER_ZC_ITEM_PICKUP_PARTY;
 	p.AID = sd->status.account_id;
 	p.AID = sd->status.account_id;
-	p.itemId = item_data->nameid;
+	p.itemId = client_nameid( item_data->nameid );
 	p.identified = item_data->identify;
 	p.identified = item_data->identify;
 	p.damaged = item_data->attribute;
 	p.damaged = item_data->attribute;
 	p.refine = item_data->refine;
 	p.refine = item_data->refine;
@@ -18605,11 +18629,11 @@ void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short resu
 /// Updates the zeny limit and an item in the buying store item list.
 /// Updates the zeny limit and an item in the buying store item list.
 /// 081b <name id>.W <amount>.W <limit zeny>.L (ZC_UPDATE_ITEM_FROM_BUYING_STORE)
 /// 081b <name id>.W <amount>.W <limit zeny>.L (ZC_UPDATE_ITEM_FROM_BUYING_STORE)
 /// 09e6 <name id>.W <amount>.W <zeny>.L <limit zeny>.L <GID>.L <Date>.L (ZC_UPDATE_ITEM_FROM_BUYING_STORE2)
 /// 09e6 <name id>.W <amount>.W <zeny>.L <limit zeny>.L <GID>.L <Date>.L (ZC_UPDATE_ITEM_FROM_BUYING_STORE2)
-void clif_buyingstore_update_item( struct map_session_data* sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny ){
+void clif_buyingstore_update_item( struct map_session_data* sd, t_itemid nameid, unsigned short amount, uint32 char_id, int zeny ){
 	struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE p;
 	struct PACKET_ZC_UPDATE_ITEM_FROM_BUYING_STORE p;
 
 
 	p.packetType = buyingStoreUpdateItemType;
 	p.packetType = buyingStoreUpdateItemType;
-	p.itemId = nameid;
+	p.itemId = client_nameid( nameid );
 	p.amount = amount;
 	p.amount = amount;
 	p.zenyLimit = sd->buyingstore.zenylimit;
 	p.zenyLimit = sd->buyingstore.zenylimit;
 #if PACKETVER >= 20141016
 #if PACKETVER >= 20141016
@@ -18648,10 +18672,10 @@ void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsi
 ///     6 = "The trade failed, because the entered amount of item %s is higher, than the buyer is willing to buy." (0x6d3, MSI_BUYINGSTORE_TRADE_OVERCOUNT)
 ///     6 = "The trade failed, because the entered amount of item %s is higher, than the buyer is willing to buy." (0x6d3, MSI_BUYINGSTORE_TRADE_OVERCOUNT)
 ///     7 = "The trade failed, because the buyer is lacking required balance." (0x6d1, MSI_BUYINGSTORE_TRADE_LACKBUYERZENY)
 ///     7 = "The trade failed, because the buyer is lacking required balance." (0x6d1, MSI_BUYINGSTORE_TRADE_LACKBUYERZENY)
 ///     ? = nothing
 ///     ? = nothing
-void clif_buyingstore_trade_failed_seller( struct map_session_data* sd, short result, unsigned short nameid ){
+void clif_buyingstore_trade_failed_seller( struct map_session_data* sd, short result, t_itemid nameid ){
 	struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER p;
 	struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER p;
 
 
-	p.packetType = 0x824;
+	p.packetType = HEADER_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER;
 	p.result = result;
 	p.result = result;
 	p.itemId = client_nameid( nameid );
 	p.itemId = client_nameid( nameid );
 
 
@@ -18914,43 +18938,7 @@ void clif_millenniumshield(struct block_list *bl, short shields) {
 	clif_send(buf,packet_len(0x440),bl,AREA);
 	clif_send(buf,packet_len(0x440),bl,AREA);
 #endif
 #endif
 }
 }
-/**
- * Warlock
- **/
-/*==========================================
- * Spellbook list [LimitLine/3CeAM]
- *------------------------------------------*/
-void clif_spellbook_list( struct map_session_data *sd ){
-	nullpo_retv( sd );
-
-	int fd = sd->fd;
-
-	if( !session_isActive( fd ) ){
-		return;
-	}
 
 
-	WFIFOHEAD( fd, sizeof( struct PACKET_ZC_MAKINGARROW_LIST ) + MAX_INVENTORY * sizeof( struct PACKET_ZC_MAKINGARROW_LIST_sub ) );
-	struct PACKET_ZC_MAKINGARROW_LIST *p = (struct PACKET_ZC_MAKINGARROW_LIST *)WFIFOP( fd, 0 );
-	p->packetType = HEADER_ZC_MAKINGARROW_LIST;
-
-	int count = 0;
-	for( int i = 0; i < MAX_INVENTORY; i++ ){
-		if( reading_spellbook_db.findBook( sd->inventory.u.items_inventory[i].nameid ) ){
-			p->items[count].itemId = client_nameid( sd->inventory.u.items_inventory[i].nameid );
-			count++;
-		}
-	}
-
-	if( count > 0 ){
-		p->packetLength = sizeof( struct PACKET_ZC_MAKINGARROW_LIST ) + count * sizeof( struct PACKET_ZC_MAKINGARROW_LIST_sub );
-		WFIFOSET( fd, p->packetLength );
-		sd->menuskill_id = WL_READING_SB;
-		sd->menuskill_val = count;
-	}else{
-		status_change_end( &sd->bl, SC_STOP, INVALID_TIMER );
-		clif_skill_fail( sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK, 0 );
-	}
-}
 /**
 /**
  * Mechanic
  * Mechanic
  **/
  **/
@@ -20016,7 +20004,7 @@ void clif_roulette_info( struct map_session_data* sd ){
 		for( int j = 0; j < MAX_ROULETTE_COLUMNS - i; j++ ){
 		for( int j = 0; j < MAX_ROULETTE_COLUMNS - i; j++ ){
 			p.ItemInfo[count].Row = i;
 			p.ItemInfo[count].Row = i;
 			p.ItemInfo[count].Position = j;
 			p.ItemInfo[count].Position = j;
-			p.ItemInfo[count].ItemId = rd.nameid[i][j];
+			p.ItemInfo[count].ItemId = client_nameid( rd.nameid[i][j] );
 			p.ItemInfo[count].Count = rd.qty[i][j];
 			p.ItemInfo[count].Count = rd.qty[i][j];
 #if PACKETVER >= 20180511
 #if PACKETVER >= 20180511
 			p.ItemInfo[count].unused = 0;
 			p.ItemInfo[count].unused = 0;
@@ -20102,7 +20090,7 @@ static uint8 clif_roulette_getitem(struct map_session_data *sd) {
 
 
 /// Update Roulette window with current stats
 /// Update Roulette window with current stats
 /// 0A20 <result>.B <stage>.W <price index>.W <bonus item>.W <gold>.L <silver>.L <bronze>.L (ZC_ACK_GENERATE_ROULETTE)
 /// 0A20 <result>.B <stage>.W <price index>.W <bonus item>.W <gold>.L <silver>.L <bronze>.L (ZC_ACK_GENERATE_ROULETTE)
-void clif_roulette_generate( struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, short bonusItemID ){
+void clif_roulette_generate( struct map_session_data *sd, unsigned char result, short stage, short prizeIdx, t_itemid bonusItemID ){
 	nullpo_retv( sd );
 	nullpo_retv( sd );
 
 
 	struct packet_roulette_generate_ack p;
 	struct packet_roulette_generate_ack p;
@@ -20408,7 +20396,7 @@ void clif_parse_merge_item_cancel(int fd, struct map_session_data* sd) {
  * type: ITEMOBTAIN_TYPE_BOXITEM & ITEMOBTAIN_TYPE_MONSTER_ITEM "[playername] ... [sourcename] ... [itemname]" -> MsgStringTable[1629]
  * type: ITEMOBTAIN_TYPE_BOXITEM & ITEMOBTAIN_TYPE_MONSTER_ITEM "[playername] ... [sourcename] ... [itemname]" -> MsgStringTable[1629]
  * type: ITEMOBTAIN_TYPE_NPC "[playername] ... [itemname]" -> MsgStringTable[1870]
  * type: ITEMOBTAIN_TYPE_NPC "[playername] ... [itemname]" -> MsgStringTable[1870]
  **/
  **/
-void clif_broadcast_obtain_special_item( const char *char_name, unsigned short nameid, unsigned short container, enum BROADCASTING_SPECIAL_ITEM_OBTAIN type ){
+void clif_broadcast_obtain_special_item( const char *char_name, t_itemid nameid, unsigned short container, enum BROADCASTING_SPECIAL_ITEM_OBTAIN type ){
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 
 
 	if( battle_config.broadcast_hide_name ){
 	if( battle_config.broadcast_hide_name ){
@@ -20504,7 +20492,7 @@ void clif_parse_Oneclick_Itemidentify(int fd, struct map_session_data *sd) {
 	// - Invalid item ID or item doesn't exist
 	// - Invalid item ID or item doesn't exist
 	// - Item is already identified
 	// - Item is already identified
 	if (idx < 0 || idx >= MAX_INVENTORY ||
 	if (idx < 0 || idx >= MAX_INVENTORY ||
-		sd->inventory.u.items_inventory[idx].nameid <= 0 || sd->inventory_data[idx] == NULL ||
+		sd->inventory.u.items_inventory[idx].nameid == 0 || sd->inventory_data[idx] == NULL ||
 		sd->inventory.u.items_inventory[idx].identify)
 		sd->inventory.u.items_inventory[idx].identify)
 			return;
 			return;
 
 
@@ -20625,7 +20613,7 @@ void clif_sale_start( struct sale_item_data* sale_item, struct block_list* bl, e
 #endif
 #endif
 }
 }
 
 
-/// Notify the clien that a sale has ended
+/// Notify the client that a sale has ended
 /// 09b3 <item id>.W (ZC_NOTIFY_BARGAIN_SALE_CLOSE)
 /// 09b3 <item id>.W (ZC_NOTIFY_BARGAIN_SALE_CLOSE)
 void clif_sale_end( struct sale_item_data* sale_item, struct block_list* bl, enum send_target target ){
 void clif_sale_end( struct sale_item_data* sale_item, struct block_list* bl, enum send_target target ){
 #if PACKETVER_SUPPORTS_SALES
 #if PACKETVER_SUPPORTS_SALES
@@ -21175,7 +21163,7 @@ void clif_parse_private_airship_request( int fd, struct map_session_data* sd ){
 		return;
 		return;
 	}
 	}
 
 
-	uint16 item_id = p->ItemID;
+	t_itemid item_id = p->ItemID;
 
 
 	// Check if the item sent by the client is known to us
 	// Check if the item sent by the client is known to us
 	if( !itemdb_group_item_exists(IG_PRIVATE_AIRSHIP, item_id) ){
 	if( !itemdb_group_item_exists(IG_PRIVATE_AIRSHIP, item_id) ){

+ 11 - 13
src/map/clif.hpp

@@ -700,7 +700,7 @@ void clif_deleteskill(struct map_session_data *sd, int skill_id);
 
 
 void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, uint16 skill_lv, int property, int casttime);
 void clif_skillcasting(struct block_list* bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, uint16 skill_lv, int property, int casttime);
 void clif_skillcastcancel(struct block_list* bl);
 void clif_skillcastcancel(struct block_list* bl);
-void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype, int itemId = 0);
+void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype, t_itemid itemId = 0);
 void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, t_tick tick);
 void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, t_tick tick);
 int clif_skill_damage(struct block_list *src,struct block_list *dst,t_tick tick,int sdelay,int ddelay,int64 sdamage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type);
 int clif_skill_damage(struct block_list *src,struct block_list *dst,t_tick tick,int sdelay,int ddelay,int64 sdamage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type);
 //int clif_skill_damage2(struct block_list *src,struct block_list *dst,t_tick tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type);
 //int clif_skill_damage2(struct block_list *src,struct block_list *dst,t_tick tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,enum e_damage_type type);
@@ -713,7 +713,7 @@ void clif_skill_teleportmessage(struct map_session_data *sd, int type);
 void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id, int trigger);
 void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id, int trigger);
 void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type);
 void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type);
 
 
-void clif_produceeffect(struct map_session_data* sd,int flag, unsigned short nameid);
+void clif_produceeffect(struct map_session_data* sd,int flag, t_itemid nameid);
 
 
 void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *unit, enum send_target target, bool visible);
 void clif_getareachar_skillunit(struct block_list *bl, struct skill_unit *unit, enum send_target target, bool visible);
 void clif_skill_delunit(struct skill_unit *unit);
 void clif_skill_delunit(struct skill_unit *unit);
@@ -764,7 +764,7 @@ void clif_hat_effect_single( struct map_session_data* sd, uint16 effectId, bool
 void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv);
 void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv);
 
 
 void clif_mvp_effect(struct map_session_data *sd);
 void clif_mvp_effect(struct map_session_data *sd);
-void clif_mvp_item(struct map_session_data *sd, unsigned short nameid);
+void clif_mvp_item(struct map_session_data *sd, t_itemid nameid);
 void clif_mvp_exp(struct map_session_data *sd, unsigned int exp);
 void clif_mvp_exp(struct map_session_data *sd, unsigned int exp);
 void clif_mvp_noitem(struct map_session_data* sd);
 void clif_mvp_noitem(struct map_session_data* sd);
 void clif_changed_dir(struct block_list *bl, enum send_target target);
 void clif_changed_dir(struct block_list *bl, enum send_target target);
@@ -863,7 +863,7 @@ void clif_map_property(struct block_list *bl, enum map_property property, enum s
 void clif_pvpset(struct map_session_data *sd, int pvprank, int pvpnum,int type);
 void clif_pvpset(struct map_session_data *sd, int pvprank, int pvpnum,int type);
 void clif_map_property_mapall(int map, enum map_property property);
 void clif_map_property_mapall(int map, enum map_property property);
 void clif_refine(int fd, int fail, int index, int val);
 void clif_refine(int fd, int fail, int index, int val);
-void clif_upgrademessage( struct map_session_data* sd, int result, unsigned short item_id );
+void clif_upgrademessage( struct map_session_data* sd, int result, t_itemid item_id );
 
 
 //petsystem
 //petsystem
 void clif_catch_process(struct map_session_data *sd);
 void clif_catch_process(struct map_session_data *sd);
@@ -897,7 +897,7 @@ void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd,
 void clif_disp_overhead_(struct block_list *bl, const char* mes, enum send_target flag);
 void clif_disp_overhead_(struct block_list *bl, const char* mes, enum send_target flag);
 #define clif_disp_overhead(bl, mes) clif_disp_overhead_(bl, mes, AREA)
 #define clif_disp_overhead(bl, mes) clif_disp_overhead_(bl, mes, AREA)
 
 
-void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand);
+void clif_get_weapon_view(struct map_session_data* sd, t_itemid *rhand, t_itemid *lhand);
 
 
 void clif_party_xy_remove(struct map_session_data *sd); //Fix for minimap [Kevin]
 void clif_party_xy_remove(struct map_session_data *sd); //Fix for minimap [Kevin]
 void clif_gospel_info(struct map_session_data *sd, int type);
 void clif_gospel_info(struct map_session_data *sd, int type);
@@ -979,8 +979,8 @@ void clif_mercenary_message(struct map_session_data* sd, int message);
 void clif_mercenary_updatestatus(struct map_session_data *sd, int type);
 void clif_mercenary_updatestatus(struct map_session_data *sd, int type);
 
 
 // RENTAL SYSTEM
 // RENTAL SYSTEM
-void clif_rental_time( struct map_session_data* sd, unsigned short nameid, int seconds );
-void clif_rental_expired( struct map_session_data* sd, int index, unsigned short nameid );
+void clif_rental_time( struct map_session_data* sd, t_itemid nameid, int seconds );
+void clif_rental_expired( struct map_session_data* sd, int index, t_itemid nameid );
 
 
 // BOOK READING
 // BOOK READING
 void clif_readbook(int fd, int book_id, int page);
 void clif_readbook(int fd, int book_id, int page);
@@ -1022,9 +1022,9 @@ void clif_buyingstore_disappear_entry(struct map_session_data* sd);
 void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd);
 void clif_buyingstore_disappear_entry_single(struct map_session_data* sd, struct map_session_data* pl_sd);
 void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd);
 void clif_buyingstore_itemlist(struct map_session_data* sd, struct map_session_data* pl_sd);
 void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result);
 void clif_buyingstore_trade_failed_buyer(struct map_session_data* sd, short result);
-void clif_buyingstore_update_item(struct map_session_data* sd, unsigned short nameid, unsigned short amount, uint32 char_id, int zeny);
+void clif_buyingstore_update_item(struct map_session_data* sd, t_itemid nameid, unsigned short amount, uint32 char_id, int zeny);
 void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price);
 void clif_buyingstore_delete_item(struct map_session_data* sd, short index, unsigned short amount, int price);
-void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, unsigned short nameid);
+void clif_buyingstore_trade_failed_seller(struct map_session_data* sd, short result, t_itemid nameid);
 
 
 /// Search Store System
 /// Search Store System
 void clif_search_store_info_ack(struct map_session_data* sd);
 void clif_search_store_info_ack(struct map_session_data* sd);
@@ -1033,7 +1033,7 @@ void clif_open_search_store_info(struct map_session_data* sd);
 void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y);
 void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y);
 
 
 /// Cash Shop
 /// Cash Shop
-void clif_cashshop_result( struct map_session_data* sd, unsigned short item_id, uint16 result );
+void clif_cashshop_result( struct map_session_data* sd, t_itemid item_id, uint16 result );
 void clif_cashshop_open( struct map_session_data* sd, int tab );
 void clif_cashshop_open( struct map_session_data* sd, int tab );
 
 
 void clif_display_pinfo(struct map_session_data *sd, int type);
 void clif_display_pinfo(struct map_session_data *sd, int type);
@@ -1050,8 +1050,6 @@ void clif_elementalconverter_list(struct map_session_data *sd);
 
 
 void clif_millenniumshield(struct block_list *bl, short shields);
 void clif_millenniumshield(struct block_list *bl, short shields);
 
 
-void clif_spellbook_list(struct map_session_data *sd);
-
 void clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y);
 void clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y);
 
 
 void clif_poison_list(struct map_session_data *sd, uint16 skill_lv);
 void clif_poison_list(struct map_session_data *sd, uint16 skill_lv);
@@ -1110,7 +1108,7 @@ void clif_notify_bindOnEquip(struct map_session_data *sd, int n);
 
 
 void clif_merge_item_open(struct map_session_data *sd);
 void clif_merge_item_open(struct map_session_data *sd);
 
 
-void clif_broadcast_obtain_special_item(const char *char_name, unsigned short nameid, unsigned short container, enum BROADCASTING_SPECIAL_ITEM_OBTAIN type);
+void clif_broadcast_obtain_special_item(const char *char_name, t_itemid nameid, unsigned short container, enum BROADCASTING_SPECIAL_ITEM_OBTAIN type);
 
 
 void clif_dressing_room(struct map_session_data *sd, int flag);
 void clif_dressing_room(struct map_session_data *sd, int flag);
 void clif_navigateTo(struct map_session_data *sd, const char* mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id );
 void clif_navigateTo(struct map_session_data *sd, const char* mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id );

+ 19 - 24
src/map/clif_packetdb.hpp

@@ -67,7 +67,7 @@
 	packet(0x009a,-1);
 	packet(0x009a,-1);
 	parseable_packet(0x009b,5,clif_parse_ChangeDir,2,4);
 	parseable_packet(0x009b,5,clif_parse_ChangeDir,2,4);
 	packet(0x009c,9);
 	packet(0x009c,9);
-	packet(0x009d,17);
+	packet( HEADER_ZC_ITEM_ENTRY, sizeof( struct PACKET_ZC_ITEM_ENTRY ) );
 	packet(0x009e,17);
 	packet(0x009e,17);
 	parseable_packet(0x009f,6,clif_parse_TakeItem,2);
 	parseable_packet(0x009f,6,clif_parse_TakeItem,2);
 	packet(0x00a0,23);
 	packet(0x00a0,23);
@@ -78,7 +78,7 @@
 	packet(0x00a5,-1);
 	packet(0x00a5,-1);
 	packet(0x00a6,-1);
 	packet(0x00a6,-1);
 	parseable_packet(0x00a7,8,clif_parse_UseItem,2,4);
 	parseable_packet(0x00a7,8,clif_parse_UseItem,2,4);
-	packet(0x00a8,7);
+	packet( useItemAckType, sizeof( struct PACKET_ZC_USE_ITEM_ACK ) );
 	parseable_packet(0x00a9,6,clif_parse_EquipItem,2,4);
 	parseable_packet(0x00a9,6,clif_parse_EquipItem,2,4);
 	ack_packet(ZC_WEAR_EQUIP_ACK,0x00aa,7,2,4,6);
 	ack_packet(ZC_WEAR_EQUIP_ACK,0x00aa,7,2,4,6);
 	parseable_packet(0x00ab,4,clif_parse_UnequipItem,2);
 	parseable_packet(0x00ab,4,clif_parse_UnequipItem,2);
@@ -154,7 +154,7 @@
 	packet(0x00f1,2);
 	packet(0x00f1,2);
 	packet(0x00f2,6);
 	packet(0x00f2,6);
 	parseable_packet(0x00f3,8,clif_parse_MoveToKafra,2,4);
 	parseable_packet(0x00f3,8,clif_parse_MoveToKafra,2,4);
-	packet(0x00f4,21);
+	packet( storageaddType, sizeof( struct PACKET_ZC_ADD_ITEM_TO_STORE ) );
 	parseable_packet(0x00f5,8,clif_parse_MoveFromKafra,2,4);
 	parseable_packet(0x00f5,8,clif_parse_MoveFromKafra,2,4);
 	packet(0x00f6,8);
 	packet(0x00f6,8);
 	parseable_packet(0x00f7,2,clif_parse_CloseKafra,0);
 	parseable_packet(0x00f7,2,clif_parse_CloseKafra,0);
@@ -176,13 +176,13 @@
 	packet(0x0107,10);
 	packet(0x0107,10);
 	parseable_packet(0x0108,-1,clif_parse_PartyMessage,2,4);
 	parseable_packet(0x0108,-1,clif_parse_PartyMessage,2,4);
 	packet(0x0109,-1);
 	packet(0x0109,-1);
-	packet(0x010a,4);
+	packet( HEADER_ZC_MVP_GETTING_ITEM, sizeof( struct PACKET_ZC_MVP_GETTING_ITEM ) );
 	packet(0x010b,6);
 	packet(0x010b,6);
 	packet(0x010c,6);
 	packet(0x010c,6);
 	packet(0x010d,2);
 	packet(0x010d,2);
 	packet(0x010e,11);
 	packet(0x010e,11);
 	packet(0x010f,-1);
 	packet(0x010f,-1);
-	packet(0x0110,10);
+	packet( HEADER_ZC_ACK_TOUSESKILL, sizeof( PACKET_ZC_ACK_TOUSESKILL ) );
 	packet(0x0111,39);
 	packet(0x0111,39);
 	parseable_packet(0x0112,4,clif_parse_SkillUp,2);
 	parseable_packet(0x0112,4,clif_parse_SkillUp,2);
 	parseable_packet(0x0113,10,clif_parse_UseSkillToId,2,4,6);
 	parseable_packet(0x0113,10,clif_parse_UseSkillToId,2,4,6);
@@ -202,7 +202,7 @@
 	packet(0x0121,14);
 	packet(0x0121,14);
 	packet(0x0122,-1);
 	packet(0x0122,-1);
 	packet(0x0123,-1);
 	packet(0x0123,-1);
-	packet(0x0124,21);
+	packet( cartaddType, sizeof( struct PACKET_ZC_ADD_ITEM_TO_CART ) );
 	packet(0x0125,8);
 	packet(0x0125,8);
 	parseable_packet(0x0126,8,clif_parse_PutItemToCart,2,4);
 	parseable_packet(0x0126,8,clif_parse_PutItemToCart,2,4);
 	parseable_packet(0x0127,8,clif_parse_GetItemFromCart,2,4);
 	parseable_packet(0x0127,8,clif_parse_GetItemFromCart,2,4);
@@ -309,7 +309,7 @@
 	packet(0x018c,29);
 	packet(0x018c,29);
 	packet(0x018d,-1);
 	packet(0x018d,-1);
 	parseable_packet( HEADER_CZ_REQMAKINGITEM, sizeof( struct PACKET_CZ_REQMAKINGITEM ), clif_parse_ProduceMix, 0 );
 	parseable_packet( HEADER_CZ_REQMAKINGITEM, sizeof( struct PACKET_CZ_REQMAKINGITEM ), clif_parse_ProduceMix, 0 );
-	packet(0x018f,6);
+	packet( HEADER_ZC_ACK_REQMAKINGITEM, sizeof( PACKET_ZC_ACK_REQMAKINGITEM ) );
 	parseable_packet(0x0190,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10);
 	parseable_packet(0x0190,90,clif_parse_UseSkillToPosMoreInfo,2,4,6,8,10);
 	packet( HEADER_ZC_TALKBOX_CHATCONTENTS, sizeof( struct PACKET_ZC_TALKBOX_CHATCONTENTS ) );
 	packet( HEADER_ZC_TALKBOX_CHATCONTENTS, sizeof( struct PACKET_ZC_TALKBOX_CHATCONTENTS ) );
 	packet(0x0192,24);
 	packet(0x0192,24);
@@ -362,11 +362,8 @@
 	packet(0x01c1,14);
 	packet(0x01c1,14);
 	packet(0x01c2,10);
 	packet(0x01c2,10);
 	packet(0x01c3,-1);
 	packet(0x01c3,-1);
-	packet(0x01c4,22);
-	packet(0x01c5,22);
 	packet(0x01c6,4);
 	packet(0x01c6,4);
 	packet(0x01c7,2);
 	packet(0x01c7,2);
-	packet(0x01c8,13);
 	packet(0x01c9,97);
 	packet(0x01c9,97);
 	//packet(0x01ca,-1);
 	//packet(0x01ca,-1);
 	packet(0x01cb,9);
 	packet(0x01cb,9);
@@ -636,7 +633,7 @@
 	parseable_packet(0x0193,21,clif_parse_MoveFromKafra,4,17);
 	parseable_packet(0x0193,21,clif_parse_MoveFromKafra,4,17);
 	packet(0x0221,-1);
 	packet(0x0221,-1);
 	parseable_packet(0x0222,6,clif_parse_WeaponRefine,2);
 	parseable_packet(0x0222,6,clif_parse_WeaponRefine,2);
-	packet(0x0223,8);
+	packet( HEADER_ZC_ACK_WEAPONREFINE, sizeof( struct PACKET_ZC_ACK_WEAPONREFINE ) );
 #endif
 #endif
 
 
 // 2004-12-13aSakexe
 // 2004-12-13aSakexe
@@ -1001,8 +998,8 @@
 	packet(0x0295,-1);
 	packet(0x0295,-1);
 	packet(0x0296,-1);
 	packet(0x0296,-1);
 	packet(0x0297,-1);
 	packet(0x0297,-1);
-	packet(0x0298,8);
-	packet(0x0299,6);
+	packet( HEADER_ZC_CASH_TIME_COUNTER, sizeof( struct PACKET_ZC_CASH_TIME_COUNTER ) );
+	packet( HEADER_ZC_CASH_ITEM_DELETE, sizeof( struct PACKET_ZC_CASH_ITEM_DELETE ) );
 	packet(0x029a,27);
 	packet(0x029a,27);
 	packet(0x029c,66);
 	packet(0x029c,66);
 	packet(0x029d,-1);
 	packet(0x029d,-1);
@@ -1089,7 +1086,7 @@
 	packet(0x02b5,-1);
 	packet(0x02b5,-1);
 	parseable_packet(0x02b6,7,clif_parse_questStateAck,2,6);
 	parseable_packet(0x02b6,7,clif_parse_questStateAck,2,6);
 	packet(0x02b7,7);
 	packet(0x02b7,7);
-	packet(0x02b8,22);
+	packet( HEADER_ZC_ITEM_PICKUP_PARTY, sizeof( struct PACKET_ZC_ITEM_PICKUP_PARTY ) );
 	packet(0x02b9,191);
 	packet(0x02b9,191);
 	parseable_packet(0x02ba,11,clif_parse_Hotkey,2,4,5,9);
 	parseable_packet(0x02ba,11,clif_parse_Hotkey,2,4,5,9);
 	packet(0x02bb,8);
 	packet(0x02bb,8);
@@ -1739,7 +1736,7 @@
 	packet(0x081a,4);
 	packet(0x081a,4);
 	packet(0x081b,10);
 	packet(0x081b,10);
 	packet(0x081c,10);
 	packet(0x081c,10);
-	packet(0x0824,6);
+	packet( HEADER_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER, sizeof( struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER ) );
 #endif
 #endif
 
 
 // 2010-06-01aRagexeRE
 // 2010-06-01aRagexeRE
@@ -1757,7 +1754,7 @@
 	parseable_packet(0x0838,2,clif_parse_SearchStoreInfoNextPage,0);
 	parseable_packet(0x0838,2,clif_parse_SearchStoreInfoNextPage,0);
 	packet(0x083A,4); // Search Stalls Feature
 	packet(0x083A,4); // Search Stalls Feature
 	parseable_packet(0x083B,2,clif_parse_CloseSearchStoreInfo,0);
 	parseable_packet(0x083B,2,clif_parse_CloseSearchStoreInfo,0);
-	parseable_packet(0x083C,12,clif_parse_SearchStoreInfoListItemClick,2,6,10);
+	parseable_packet( HEADER_CZ_SSILIST_ITEM_CLICK, sizeof( struct PACKET_CZ_SSILIST_ITEM_CLICK ), clif_parse_SearchStoreInfoListItemClick, 0 );
 	packet(0x083D,6);
 	packet(0x083D,6);
 #endif
 #endif
 
 
@@ -1867,7 +1864,7 @@
 	parseable_packet(0x089e,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12);
 	parseable_packet(0x089e,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12);
 	parseable_packet(0x08ab,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15);
 	parseable_packet(0x08ab,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15);
 	parseable_packet(0x088b,2,clif_parse_SearchStoreInfoNextPage,0);
 	parseable_packet(0x088b,2,clif_parse_SearchStoreInfoNextPage,0);
-	parseable_packet(0x08a2,12,clif_parse_SearchStoreInfoListItemClick,2,6,10);
+	parseable_packet(0x08a2,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,2,6,10);
 	packet(0x08cf,10); //Amulet spirits
 	packet(0x08cf,10); //Amulet spirits
 #endif
 #endif
 
 
@@ -1899,7 +1896,7 @@
 	parseable_packet(0x0811,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12);
 	parseable_packet(0x0811,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12);
 	parseable_packet(0x0884,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15);
 	parseable_packet(0x0884,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15);
 	parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0);
 	parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0);
-	parseable_packet(0x0838,12,clif_parse_SearchStoreInfoListItemClick,2,6,10);
+	parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,2,6,10);
 	parseable_packet(0x0439,8,clif_parse_UseItem,2,4);
 	parseable_packet(0x0439,8,clif_parse_UseItem,2,4);
 	parseable_packet(0x0365,41,clif_parse_PartyBookingRegisterReq,2,4,6);
 	parseable_packet(0x0365,41,clif_parse_PartyBookingRegisterReq,2,4,6);
 	// New Packet
 	// New Packet
@@ -1926,7 +1923,7 @@
 	parseable_packet(0x0811,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12);
 	parseable_packet(0x0811,-1,clif_parse_ReqTradeBuyingStore,2,4,8,12);
 	parseable_packet(0x0819,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15);
 	parseable_packet(0x0819,-1,clif_parse_SearchStoreInfo,2,4,5,9,13,14,15);
 	parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0);
 	parseable_packet(0x0835,2,clif_parse_SearchStoreInfoNextPage,0);
-	parseable_packet(0x0838,12,clif_parse_SearchStoreInfoListItemClick,2,6,10);
+	parseable_packet(0x0838,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,2,6,10);
 	parseable_packet(0x0437,5,clif_parse_WalkToXY,2);
 	parseable_packet(0x0437,5,clif_parse_WalkToXY,2);
 	parseable_packet(0x0886,6,clif_parse_TickSend,2);
 	parseable_packet(0x0886,6,clif_parse_TickSend,2);
 	parseable_packet(0x0871,5,clif_parse_ChangeDir,2,4);
 	parseable_packet(0x0871,5,clif_parse_ChangeDir,2,4);
@@ -2046,7 +2043,7 @@
 	//parseable_packet(0x0281,-1,clif_parse_ItemListWindowSelected,2,4,8,12);
 	//parseable_packet(0x0281,-1,clif_parse_ItemListWindowSelected,2,4,8,12);
 	parseable_packet(0x035f,6,clif_parse_ReqClickBuyingStore,2);
 	parseable_packet(0x035f,6,clif_parse_ReqClickBuyingStore,2);
 	parseable_packet(0x0363,6,clif_parse_TickSend,2);
 	parseable_packet(0x0363,6,clif_parse_TickSend,2);
-	parseable_packet(0x0365,12,clif_parse_SearchStoreInfoListItemClick,2,6,10);
+	parseable_packet(0x0365,sizeof(struct PACKET_CZ_SSILIST_ITEM_CLICK),clif_parse_SearchStoreInfoListItemClick,2,6,10);
 	parseable_packet(0x0438,6,clif_parse_DropItem,2,4);
 	parseable_packet(0x0438,6,clif_parse_DropItem,2,4);
 	parseable_packet(0x0447,2,clif_parse_blocking_playcancel,0); // CZ_BLOCKING_PLAY_CANCEL
 	parseable_packet(0x0447,2,clif_parse_blocking_playcancel,0); // CZ_BLOCKING_PLAY_CANCEL
 	parseable_packet(0x044A,6,clif_parse_client_version,2);
 	parseable_packet(0x044A,6,clif_parse_client_version,2);
@@ -2163,7 +2160,7 @@
 	parseable_packet(0x09D4,2,clif_parse_NPCShopClosed,0);
 	parseable_packet(0x09D4,2,clif_parse_NPCShopClosed,0);
 	//NPC Market
 	//NPC Market
 	packet(0x09D5,-1);
 	packet(0x09D5,-1);
-	parseable_packet(0x09D6,-1,clif_parse_NPCMarketPurchase,2,4,6);
+	parseable_packet( HEADER_CZ_NPC_MARKET_PURCHASE, -1, clif_parse_NPCMarketPurchase, 0 );
 	packet(0x09D7,-1);
 	packet(0x09D7,-1);
 	parseable_packet(0x09D8,2,clif_parse_NPCMarketClosed,0);
 	parseable_packet(0x09D8,2,clif_parse_NPCMarketClosed,0);
 	// Clan System
 	// Clan System
@@ -2223,7 +2220,7 @@
 	parseable_packet(0x0A1D,2,clif_parse_roulette_close,0); // CZ_REQ_CLOSE_ROULETTE
 	parseable_packet(0x0A1D,2,clif_parse_roulette_close,0); // CZ_REQ_CLOSE_ROULETTE
 	packet(0x0A1E,3); // ZC_ACK_CLOSE_ROULETTE
 	packet(0x0A1E,3); // ZC_ACK_CLOSE_ROULETTE
 	parseable_packet(0x0A1F,2,clif_parse_roulette_generate,0); // CZ_REQ_GENERATE_ROULETTE
 	parseable_packet(0x0A1F,2,clif_parse_roulette_generate,0); // CZ_REQ_GENERATE_ROULETTE
-	packet(0x0A20,21); // ZC_ACK_GENERATE_ROULETTE
+	packet( roulettgenerateackType, sizeof( struct packet_roulette_generate_ack ) ); // ZC_ACK_GENERATE_ROULETTE
 	parseable_packet(0x0A21,3,clif_parse_roulette_item,2); // CZ_RECV_ROULETTE_ITEM
 	parseable_packet(0x0A21,3,clif_parse_roulette_item,2); // CZ_RECV_ROULETTE_ITEM
 	packet(0x0A22,5); // ZC_RECV_ROULETTE_ITEM
 	packet(0x0A22,5); // ZC_RECV_ROULETTE_ITEM
 #endif
 #endif
@@ -2244,8 +2241,6 @@
 // 2015-02-25aRagexeRE
 // 2015-02-25aRagexeRE
 #if PACKETVER >= 20150225
 #if PACKETVER >= 20150225
 	packet(0x0A09,45); // ZC_ADD_EXCHANGE_ITEM3
 	packet(0x0A09,45); // ZC_ADD_EXCHANGE_ITEM3
-	packet(0x0A0A,47); // ZC_ADD_ITEM_TO_STORE3
-	packet(0x0A0B,47); // ZC_ADD_ITEM_TO_CART3
 	packet(0x0A0C,56); // ZC_ITEM_PICKUP_ACK_V6
 	packet(0x0A0C,56); // ZC_ITEM_PICKUP_ACK_V6
 	packet(0x0A0D,-1); // ZC_INVENTORY_ITEMLIST_EQUIP_V6
 	packet(0x0A0D,-1); // ZC_INVENTORY_ITEMLIST_EQUIP_V6
 	packet(0x0A0F,-1); // ZC_CART_ITEMLIST_EQUIP_V6
 	packet(0x0A0F,-1); // ZC_CART_ITEMLIST_EQUIP_V6

+ 38 - 38
src/map/intif.cpp

@@ -95,24 +95,24 @@ struct map_session_data *inter_search_sd(uint32 account_id, uint32 char_id)
  * @param pet_name
  * @param pet_name
  * @return 
  * @return 
  */
  */
-int intif_create_pet(uint32 account_id,uint32 char_id,short pet_class,short pet_lv, unsigned short pet_egg_id, unsigned short pet_equip,short intimate,short hungry,char rename_flag,char incubate,char *pet_name)
+int intif_create_pet(uint32 account_id,uint32 char_id,short pet_class,short pet_lv, t_itemid pet_egg_id, t_itemid pet_equip,short intimate,short hungry,char rename_flag,char incubate,char *pet_name)
 {
 {
 	if (CheckForCharServer())
 	if (CheckForCharServer())
 		return 0;
 		return 0;
-	WFIFOHEAD(inter_fd, 24 + NAME_LENGTH);
-	WFIFOW(inter_fd,0) = 0x3080;
-	WFIFOL(inter_fd,2) = account_id;
-	WFIFOL(inter_fd,6) = char_id;
-	WFIFOW(inter_fd,10) = pet_class;
-	WFIFOW(inter_fd,12) = pet_lv;
-	WFIFOW(inter_fd,14) = pet_egg_id;
-	WFIFOW(inter_fd,16) = pet_equip;
-	WFIFOW(inter_fd,18) = intimate;
-	WFIFOW(inter_fd,20) = hungry;
-	WFIFOB(inter_fd,22) = rename_flag;
-	WFIFOB(inter_fd,23) = incubate;
-	memcpy(WFIFOP(inter_fd,24),pet_name,NAME_LENGTH);
-	WFIFOSET(inter_fd,24+NAME_LENGTH);
+	WFIFOHEAD(inter_fd, 28 + NAME_LENGTH);
+	WFIFOW(inter_fd, 0) = 0x3080;
+	WFIFOL(inter_fd, 2) = account_id;
+	WFIFOL(inter_fd, 6) = char_id;
+	WFIFOW(inter_fd, 10) = pet_class;
+	WFIFOW(inter_fd, 12) = pet_lv;
+	WFIFOL(inter_fd, 14) = pet_egg_id;
+	WFIFOL(inter_fd, 18) = pet_equip;
+	WFIFOW(inter_fd, 22) = intimate;
+	WFIFOW(inter_fd, 24) = hungry;
+	WFIFOB(inter_fd, 26) = rename_flag;
+	WFIFOB(inter_fd, 27) = incubate;
+	memcpy(WFIFOP(inter_fd, 28), pet_name, NAME_LENGTH);
+	WFIFOSET(inter_fd, 28 + NAME_LENGTH);
 
 
 	return 1;
 	return 1;
 }
 }
@@ -2285,8 +2285,8 @@ int intif_achievement_reward(struct map_session_data *sd, struct s_achievement_d
 	WFIFOW(inter_fd, 0) = 0x3064;
 	WFIFOW(inter_fd, 0) = 0x3064;
 	WFIFOL(inter_fd, 2) = sd->status.char_id;
 	WFIFOL(inter_fd, 2) = sd->status.char_id;
 	WFIFOL(inter_fd, 6) = adb->achievement_id;
 	WFIFOL(inter_fd, 6) = adb->achievement_id;
-	WFIFOW(inter_fd, 10) = adb->rewards.nameid;
-	WFIFOL(inter_fd, 12) = adb->rewards.amount;
+	WFIFOL(inter_fd, 10) = adb->rewards.nameid;
+	WFIFOW(inter_fd, 14) = adb->rewards.amount;
 	safestrncpy(WFIFOCP(inter_fd, 16), sd->status.name, NAME_LENGTH);
 	safestrncpy(WFIFOCP(inter_fd, 16), sd->status.name, NAME_LENGTH);
 	safestrncpy(WFIFOCP(inter_fd, 16+NAME_LENGTH), adb->name.c_str(), ACHIEVEMENT_NAME_LENGTH);
 	safestrncpy(WFIFOCP(inter_fd, 16+NAME_LENGTH), adb->name.c_str(), ACHIEVEMENT_NAME_LENGTH);
 	WFIFOSET(inter_fd, 16+NAME_LENGTH+ACHIEVEMENT_NAME_LENGTH);
 	WFIFOSET(inter_fd, 16+NAME_LENGTH+ACHIEVEMENT_NAME_LENGTH);
@@ -3250,14 +3250,14 @@ void intif_parse_MessageToFD(int fd) {
 
 
 /**
 /**
  * Request to send broadcast item to all servers
  * Request to send broadcast item to all servers
- * ZI 3009 <cmd>.W <len>.W <nameid>.W <source>.W <type>.B <name>.?B
+ * ZI 3009 <cmd>.W <len>.W <nameid>.N <source>.W <type>.B <name>.?B
  * @param sd Player who obtain the item
  * @param sd Player who obtain the item
  * @param nameid Obtained item
  * @param nameid Obtained item
  * @param sourceid Source of item, another item ID or monster ID
  * @param sourceid Source of item, another item ID or monster ID
  * @param type Obtain type @see enum BROADCASTING_SPECIAL_ITEM_OBTAIN
  * @param type Obtain type @see enum BROADCASTING_SPECIAL_ITEM_OBTAIN
  * @return
  * @return
  **/
  **/
-int intif_broadcast_obtain_special_item(struct map_session_data *sd, unsigned short nameid, unsigned int sourceid, unsigned char type) {
+int intif_broadcast_obtain_special_item(struct map_session_data *sd, t_itemid nameid, t_itemid sourceid, unsigned char type) {
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
 
 
 	// Should not be here!
 	// Should not be here!
@@ -3275,13 +3275,13 @@ int intif_broadcast_obtain_special_item(struct map_session_data *sd, unsigned sh
 	if (other_mapserver_count < 1)
 	if (other_mapserver_count < 1)
 		return 0;
 		return 0;
 
 
-	WFIFOHEAD(inter_fd, 9 + NAME_LENGTH);
+	WFIFOHEAD(inter_fd, 11 + NAME_LENGTH);
 	WFIFOW(inter_fd, 0) = 0x3009;
 	WFIFOW(inter_fd, 0) = 0x3009;
-	WFIFOW(inter_fd, 2) = 9 + NAME_LENGTH;
-	WFIFOW(inter_fd, 4) = nameid;
-	WFIFOW(inter_fd, 6) = sourceid;
-	WFIFOB(inter_fd, 8) = type;
-	safestrncpy(WFIFOCP(inter_fd, 9), sd->status.name, NAME_LENGTH);
+	WFIFOW(inter_fd, 2) = 11 + NAME_LENGTH;
+	WFIFOL(inter_fd, 4) = nameid;
+	WFIFOW(inter_fd, 8) = sourceid;
+	WFIFOB(inter_fd, 10) = type;
+	safestrncpy(WFIFOCP(inter_fd, 11), sd->status.name, NAME_LENGTH);
 	WFIFOSET(inter_fd, WFIFOW(inter_fd, 2));
 	WFIFOSET(inter_fd, WFIFOW(inter_fd, 2));
 
 
 	return 1;
 	return 1;
@@ -3290,13 +3290,13 @@ int intif_broadcast_obtain_special_item(struct map_session_data *sd, unsigned sh
 /**
 /**
  * Request to send broadcast item to all servers.
  * Request to send broadcast item to all servers.
  * TODO: Confirm the usage. Maybe on getitem-like command?
  * TODO: Confirm the usage. Maybe on getitem-like command?
- * ZI 3009 <cmd>.W <len>.W <nameid>.W <source>.W <type>.B <name>.24B <npcname>.24B
+ * ZI 3009 <cmd>.W <len>.W <nameid>.N <source>.W <type>.B <name>.24B <npcname>.24B
  * @param sd Player who obtain the item
  * @param sd Player who obtain the item
  * @param nameid Obtained item
  * @param nameid Obtained item
  * @param srcname Source name
  * @param srcname Source name
  * @return
  * @return
  **/
  **/
-int intif_broadcast_obtain_special_item_npc(struct map_session_data *sd, unsigned short nameid) {
+int intif_broadcast_obtain_special_item_npc(struct map_session_data *sd, t_itemid nameid) {
 	nullpo_retr(0, sd);
 	nullpo_retr(0, sd);
 
 
 	// Send local
 	// Send local
@@ -3308,13 +3308,13 @@ int intif_broadcast_obtain_special_item_npc(struct map_session_data *sd, unsigne
 	if (other_mapserver_count < 1)
 	if (other_mapserver_count < 1)
 		return 0;
 		return 0;
 
 
-	WFIFOHEAD(inter_fd, 9 + NAME_LENGTH*2);
+	WFIFOHEAD(inter_fd, 11 + NAME_LENGTH*2);
 	WFIFOW(inter_fd, 0) = 0x3009;
 	WFIFOW(inter_fd, 0) = 0x3009;
-	WFIFOW(inter_fd, 2) = 9 + NAME_LENGTH*2;
-	WFIFOW(inter_fd, 4) = nameid;
-	WFIFOW(inter_fd, 6) = 0;
-	WFIFOB(inter_fd, 8) = ITEMOBTAIN_TYPE_NPC;
-	safestrncpy(WFIFOCP(inter_fd, 9), sd->status.name, NAME_LENGTH);
+	WFIFOW(inter_fd, 2) = 11 + NAME_LENGTH*2;
+	WFIFOL(inter_fd, 4) = nameid;
+	WFIFOW(inter_fd, 8) = 0;
+	WFIFOB(inter_fd, 10) = ITEMOBTAIN_TYPE_NPC;
+	safestrncpy(WFIFOCP(inter_fd, 11), sd->status.name, NAME_LENGTH);
 	WFIFOSET(inter_fd, WFIFOW(inter_fd, 2));
 	WFIFOSET(inter_fd, WFIFOW(inter_fd, 2));
 
 
 	return 1;
 	return 1;
@@ -3322,18 +3322,18 @@ int intif_broadcast_obtain_special_item_npc(struct map_session_data *sd, unsigne
 
 
 /**
 /**
  * Received broadcast item and broadcast on local map.
  * Received broadcast item and broadcast on local map.
- * IZ 3809 <cmd>.W <len>.W <nameid>.W <source>.W <type>.B <name>.24B <srcname>.24B
+ * IZ 3809 <cmd>.W <len>.W <nameid>.L <source>.W <type>.B <name>.24B <srcname>.24B
  * @param fd
  * @param fd
  **/
  **/
 void intif_parse_broadcast_obtain_special_item(int fd) {
 void intif_parse_broadcast_obtain_special_item(int fd) {
-	int type = RFIFOB(fd, 8);
+	int type = RFIFOB(fd, 10);
 	char name[NAME_LENGTH];
 	char name[NAME_LENGTH];
 
 
-	safestrncpy(name, RFIFOCP(fd, 9), NAME_LENGTH);
+	safestrncpy(name, RFIFOCP(fd, 11), NAME_LENGTH);
 	if (type == ITEMOBTAIN_TYPE_NPC)
 	if (type == ITEMOBTAIN_TYPE_NPC)
-		safestrncpy(name, RFIFOCP(fd, 9 + NAME_LENGTH), NAME_LENGTH);
+		safestrncpy(name, RFIFOCP(fd, 11 + NAME_LENGTH), NAME_LENGTH);
 
 
-	clif_broadcast_obtain_special_item(name, RFIFOW(fd, 4), RFIFOW(fd, 6), (enum BROADCASTING_SPECIAL_ITEM_OBTAIN)type);
+	clif_broadcast_obtain_special_item(name, RFIFOL(fd, 4), RFIFOW(fd, 8), (enum BROADCASTING_SPECIAL_ITEM_OBTAIN)type);
 }
 }
 
 
 /*==========================================
 /*==========================================

+ 3 - 3
src/map/intif.hpp

@@ -23,8 +23,8 @@ int intif_parse(int fd);
 
 
 int intif_broadcast(const char* mes, int len, int type);
 int intif_broadcast(const char* mes, int len, int type);
 int intif_broadcast2(const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY);
 int intif_broadcast2(const char* mes, int len, unsigned long fontColor, short fontType, short fontSize, short fontAlign, short fontY);
-int intif_broadcast_obtain_special_item(struct map_session_data *sd, unsigned short nameid, unsigned int sourceid, unsigned char type);
-int intif_broadcast_obtain_special_item_npc(struct map_session_data *sd, unsigned short nameid);
+int intif_broadcast_obtain_special_item(struct map_session_data *sd, t_itemid nameid, unsigned int sourceid, unsigned char type);
+int intif_broadcast_obtain_special_item_npc(struct map_session_data *sd, t_itemid nameid);
 int intif_main_message(struct map_session_data* sd, const char* message);
 int intif_main_message(struct map_session_data* sd, const char* message);
 
 
 int intif_wis_message(struct map_session_data *sd,char *nick,char *mes,int mes_len);
 int intif_wis_message(struct map_session_data *sd,char *nick,char *mes,int mes_len);
@@ -70,7 +70,7 @@ int intif_guild_castle_datasave(int castle_id, int index, int value);
 void intif_itembound_guild_retrieve(uint32 char_id, uint32 account_id, int guild_id);
 void intif_itembound_guild_retrieve(uint32 char_id, uint32 account_id, int guild_id);
 #endif
 #endif
 
 
-int intif_create_pet(uint32 account_id, uint32 char_id, short pet_type, short pet_lv, unsigned short pet_egg_id, unsigned short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name);
+int intif_create_pet(uint32 account_id, uint32 char_id, short pet_type, short pet_lv, t_itemid pet_egg_id, t_itemid pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name);
 int intif_request_petdata(uint32 account_id, uint32 char_id, int pet_id);
 int intif_request_petdata(uint32 account_id, uint32 char_id, int pet_id);
 int intif_save_petdata(uint32 account_id, struct s_pet *p);
 int intif_save_petdata(uint32 account_id, struct s_pet *p);
 int intif_delete_petdata(int pet_id);
 int intif_delete_petdata(int pet_id);

+ 61 - 56
src/map/itemdb.cpp

@@ -55,7 +55,7 @@ struct s_item_group_db *itemdb_group_exists(unsigned short group_id) {
  * @param nameid: Item to check for in group
  * @param nameid: Item to check for in group
  * @return True if item is in group, else false
  * @return True if item is in group, else false
  */
  */
-bool itemdb_group_item_exists(unsigned short group_id, unsigned short nameid)
+bool itemdb_group_item_exists(unsigned short group_id, t_itemid nameid)
 {
 {
 	struct s_item_group_db *group = (struct s_item_group_db *)uidb_get(itemdb_group, group_id);
 	struct s_item_group_db *group = (struct s_item_group_db *)uidb_get(itemdb_group, group_id);
 	unsigned short i, j;
 	unsigned short i, j;
@@ -219,7 +219,7 @@ struct s_item_group_entry *itemdb_get_randgroupitem(uint16 group_id, uint8 sub_g
 * @param sub_group: 0 is 'must' item group, random groups start from 1 to MAX_ITEMGROUP_RANDGROUP+1
 * @param sub_group: 0 is 'must' item group, random groups start from 1 to MAX_ITEMGROUP_RANDGROUP+1
 * @return Item ID or UNKNOWN_ITEM_ID on fail
 * @return Item ID or UNKNOWN_ITEM_ID on fail
 */
 */
-unsigned short itemdb_searchrandomid(uint16 group_id, uint8 sub_group) {
+t_itemid itemdb_searchrandomid(uint16 group_id, uint8 sub_group) {
 	struct s_item_group_entry *entry = itemdb_get_randgroupitem(group_id, sub_group);
 	struct s_item_group_entry *entry = itemdb_get_randgroupitem(group_id, sub_group);
 	return entry ? entry->nameid : UNKNOWN_ITEM_ID;
 	return entry ? entry->nameid : UNKNOWN_ITEM_ID;
 }
 }
@@ -310,7 +310,7 @@ char itemdb_pc_get_itemgroup(uint16 group_id, bool identify, struct map_session_
 * @param nameid
 * @param nameid
 * @return *item_data if item is exist, or NULL if not
 * @return *item_data if item is exist, or NULL if not
 */
 */
-struct item_data* itemdb_exists(unsigned short nameid) {
+struct item_data* itemdb_exists(t_itemid nameid) {
 	return ((struct item_data*)uidb_get(itemdb,nameid));
 	return ((struct item_data*)uidb_get(itemdb,nameid));
 }
 }
 
 
@@ -452,7 +452,7 @@ static void itemdb_create_dummy(void) {
 * Create new item data
 * Create new item data
 * @param nameid
 * @param nameid
 */
 */
-static struct item_data *itemdb_create_item(unsigned short nameid) {
+static struct item_data *itemdb_create_item(t_itemid nameid) {
 	struct item_data *id;
 	struct item_data *id;
 	CREATE(id, struct item_data, 1);
 	CREATE(id, struct item_data, 1);
 	memset(id, 0, sizeof(struct item_data));
 	memset(id, 0, sizeof(struct item_data));
@@ -467,12 +467,12 @@ static struct item_data *itemdb_create_item(unsigned short nameid) {
  * @param nameid
  * @param nameid
  * @return *item_data or *dummy_item if item not found
  * @return *item_data or *dummy_item if item not found
  *------------------------------------------*/
  *------------------------------------------*/
-struct item_data* itemdb_search(unsigned short nameid) {
+struct item_data* itemdb_search(t_itemid nameid) {
 	struct item_data* id = NULL;
 	struct item_data* id = NULL;
 	if (nameid == dummy_item->nameid)
 	if (nameid == dummy_item->nameid)
 		id = dummy_item;
 		id = dummy_item;
 	else if (!(id = (struct item_data*)uidb_get(itemdb, nameid))) {
 	else if (!(id = (struct item_data*)uidb_get(itemdb, nameid))) {
-		ShowWarning("itemdb_search: Item ID %hu does not exists in the item_db. Using dummy data.\n", nameid);
+		ShowWarning("itemdb_search: Item ID %u does not exists in the item_db. Using dummy data.\n", nameid);
 		id = dummy_item;
 		id = dummy_item;
 	}
 	}
 	return id;
 	return id;
@@ -572,7 +572,7 @@ bool itemdb_ishatched_egg(struct item* item) {
 /** Specifies if item-type should drop unidentified.
 /** Specifies if item-type should drop unidentified.
 * @param nameid ID of item
 * @param nameid ID of item
 */
 */
-char itemdb_isidentified(unsigned short nameid) {
+char itemdb_isidentified(t_itemid nameid) {
 	int type=itemdb_type(nameid);
 	int type=itemdb_type(nameid);
 	switch (type) {
 	switch (type) {
 		case IT_WEAPON:
 		case IT_WEAPON:
@@ -589,18 +589,18 @@ char itemdb_isidentified(unsigned short nameid) {
 * Structure: <nameid>,<sprite>
 * Structure: <nameid>,<sprite>
 */
 */
 static bool itemdb_read_itemavail(char* str[], int columns, int current) {
 static bool itemdb_read_itemavail(char* str[], int columns, int current) {
-	unsigned short nameid, sprite;
+	t_itemid nameid, sprite;
 	struct item_data *id;
 	struct item_data *id;
 
 
-	nameid = atoi(str[0]);
+	nameid = strtoul(str[0], nullptr, 10);
 
 
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	{
 	{
-		ShowWarning("itemdb_read_itemavail: Invalid item id %hu.\n", nameid);
+		ShowWarning("itemdb_read_itemavail: Invalid item id %u.\n", nameid);
 		return false;
 		return false;
 	}
 	}
 
 
-	sprite = atoi(str[1]);
+	sprite = strtoul(str[1], nullptr, 10);
 
 
 	if( sprite > 0 )
 	if( sprite > 0 )
 	{
 	{
@@ -692,7 +692,7 @@ static bool itemdb_read_group(char* str[], int columns, int current) {
 	str[1] = trim(str[1]);
 	str[1] = trim(str[1]);
 
 
 	// Check if the item can be found by id
 	// Check if the item can be found by id
-	if( ( entry.nameid = atoi(str[1]) ) <= 0 || !itemdb_exists( entry.nameid ) ){
+	if( ( entry.nameid = strtoul(str[1], nullptr, 10) ) == 0 || !itemdb_exists( entry.nameid ) ){
 		// Otherwise look it up by name
 		// Otherwise look it up by name
 		struct item_data *id = itemdb_searchname(str[1]);
 		struct item_data *id = itemdb_searchname(str[1]);
 
 
@@ -748,16 +748,16 @@ static bool itemdb_read_group(char* str[], int columns, int current) {
 * Structure: <nameid>,<mode>
 * Structure: <nameid>,<mode>
 */
 */
 static bool itemdb_read_noequip(char* str[], int columns, int current) {
 static bool itemdb_read_noequip(char* str[], int columns, int current) {
-	unsigned short nameid;
+	t_itemid nameid;
 	int flag;
 	int flag;
 	struct item_data *id;
 	struct item_data *id;
 
 
-	nameid = atoi(str[0]);
+	nameid = strtoul(str[0], nullptr, 10);
 	flag = atoi(str[1]);
 	flag = atoi(str[1]);
 
 
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	{
 	{
-		ShowWarning("itemdb_read_noequip: Invalid item id %hu.\n", nameid);
+		ShowWarning("itemdb_read_noequip: Invalid item id %u.\n", nameid);
 		return false;
 		return false;
 	}
 	}
 
 
@@ -773,14 +773,15 @@ static bool itemdb_read_noequip(char* str[], int columns, int current) {
 * Structure: <nameid>,<mask>,<gm level>
 * Structure: <nameid>,<mask>,<gm level>
 */
 */
 static bool itemdb_read_itemtrade(char* str[], int columns, int current) {
 static bool itemdb_read_itemtrade(char* str[], int columns, int current) {
-	unsigned short nameid, flag, gmlv;
+	t_itemid nameid;
+	unsigned short flag, gmlv;
 	struct item_data *id;
 	struct item_data *id;
 
 
-	nameid = atoi(str[0]);
+	nameid = strtoul(str[0], nullptr, 10);
 
 
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	{
 	{
-		//ShowWarning("itemdb_read_itemtrade: Invalid item id %d.\n", nameid);
+		//ShowWarning("itemdb_read_itemtrade: Invalid item id %u.\n", nameid);
 		//return false;
 		//return false;
 		// FIXME: item_trade.txt contains items, which are commented in item database.
 		// FIXME: item_trade.txt contains items, which are commented in item database.
 		return true;
 		return true;
@@ -790,12 +791,12 @@ static bool itemdb_read_itemtrade(char* str[], int columns, int current) {
 	gmlv = atoi(str[2]);
 	gmlv = atoi(str[2]);
 
 
 	if( flag > 511 ) {//Check range
 	if( flag > 511 ) {//Check range
-		ShowWarning("itemdb_read_itemtrade: Invalid trading mask %hu for item id %hu.\n", flag, nameid);
+		ShowWarning("itemdb_read_itemtrade: Invalid trading mask %hu for item id %u.\n", flag, nameid);
 		return false;
 		return false;
 	}
 	}
 	if( gmlv < 1 )
 	if( gmlv < 1 )
 	{
 	{
-		ShowWarning("itemdb_read_itemtrade: Invalid override GM level %hu for item id %hu.\n", gmlv, nameid);
+		ShowWarning("itemdb_read_itemtrade: Invalid override GM level %hu for item id %u.\n", gmlv, nameid);
 		return false;
 		return false;
 	}
 	}
 
 
@@ -809,15 +810,15 @@ static bool itemdb_read_itemtrade(char* str[], int columns, int current) {
 * Structure: <nameid>,<delay>{,<delay sc group>}
 * Structure: <nameid>,<delay>{,<delay sc group>}
 */
 */
 static bool itemdb_read_itemdelay(char* str[], int columns, int current) {
 static bool itemdb_read_itemdelay(char* str[], int columns, int current) {
-	unsigned short nameid;
+	t_itemid nameid;
 	int delay;
 	int delay;
 	struct item_data *id;
 	struct item_data *id;
 
 
-	nameid = atoi(str[0]);
+	nameid = strtoul(str[0], nullptr, 10);
 
 
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	{
 	{
-		ShowWarning("itemdb_read_itemdelay: Invalid item id %hu.\n", nameid);
+		ShowWarning("itemdb_read_itemdelay: Invalid item id %u.\n", nameid);
 		return false;
 		return false;
 	}
 	}
 
 
@@ -825,7 +826,7 @@ static bool itemdb_read_itemdelay(char* str[], int columns, int current) {
 
 
 	if( delay < 0 )
 	if( delay < 0 )
 	{
 	{
-		ShowWarning("itemdb_read_itemdelay: Invalid delay %d for item id %hu.\n", delay, nameid);
+		ShowWarning("itemdb_read_itemdelay: Invalid delay %d for item id %u.\n", delay, nameid);
 		return false;
 		return false;
 	}
 	}
 
 
@@ -839,7 +840,7 @@ static bool itemdb_read_itemdelay(char* str[], int columns, int current) {
 		int64 constant;
 		int64 constant;
 
 
 		if( !script_get_constant(trim(str[2]), &constant) ){
 		if( !script_get_constant(trim(str[2]), &constant) ){
-			ShowWarning("itemdb_read_itemdelay: Invalid sc group \"%s\" for item id %hu.\n", str[2], nameid);
+			ShowWarning("itemdb_read_itemdelay: Invalid sc group \"%s\" for item id %u.\n", str[2], nameid);
 			return false;
 			return false;
 		}
 		}
 
 
@@ -853,21 +854,22 @@ static bool itemdb_read_itemdelay(char* str[], int columns, int current) {
 * Structure: <item id>,<stack limit amount>,<type>
 * Structure: <item id>,<stack limit amount>,<type>
 */
 */
 static bool itemdb_read_stack(char* fields[], int columns, int current) {
 static bool itemdb_read_stack(char* fields[], int columns, int current) {
-	unsigned short nameid, amount;
+	t_itemid nameid;
+	unsigned short amount;
 	unsigned int type;
 	unsigned int type;
 	struct item_data* id;
 	struct item_data* id;
 
 
-	nameid = (unsigned short)strtoul(fields[0], NULL, 10);
+	nameid = strtoul(fields[0], nullptr, 10);
 
 
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	{
 	{
-		ShowWarning("itemdb_read_stack: Unknown item id '%hu'.\n", nameid);
+		ShowWarning("itemdb_read_stack: Unknown item id '%u'.\n", nameid);
 		return false;
 		return false;
 	}
 	}
 
 
 	if( !itemdb_isstackable2(id) )
 	if( !itemdb_isstackable2(id) )
 	{
 	{
-		ShowWarning("itemdb_read_stack: Item id '%hu' is not stackable.\n", nameid);
+		ShowWarning("itemdb_read_stack: Item id '%u' is not stackable.\n", nameid);
 		return false;
 		return false;
 	}
 	}
 
 
@@ -892,20 +894,20 @@ static bool itemdb_read_stack(char* fields[], int columns, int current) {
 * <nameid>
 * <nameid>
 */
 */
 static bool itemdb_read_buyingstore(char* fields[], int columns, int current) {
 static bool itemdb_read_buyingstore(char* fields[], int columns, int current) {
-	unsigned short nameid;
+	t_itemid nameid;
 	struct item_data* id;
 	struct item_data* id;
 
 
-	nameid = atoi(fields[0]);
+	nameid = strtoul(fields[0], nullptr, 10);
 
 
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	{
 	{
-		ShowWarning("itemdb_read_buyingstore: Invalid item id %hu.\n", nameid);
+		ShowWarning("itemdb_read_buyingstore: Invalid item id %u.\n", nameid);
 		return false;
 		return false;
 	}
 	}
 
 
 	if( !itemdb_isstackable2(id) )
 	if( !itemdb_isstackable2(id) )
 	{
 	{
-		ShowWarning("itemdb_read_buyingstore: Non-stackable item id %hu cannot be enabled for buying store.\n", nameid);
+		ShowWarning("itemdb_read_buyingstore: Non-stackable item id %u cannot be enabled for buying store.\n", nameid);
 		return false;
 		return false;
 	}
 	}
 
 
@@ -918,13 +920,14 @@ static bool itemdb_read_buyingstore(char* fields[], int columns, int current) {
 * <nameid>,<flag>,<override>
 * <nameid>,<flag>,<override>
 */
 */
 static bool itemdb_read_nouse(char* fields[], int columns, int current) {
 static bool itemdb_read_nouse(char* fields[], int columns, int current) {
-	unsigned short nameid, flag, override;
+	t_itemid nameid;
+	unsigned short flag, override;
 	struct item_data* id;
 	struct item_data* id;
 
 
-	nameid = atoi(fields[0]);
+	nameid = strtoul(fields[0], nullptr, 10);
 
 
 	if( ( id = itemdb_exists(nameid) ) == NULL ) {
 	if( ( id = itemdb_exists(nameid) ) == NULL ) {
-		ShowWarning("itemdb_read_nouse: Invalid item id %hu.\n", nameid);
+		ShowWarning("itemdb_read_nouse: Invalid item id %u.\n", nameid);
 		return false;
 		return false;
 	}
 	}
 
 
@@ -944,13 +947,13 @@ static bool itemdb_read_nouse(char* fields[], int columns, int current) {
 * &4 - GUID item, cannot be stacked even same or stackable item
 * &4 - GUID item, cannot be stacked even same or stackable item
 */
 */
 static bool itemdb_read_flag(char* fields[], int columns, int current) {
 static bool itemdb_read_flag(char* fields[], int columns, int current) {
-	unsigned short nameid = atoi(fields[0]);
+	t_itemid nameid = strtoul(fields[0], nullptr, 10);
 	uint16 flag;
 	uint16 flag;
 	bool set;
 	bool set;
 	struct item_data *id;
 	struct item_data *id;
 
 
 	if (!(id = itemdb_exists(nameid))) {
 	if (!(id = itemdb_exists(nameid))) {
-		ShowError("itemdb_read_flag: Invalid item id %hu\n", nameid);
+		ShowError("itemdb_read_flag: Invalid item id %u\n", nameid);
 		return true;
 		return true;
 	}
 	}
 	
 	
@@ -1092,7 +1095,7 @@ static void itemdb_read_combos(const char* basedir, bool silent) {
 				RECREATE(id->combos, struct item_combo*, ++id->combos_count);
 				RECREATE(id->combos, struct item_combo*, ++id->combos_count);
 			}
 			}
 			CREATE(id->combos[idx],struct item_combo,1);
 			CREATE(id->combos[idx],struct item_combo,1);
-			id->combos[idx]->nameid = (unsigned short*)aMalloc( retcount * sizeof(unsigned short) );
+			id->combos[idx]->nameid = (t_itemid *)aMalloc(retcount * sizeof(t_itemid));
 			id->combos[idx]->count = retcount;
 			id->combos[idx]->count = retcount;
 			id->combos[idx]->script = parse_script(str[1], path, lines, 0);
 			id->combos[idx]->script = parse_script(str[1], path, lines, 0);
 			id->combos[idx]->id = count;
 			id->combos[idx]->id = count;
@@ -1153,29 +1156,30 @@ bool itemdb_parse_roulette_db(void)
 
 
 		for (k = 0; k < limit && SQL_SUCCESS == Sql_NextRow(mmysql_handle); k++) {
 		for (k = 0; k < limit && SQL_SUCCESS == Sql_NextRow(mmysql_handle); k++) {
 			char* data;
 			char* data;
-			unsigned short item_id, amount;
+			t_itemid item_id;
+			unsigned short amount;
 			int level, flag;
 			int level, flag;
 
 
 			Sql_GetData(mmysql_handle, 1, &data, NULL); level = atoi(data);
 			Sql_GetData(mmysql_handle, 1, &data, NULL); level = atoi(data);
-			Sql_GetData(mmysql_handle, 2, &data, NULL); item_id = atoi(data);
+			Sql_GetData(mmysql_handle, 2, &data, NULL); item_id = strtoul(data, nullptr, 10);
 			Sql_GetData(mmysql_handle, 3, &data, NULL); amount = atoi(data);
 			Sql_GetData(mmysql_handle, 3, &data, NULL); amount = atoi(data);
 			Sql_GetData(mmysql_handle, 4, &data, NULL); flag = atoi(data);
 			Sql_GetData(mmysql_handle, 4, &data, NULL); flag = atoi(data);
 
 
 			if (!itemdb_exists(item_id)) {
 			if (!itemdb_exists(item_id)) {
-				ShowWarning("itemdb_parse_roulette_db: Unknown item ID '%hu' in level '%d'\n", item_id, level);
+				ShowWarning("itemdb_parse_roulette_db: Unknown item ID '%u' in level '%d'\n", item_id, level);
 				continue;
 				continue;
 			}
 			}
 			if (amount < 1 || amount > MAX_AMOUNT){
 			if (amount < 1 || amount > MAX_AMOUNT){
-				ShowWarning("itemdb_parse_roulette_db: Unsupported amount '%hu' for item ID '%hu' in level '%d'\n", amount, item_id, level);
+				ShowWarning("itemdb_parse_roulette_db: Unsupported amount '%hu' for item ID '%u' in level '%d'\n", amount, item_id, level);
 				continue;
 				continue;
 			}
 			}
 			if (flag < 0 || flag > 1) {
 			if (flag < 0 || flag > 1) {
-				ShowWarning("itemdb_parse_roulette_db: Unsupported flag '%d' for item ID '%hu' in level '%d'\n", flag, item_id, level);
+				ShowWarning("itemdb_parse_roulette_db: Unsupported flag '%d' for item ID '%u' in level '%d'\n", flag, item_id, level);
 				continue;
 				continue;
 			}
 			}
 
 
 			j = rd.items[i];
 			j = rd.items[i];
-			RECREATE(rd.nameid[i], unsigned short, ++rd.items[i]);
+			RECREATE(rd.nameid[i], t_itemid, ++rd.items[i]);
 			RECREATE(rd.qty[i], unsigned short, rd.items[i]);
 			RECREATE(rd.qty[i], unsigned short, rd.items[i]);
 			RECREATE(rd.flag[i], int, rd.items[i]);
 			RECREATE(rd.flag[i], int, rd.items[i]);
 
 
@@ -1206,7 +1210,7 @@ bool itemdb_parse_roulette_db(void)
 		ShowWarning("itemdb_parse_roulette_db: Level %d has %d items, %d are required. Filling with Apples...\n", i + 1, rd.items[i], limit);
 		ShowWarning("itemdb_parse_roulette_db: Level %d has %d items, %d are required. Filling with Apples...\n", i + 1, rd.items[i], limit);
 
 
 		rd.items[i] = limit;
 		rd.items[i] = limit;
-		RECREATE(rd.nameid[i], unsigned short, rd.items[i]);
+		RECREATE(rd.nameid[i], t_itemid, rd.items[i]);
 		RECREATE(rd.qty[i], unsigned short, rd.items[i]);
 		RECREATE(rd.qty[i], unsigned short, rd.items[i]);
 		RECREATE(rd.flag[i], int, rd.items[i]);
 		RECREATE(rd.flag[i], int, rd.items[i]);
 
 
@@ -1303,15 +1307,16 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
 		| id | name_english | name_japanese | type | price_buy | price_sell | weight | attack | defence | range | slots | equip_jobs | equip_upper | equip_genders | equip_locations | weapon_level | equip_level | refineable | view | script | equip_script | unequip_script |
 		| id | name_english | name_japanese | type | price_buy | price_sell | weight | attack | defence | range | slots | equip_jobs | equip_upper | equip_genders | equip_locations | weapon_level | equip_level | refineable | view | script | equip_script | unequip_script |
 		+----+--------------+---------------+------+-----------+------------+--------+--------+---------+-------+-------+------------+-------------+---------------+-----------------+--------------+-------------+------------+------+--------+--------------+----------------+
 		+----+--------------+---------------+------+-----------+------------+--------+--------+---------+-------+-------+------------+-------------+---------------+-----------------+--------------+-------------+------------+------+--------+--------------+----------------+
 	*/
 	*/
-	unsigned short nameid;
+	t_itemid nameid;
 	struct item_data* id;
 	struct item_data* id;
 
 
-	if( atoi(str[0]) <= 0 || atoi(str[0]) >= MAX_ITEMID || atoi(str[0]) == dummy_item->nameid )
+	nameid = strtoul(str[0], nullptr, 10);
+
+	if( nameid == 0 || nameid == dummy_item->nameid )
 	{
 	{
-		ShowWarning("itemdb_parse_dbrow: Invalid id %d in line %d of \"%s\", skipping.\n", atoi(str[0]), line, source);
+		ShowWarning("itemdb_parse_dbrow: Invalid id %d in line %d of \"%s\", skipping.\n", nameid, line, source);
 		return false;
 		return false;
 	}
 	}
-	nameid = atoi(str[0]);
 
 
 	//ID,Name,Jname,Type,Price,Sell,Weight,ATK,DEF,Range,Slot,Job,Job Upper,Gender,Loc,wLV,eLV,refineable,View
 	//ID,Name,Jname,Type,Price,Sell,Weight,ATK,DEF,Range,Slot,Job,Job Upper,Gender,Loc,wLV,eLV,refineable,View
 	if (!(id = itemdb_exists(nameid))) {
 	if (!(id = itemdb_exists(nameid))) {
@@ -1330,7 +1335,7 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
 
 
 	if( id->type < 0 || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2 || ( id->type > IT_SHADOWGEAR && id->type < IT_CASH ) || id->type >= IT_MAX )
 	if( id->type < 0 || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2 || ( id->type > IT_SHADOWGEAR && id->type < IT_CASH ) || id->type >= IT_MAX )
 	{// catch invalid item types
 	{// catch invalid item types
-		ShowWarning("itemdb_parse_dbrow: Invalid item type %d for item %hu. IT_ETC will be used.\n", id->type, nameid);
+		ShowWarning("itemdb_parse_dbrow: Invalid item type %d for item %u. IT_ETC will be used.\n", id->type, nameid);
 		id->type = IT_ETC;
 		id->type = IT_ETC;
 	}
 	}
 
 
@@ -1355,13 +1360,13 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
 	/*
 	/*
 	if ( !str[4][0] && !str[5][0])
 	if ( !str[4][0] && !str[5][0])
 	{
 	{
-		ShowWarning("itemdb_parse_dbrow: No buying/selling price defined for item %hu (%s), using 20/10z\n", nameid, id->jname);
+		ShowWarning("itemdb_parse_dbrow: No buying/selling price defined for item %u (%s), using 20/10z\n", nameid, id->jname);
 		id->value_buy = 20;
 		id->value_buy = 20;
 		id->value_sell = 10;
 		id->value_sell = 10;
 	} else
 	} else
 	*/
 	*/
 	if (id->value_buy/124. < id->value_sell/75.)
 	if (id->value_buy/124. < id->value_sell/75.)
-		ShowWarning("itemdb_parse_dbrow: Buying/Selling [%d/%d] price of item %hu (%s) allows Zeny making exploit  through buying/selling at discounted/overcharged prices!\n",
+		ShowWarning("itemdb_parse_dbrow: Buying/Selling [%d/%d] price of item %u (%s) allows Zeny making exploit  through buying/selling at discounted/overcharged prices!\n",
 			id->value_buy, id->value_sell, nameid, id->jname);
 			id->value_buy, id->value_sell, nameid, id->jname);
 
 
 	id->weight = atoi(str[6]);
 	id->weight = atoi(str[6]);
@@ -1376,7 +1381,7 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
 
 
 	if (id->slot > MAX_SLOTS)
 	if (id->slot > MAX_SLOTS)
 	{
 	{
-		ShowWarning("itemdb_parse_dbrow: Item %hu (%s) specifies %d slots, but the server only supports up to %d. Using %d slots.\n", nameid, id->jname, id->slot, MAX_SLOTS, MAX_SLOTS);
+		ShowWarning("itemdb_parse_dbrow: Item %u (%s) specifies %d slots, but the server only supports up to %d. Using %d slots.\n", nameid, id->jname, id->slot, MAX_SLOTS, MAX_SLOTS);
 		id->slot = MAX_SLOTS;
 		id->slot = MAX_SLOTS;
 	}
 	}
 
 
@@ -1387,13 +1392,13 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
 
 
 	if (!id->equip && itemdb_isequip2(id))
 	if (!id->equip && itemdb_isequip2(id))
 	{
 	{
-		ShowWarning("Item %hu (%s) is an equipment with no equip-field! Making it an etc item.\n", nameid, id->jname);
+		ShowWarning("Item %u (%s) is an equipment with no equip-field! Making it an etc item.\n", nameid, id->jname);
 		id->type = IT_ETC;
 		id->type = IT_ETC;
 	}
 	}
 
 
 	if( id->type != IT_SHADOWGEAR && id->equip&EQP_SHADOW_GEAR )
 	if( id->type != IT_SHADOWGEAR && id->equip&EQP_SHADOW_GEAR )
 	{
 	{
-		ShowWarning("Item %hu (%s) have invalid equipment slot! Making it an etc item.\n", nameid, id->jname);
+		ShowWarning("Item %u (%s) have invalid equipment slot! Making it an etc item.\n", nameid, id->jname);
 		id->type = IT_ETC;
 		id->type = IT_ETC;
 	}
 	}
 
 

+ 24 - 23
src/map/itemdb.hpp

@@ -7,10 +7,10 @@
 #include "../common/db.hpp"
 #include "../common/db.hpp"
 #include "../common/mmo.hpp" // ITEM_NAME_LENGTH
 #include "../common/mmo.hpp" // ITEM_NAME_LENGTH
 
 
-///Maximum allowed Item ID (range: 1 ~ 65,534)
-#define MAX_ITEMID USHRT_MAX
+
+
 ///Use apple for unknown items.
 ///Use apple for unknown items.
-#define UNKNOWN_ITEM_ID 512
+const t_itemid UNKNOWN_ITEM_ID = 512;
 /// The maximum number of item delays
 /// The maximum number of item delays
 #define MAX_ITEMDELAYS	10
 #define MAX_ITEMDELAYS	10
 ///Designed for search functions, species max number of matches to display.
 ///Designed for search functions, species max number of matches to display.
@@ -23,15 +23,15 @@
 #define MAX_ROULETTE_LEVEL 7 /** client-defined value **/
 #define MAX_ROULETTE_LEVEL 7 /** client-defined value **/
 #define MAX_ROULETTE_COLUMNS 9 /** client-defined value **/
 #define MAX_ROULETTE_COLUMNS 9 /** client-defined value **/
 
 
-#define CARD0_FORGE 0x00FF
-#define CARD0_CREATE 0x00FE
-#define CARD0_PET 0x0100
+const t_itemid CARD0_FORGE = 0x00FF;
+const t_itemid CARD0_CREATE = 0x00FE;
+const t_itemid CARD0_PET = 0x0100;
 
 
 ///Marks if the card0 given is "special" (non-item id used to mark pets/created items. [Skotlex]
 ///Marks if the card0 given is "special" (non-item id used to mark pets/created items. [Skotlex]
 #define itemdb_isspecial(i) (i == CARD0_FORGE || i == CARD0_CREATE || i == CARD0_PET)
 #define itemdb_isspecial(i) (i == CARD0_FORGE || i == CARD0_CREATE || i == CARD0_PET)
 
 
 ///Enum of item id (for hardcoded purpose)
 ///Enum of item id (for hardcoded purpose)
-enum item_itemid
+enum item_itemid : t_itemid
 {
 {
 	ITEMID_DUMMY						= 499,
 	ITEMID_DUMMY						= 499,
 	ITEMID_RED_POTION					= 501,
 	ITEMID_RED_POTION					= 501,
@@ -113,10 +113,11 @@ enum item_itemid
 	ITEMID_WOB_RACHEL					= 14584,
 	ITEMID_WOB_RACHEL					= 14584,
 	ITEMID_WOB_LOCAL					= 14585,
 	ITEMID_WOB_LOCAL					= 14585,
 	ITEMID_SIEGE_TELEPORT_SCROLL		= 14591,
 	ITEMID_SIEGE_TELEPORT_SCROLL		= 14591,
+	ITEMID_WL_MB_SG						= 100065,
 };
 };
 
 
 ///Rune Knight
 ///Rune Knight
-enum rune_item_list
+enum rune_item_list : t_itemid
 {
 {
 	ITEMID_NAUTHIZ		= 12725,
 	ITEMID_NAUTHIZ		= 12725,
 	ITEMID_RAIDO,
 	ITEMID_RAIDO,
@@ -131,7 +132,7 @@ enum rune_item_list
 };
 };
 
 
 ///Mechanic
 ///Mechanic
-enum mechanic_item_list
+enum mechanic_item_list : t_itemid
 {
 {
 	ITEMID_ACCELERATOR				= 2800,
 	ITEMID_ACCELERATOR				= 2800,
 	ITEMID_HOVERING_BOOSTER,
 	ITEMID_HOVERING_BOOSTER,
@@ -154,7 +155,7 @@ enum mechanic_item_list
 };
 };
 
 
 ///Genetic
 ///Genetic
-enum genetic_item_list
+enum genetic_item_list : t_itemid
 {
 {
 	ITEMID_SEED_OF_HORNY_PLANT			= 6210,
 	ITEMID_SEED_OF_HORNY_PLANT			= 6210,
 	ITEMID_BLOODSUCK_PLANT_SEED,
 	ITEMID_BLOODSUCK_PLANT_SEED,
@@ -194,7 +195,7 @@ enum genetic_item_list
 };
 };
 
 
 ///Guillotine Cross
 ///Guillotine Cross
-enum poison_item_list
+enum poison_item_list : t_itemid
 {
 {
 	ITEMID_PARALYSE = 12717,
 	ITEMID_PARALYSE = 12717,
 	ITEMID_LEECHESEND,
 	ITEMID_LEECHESEND,
@@ -759,7 +760,7 @@ enum e_itemshop_restrictions {
 struct item_combo
 struct item_combo
 {
 {
 	struct script_code *script;
 	struct script_code *script;
-	unsigned short *nameid;/* nameid array */
+	t_itemid *nameid;/* nameid array */
 	unsigned char count;
 	unsigned char count;
 	unsigned short id;/* id of this combo */
 	unsigned short id;/* id of this combo */
 	bool isRef;/* whether this struct is a reference or the master */
 	bool isRef;/* whether this struct is a reference or the master */
@@ -769,8 +770,8 @@ struct item_combo
 /// Struct of item group entry
 /// Struct of item group entry
 struct s_item_group_entry
 struct s_item_group_entry
 {
 {
-	unsigned short nameid, /// Item ID
-		duration, /// Duration if item as rental item (in minutes)
+	t_itemid nameid; /// Item ID
+	unsigned short duration, /// Duration if item as rental item (in minutes)
 		amount; /// Amount of item will be obtained
 		amount; /// Amount of item will be obtained
 	bool isAnnounced, /// Broadcast if player get this item
 	bool isAnnounced, /// Broadcast if player get this item
 		GUID, /// Gives Unique ID for items in each box opened
 		GUID, /// Gives Unique ID for items in each box opened
@@ -796,8 +797,8 @@ struct s_item_group_db
 
 
 /// Struct of Roulette db
 /// Struct of Roulette db
 struct s_roulette_db {
 struct s_roulette_db {
-	unsigned short *nameid[MAX_ROULETTE_LEVEL], /// Item ID
-		           *qty[MAX_ROULETTE_LEVEL]; /// Amount of Item ID
+	t_itemid *nameid[MAX_ROULETTE_LEVEL]; /// Item ID
+	unsigned short *qty[MAX_ROULETTE_LEVEL]; /// Amount of Item ID
 	int *flag[MAX_ROULETTE_LEVEL]; /// Whether the item is for loss or win
 	int *flag[MAX_ROULETTE_LEVEL]; /// Whether the item is for loss or win
 	int items[MAX_ROULETTE_LEVEL]; /// Number of items in the list for each
 	int items[MAX_ROULETTE_LEVEL]; /// Number of items in the list for each
 };
 };
@@ -806,7 +807,7 @@ extern struct s_roulette_db rd;
 ///Main item data struct
 ///Main item data struct
 struct item_data
 struct item_data
 {
 {
-	unsigned short nameid;
+	t_itemid nameid;
 	char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH];
 	char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH];
 
 
 	//Do not add stuff between value_buy and view_id (see how getiteminfo works)
 	//Do not add stuff between value_buy and view_id (see how getiteminfo works)
@@ -824,7 +825,7 @@ struct item_data
 	int look;
 	int look;
 	int elv;
 	int elv;
 	int wlv;
 	int wlv;
-	int view_id;
+	t_itemid view_id;
 	int elvmax; ///< Maximum level for this item
 	int elvmax; ///< Maximum level for this item
 #ifdef RENEWAL
 #ifdef RENEWAL
 	int matk;
 	int matk;
@@ -906,8 +907,8 @@ struct s_random_opt_group {
 struct item_data* itemdb_searchname(const char *name);
 struct item_data* itemdb_searchname(const char *name);
 struct item_data* itemdb_search_aegisname( const char *str );
 struct item_data* itemdb_search_aegisname( const char *str );
 int itemdb_searchname_array(struct item_data** data, int size, const char *str);
 int itemdb_searchname_array(struct item_data** data, int size, const char *str);
-struct item_data* itemdb_search(unsigned short nameid);
-struct item_data* itemdb_exists(unsigned short nameid);
+struct item_data* itemdb_search(t_itemid nameid);
+struct item_data* itemdb_exists(t_itemid nameid);
 #define itemdb_name(n) itemdb_search(n)->name
 #define itemdb_name(n) itemdb_search(n)->name
 #define itemdb_jname(n) itemdb_search(n)->jname
 #define itemdb_jname(n) itemdb_search(n)->jname
 #define itemdb_type(n) itemdb_search(n)->type
 #define itemdb_type(n) itemdb_search(n)->type
@@ -930,7 +931,7 @@ const char* itemdb_typename(enum item_types type);
 const char *itemdb_typename_ammo (enum e_item_ammo ammo);
 const char *itemdb_typename_ammo (enum e_item_ammo ammo);
 
 
 struct s_item_group_entry *itemdb_get_randgroupitem(uint16 group_id, uint8 sub_group);
 struct s_item_group_entry *itemdb_get_randgroupitem(uint16 group_id, uint8 sub_group);
-unsigned short itemdb_searchrandomid(uint16 group_id, uint8 sub_group);
+t_itemid itemdb_searchrandomid(uint16 group_id, uint8 sub_group);
 
 
 #define itemdb_value_buy(n) itemdb_search(n)->value_buy
 #define itemdb_value_buy(n) itemdb_search(n)->value_buy
 #define itemdb_value_sell(n) itemdb_search(n)->value_sell
 #define itemdb_value_sell(n) itemdb_search(n)->value_sell
@@ -959,7 +960,7 @@ bool itemdb_ishatched_egg(struct item* item);
 
 
 bool itemdb_isequip2(struct item_data *id);
 bool itemdb_isequip2(struct item_data *id);
 #define itemdb_isequip(nameid) itemdb_isequip2(itemdb_search(nameid))
 #define itemdb_isequip(nameid) itemdb_isequip2(itemdb_search(nameid))
-char itemdb_isidentified(unsigned short nameid);
+char itemdb_isidentified(t_itemid nameid);
 bool itemdb_isstackable2(struct item_data *id);
 bool itemdb_isstackable2(struct item_data *id);
 #define itemdb_isstackable(nameid) itemdb_isstackable2(itemdb_search(nameid))
 #define itemdb_isstackable(nameid) itemdb_isstackable2(itemdb_search(nameid))
 bool itemdb_isNoEquip(struct item_data *id, uint16 m);
 bool itemdb_isNoEquip(struct item_data *id, uint16 m);
@@ -967,7 +968,7 @@ bool itemdb_isNoEquip(struct item_data *id, uint16 m);
 struct item_combo *itemdb_combo_exists(unsigned short combo_id);
 struct item_combo *itemdb_combo_exists(unsigned short combo_id);
 
 
 struct s_item_group_db *itemdb_group_exists(unsigned short group_id);
 struct s_item_group_db *itemdb_group_exists(unsigned short group_id);
-bool itemdb_group_item_exists(unsigned short group_id, unsigned short nameid);
+bool itemdb_group_item_exists(unsigned short group_id, t_itemid nameid);
 int16 itemdb_group_item_exists_pc(struct map_session_data *sd, unsigned short group_id);
 int16 itemdb_group_item_exists_pc(struct map_session_data *sd, unsigned short group_id);
 char itemdb_pc_get_itemgroup(uint16 group_id, bool identify, struct map_session_data *sd);
 char itemdb_pc_get_itemgroup(uint16 group_id, bool identify, struct map_session_data *sd);
 
 

+ 11 - 11
src/map/log.cpp

@@ -136,7 +136,7 @@ static char log_feedingtype2char(e_log_feeding_type type) {
 }
 }
 
 
 /// check if this item should be logged according the settings
 /// check if this item should be logged according the settings
-static bool should_log_item(unsigned short nameid, int amount, int refine)
+static bool should_log_item(t_itemid nameid, int amount, int refine)
 {
 {
 	int filter = log_config.filter;
 	int filter = log_config.filter;
 	struct item_data* id;
 	struct item_data* id;
@@ -226,11 +226,11 @@ void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item* it
 			StringBuf_Printf(&buf, ", `option_val%d`", i);
 			StringBuf_Printf(&buf, ", `option_val%d`", i);
 			StringBuf_Printf(&buf, ", `option_parm%d`", i);
 			StringBuf_Printf(&buf, ", `option_parm%d`", i);
 		}
 		}
-		StringBuf_Printf(&buf, ") VALUES(NOW(),'%u','%c','%d','%d','%d','%s','%" PRIu64 "','%d'",
+		StringBuf_Printf(&buf, ") VALUES(NOW(),'%u','%c','%u','%d','%d','%s','%" PRIu64 "','%d'",
 			id, log_picktype2char(type), itm->nameid, amount, itm->refine, map_getmapdata(m)->name[0] ? map_getmapdata(m)->name : "", itm->unique_id, itm->bound);
 			id, log_picktype2char(type), itm->nameid, amount, itm->refine, map_getmapdata(m)->name[0] ? map_getmapdata(m)->name : "", itm->unique_id, itm->bound);
 
 
 		for (i = 0; i < MAX_SLOTS; i++)
 		for (i = 0; i < MAX_SLOTS; i++)
-			StringBuf_Printf(&buf, ",'%d'", itm->card[i]);
+			StringBuf_Printf(&buf, ",'%u'", itm->card[i]);
 		for (i = 0; i < MAX_ITEM_RDM_OPT; i++)
 		for (i = 0; i < MAX_ITEM_RDM_OPT; i++)
 			StringBuf_Printf(&buf, ",'%d','%d','%d'", itm->option[i].id, itm->option[i].value, itm->option[i].param);
 			StringBuf_Printf(&buf, ",'%d','%d','%d'", itm->option[i].id, itm->option[i].value, itm->option[i].param);
 		StringBuf_Printf(&buf, ")");
 		StringBuf_Printf(&buf, ")");
@@ -251,7 +251,7 @@ void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item* it
 			return;
 			return;
 		time(&curtime);
 		time(&curtime);
 		strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime));
 		strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime));
-		fprintf(logfp,"%s - %d\t%c\t%hu,%d,%d,%hu,%hu,%hu,%hu,%s,'%" PRIu64 "',%d\n", timestring, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], map_getmapdata(m)->name[0]?map_getmapdata(m)->name:"", itm->unique_id, itm->bound);
+		fprintf(logfp,"%s - %d\t%c\t%u,%d,%d,%u,%u,%u,%u,%s,'%" PRIu64 "',%d\n", timestring, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], map_getmapdata(m)->name[0]?map_getmapdata(m)->name:"", itm->unique_id, itm->bound);
 		fclose(logfp);
 		fclose(logfp);
 	}
 	}
 }
 }
@@ -305,7 +305,7 @@ void log_zeny(struct map_session_data* sd, e_log_pick_type type, struct map_sess
 
 
 
 
 /// logs MVP monster rewards
 /// logs MVP monster rewards
-void log_mvpdrop(struct map_session_data* sd, int monster_id, unsigned int* log_mvp)
+void log_mvpdrop(struct map_session_data* sd, int monster_id, t_itemid nameid, t_exp exp )
 {
 {
 	nullpo_retv(sd);
 	nullpo_retv(sd);
 
 
@@ -314,8 +314,8 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, unsigned int* log_
 
 
 	if( log_config.sql_logs )
 	if( log_config.sql_logs )
 	{
 	{
-		if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%hu', '%u', '%s') ",
-			log_config.log_mvpdrop, sd->status.char_id, monster_id, (unsigned short)log_mvp[0], log_mvp[1], mapindex_id2name(sd->mapindex)) )
+		if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%u', '%" PRIu64 "', '%s') ",
+			log_config.log_mvpdrop, sd->status.char_id, monster_id, nameid, exp, mapindex_id2name(sd->mapindex)) )
 		{
 		{
 			Sql_ShowDebug(logmysql_handle);
 			Sql_ShowDebug(logmysql_handle);
 			return;
 			return;
@@ -331,7 +331,7 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, unsigned int* log_
 			return;
 			return;
 		time(&curtime);
 		time(&curtime);
 		strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime));
 		strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime));
-		fprintf(logfp,"%s - %s[%d:%d]\t%d\t%hu,%u\n", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, (unsigned short)log_mvp[0], log_mvp[1]);
+		fprintf(logfp,"%s - %s[%d:%d]\t%d\t%u,%" PRIu64 "\n", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, nameid, exp);
 		fclose(logfp);
 		fclose(logfp);
 	}
 	}
 }
 }
@@ -530,7 +530,7 @@ void log_cash( struct map_session_data* sd, e_log_pick_type type, e_log_cash_typ
  * @param type Log type, @see e_log_feeding_type
  * @param type Log type, @see e_log_feeding_type
  * @param nameid Item used as food
  * @param nameid Item used as food
  **/
  **/
-void log_feeding(struct map_session_data *sd, e_log_feeding_type type, unsigned short nameid) {
+void log_feeding(struct map_session_data *sd, e_log_feeding_type type, t_itemid nameid) {
 	unsigned int target_id = 0, intimacy = 0;
 	unsigned int target_id = 0, intimacy = 0;
 	unsigned short target_class = 0;
 	unsigned short target_class = 0;
 
 
@@ -557,7 +557,7 @@ void log_feeding(struct map_session_data *sd, e_log_feeding_type type, unsigned
 	}
 	}
 
 
 	if (log_config.sql_logs) {
 	if (log_config.sql_logs) {
-		if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `target_id`, `target_class`, `type`, `intimacy`, `item_id`, `map`, `x`, `y`) VALUES ( NOW(), '%" PRIu32 "', '%" PRIu32 "', '%hu', '%c', '%" PRIu32 "', '%hu', '%s', '%hu', '%hu' )",
+		if (SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `target_id`, `target_class`, `type`, `intimacy`, `item_id`, `map`, `x`, `y`) VALUES ( NOW(), '%" PRIu32 "', '%" PRIu32 "', '%hu', '%c', '%" PRIu32 "', '%u', '%s', '%hu', '%hu' )",
 			log_config.log_feeding, sd->status.char_id, target_id, target_class, log_feedingtype2char(type), intimacy, nameid, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y))
 			log_config.log_feeding, sd->status.char_id, target_id, target_class, log_feedingtype2char(type), intimacy, nameid, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y))
 		{
 		{
 			Sql_ShowDebug(logmysql_handle);
 			Sql_ShowDebug(logmysql_handle);
@@ -572,7 +572,7 @@ void log_feeding(struct map_session_data *sd, e_log_feeding_type type, unsigned
 			return;
 			return;
 		time(&curtime);
 		time(&curtime);
 		strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime));
 		strftime(timestring, sizeof(timestring), log_timestamp_format, localtime(&curtime));
-		fprintf(logfp, "%s - %s[%d]\t%d\t%d(%c)\t%d\t%hu\t%s\t%hu,%hu\n", timestring, sd->status.name, sd->status.char_id, target_id, target_class, log_feedingtype2char(type), intimacy, nameid, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
+		fprintf(logfp, "%s - %s[%d]\t%d\t%d(%c)\t%d\t%u\t%s\t%hu,%hu\n", timestring, sd->status.name, sd->status.char_id, target_id, target_class, log_feedingtype2char(type), intimacy, nameid, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y);
 		fclose(logfp);
 		fclose(logfp);
 	}
 	}
 }
 }

+ 3 - 2
src/map/log.hpp

@@ -5,6 +5,7 @@
 #define LOG_HPP
 #define LOG_HPP
 
 
 #include "../common/cbasetypes.hpp"
 #include "../common/cbasetypes.hpp"
+#include "../common/mmo.hpp"
 
 
 struct block_list;
 struct block_list;
 struct map_session_data;
 struct map_session_data;
@@ -77,11 +78,11 @@ void log_npc( struct npc_data* nd, const char* message );
 void log_npc(struct map_session_data* sd, const char *message);
 void log_npc(struct map_session_data* sd, const char *message);
 void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char* map, int x, int y, const char* dst_charname, const char* message);
 void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid, const char* map, int x, int y, const char* dst_charname, const char* message);
 void log_atcommand(struct map_session_data* sd, const char* message);
 void log_atcommand(struct map_session_data* sd, const char* message);
-void log_feeding(struct map_session_data *sd, e_log_feeding_type type, unsigned short nameid);
+void log_feeding(struct map_session_data *sd, e_log_feeding_type type, t_itemid nameid);
 
 
 /// old, but useful logs
 /// old, but useful logs
 void log_branch(struct map_session_data* sd);
 void log_branch(struct map_session_data* sd);
-void log_mvpdrop(struct map_session_data* sd, int monster_id, unsigned int* log_mvp);
+void log_mvpdrop(struct map_session_data* sd, int monster_id, t_itemid nameid, t_exp exp);
 
 
 int log_config_read(const char* cfgName);
 int log_config_read(const char* cfgName);
 
 

+ 2 - 2
src/map/map.cpp

@@ -1420,7 +1420,7 @@ int map_foreachindir(int(*func)(struct block_list*, va_list), int16 m, int16 x0,
 						rx = (bl->x - x0);
 						rx = (bl->x - x0);
 						ry = (bl->y - y0);
 						ry = (bl->y - y0);
 						//Do not hit source cell
 						//Do not hit source cell
-						if (rx == 0 && ry == 0)
+						if (battle_config.skill_eightpath_same_cell == 0 && rx == 0 && ry == 0)
 							continue;
 							continue;
 						//This turns it so that the area that is hit is always with positive rx and ry
 						//This turns it so that the area that is hit is always with positive rx and ry
 						rx *= dx;
 						rx *= dx;
@@ -1456,7 +1456,7 @@ int map_foreachindir(int(*func)(struct block_list*, va_list), int16 m, int16 x0,
 						rx = (bl->x - x0);
 						rx = (bl->x - x0);
 						ry = (bl->y - y0);
 						ry = (bl->y - y0);
 						//Do not hit source cell
 						//Do not hit source cell
-						if (rx == 0 && ry == 0)
+						if (battle_config.skill_eightpath_same_cell == 0 && rx == 0 && ry == 0)
 							continue;
 							continue;
 						//This turns it so that the area that is hit is always with positive rx and ry
 						//This turns it so that the area that is hit is always with positive rx and ry
 						rx *= dx;
 						rx *= dx;

+ 28 - 26
src/map/mob.cpp

@@ -87,7 +87,7 @@ struct mob_chat *mob_chat(short id) {
 //Dynamic item drop ratio database for per-item drop ratio modifiers overriding global drop ratios.
 //Dynamic item drop ratio database for per-item drop ratio modifiers overriding global drop ratios.
 #define MAX_ITEMRATIO_MOBS 10
 #define MAX_ITEMRATIO_MOBS 10
 struct s_mob_item_drop_ratio {
 struct s_mob_item_drop_ratio {
-	unsigned short nameid;
+	t_itemid nameid;
 	int drop_ratio;
 	int drop_ratio;
 	unsigned short mob_id[MAX_ITEMRATIO_MOBS];
 	unsigned short mob_id[MAX_ITEMRATIO_MOBS];
 };
 };
@@ -2719,7 +2719,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 		dlist->item = NULL;
 		dlist->item = NULL;
 
 
 		for (i = 0; i < MAX_MOB_DROP_TOTAL; i++) {
 		for (i = 0; i < MAX_MOB_DROP_TOTAL; i++) {
-			if (md->db->dropitem[i].nameid <= 0)
+			if (md->db->dropitem[i].nameid == 0)
 				continue;
 				continue;
 			if ( !(it = itemdb_exists(md->db->dropitem[i].nameid)) )
 			if ( !(it = itemdb_exists(md->db->dropitem[i].nameid)) )
 				continue;
 				continue;
@@ -2814,7 +2814,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 
 
 		if(sd) {
 		if(sd) {
 			// process script-granted extra drop bonuses
 			// process script-granted extra drop bonuses
-			uint16 dropid = 0;
+			t_itemid dropid = 0;
 
 
 			for (const auto &it : sd->add_drop) {
 			for (const auto &it : sd->add_drop) {
 				struct s_mob_drop mobdrop;
 				struct s_mob_drop mobdrop;
@@ -2877,7 +2877,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 	}
 	}
 
 
 	if(mvp_sd && md->db->mexp > 0 && !md->special_state.ai) {
 	if(mvp_sd && md->db->mexp > 0 && !md->special_state.ai) {
-		unsigned int log_mvp[2] = {0};
+		t_itemid log_mvp_nameid = 0;
+		t_exp log_mvp_exp = 0;
 		unsigned int mexp;
 		unsigned int mexp;
 		struct item item;
 		struct item item;
 		double exp;
 		double exp;
@@ -2896,7 +2897,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 		clif_mvp_effect(mvp_sd);
 		clif_mvp_effect(mvp_sd);
 		clif_mvp_exp(mvp_sd,mexp);
 		clif_mvp_exp(mvp_sd,mexp);
 		pc_gainexp(mvp_sd, &md->bl, mexp,0, 0);
 		pc_gainexp(mvp_sd, &md->bl, mexp,0, 0);
-		log_mvp[1] = mexp;
+		log_mvp_exp = mexp;
 
 
 		if( !(map_getmapflag(m, MF_NOMVPLOOT) || type&1) ) {
 		if( !(map_getmapflag(m, MF_NOMVPLOOT) || type&1) ) {
 			//Order might be random depending on item_drop_mvp_mode config setting
 			//Order might be random depending on item_drop_mvp_mode config setting
@@ -2927,7 +2928,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 			for(i = 0; i < MAX_MVP_DROP_TOTAL; i++) {
 			for(i = 0; i < MAX_MVP_DROP_TOTAL; i++) {
 				struct item_data *i_data;
 				struct item_data *i_data;
 
 
-				if(mdrop[i].nameid <= 0 || !(i_data = itemdb_exists(mdrop[i].nameid)))
+				if(mdrop[i].nameid == 0 || !(i_data = itemdb_exists(mdrop[i].nameid)))
 					continue;
 					continue;
 
 
 				temp = mdrop[i].p;
 				temp = mdrop[i].p;
@@ -2942,7 +2943,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 				item.nameid=mdrop[i].nameid;
 				item.nameid=mdrop[i].nameid;
 				item.identify= itemdb_isidentified(item.nameid);
 				item.identify= itemdb_isidentified(item.nameid);
 				clif_mvp_item(mvp_sd,item.nameid);
 				clif_mvp_item(mvp_sd,item.nameid);
-				log_mvp[0] = item.nameid;
+				log_mvp_nameid = item.nameid;
 
 
 				//A Rare MVP Drop Global Announce by Lupus
 				//A Rare MVP Drop Global Announce by Lupus
 				if(temp<=battle_config.rare_drop_announce) {
 				if(temp<=battle_config.rare_drop_announce) {
@@ -2971,7 +2972,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
 			}
 			}
 		}
 		}
 
 
-		log_mvpdrop(mvp_sd, md->mob_id, log_mvp);
+		log_mvpdrop(mvp_sd, md->mob_id, log_mvp_nameid, log_mvp_exp);
 	}
 	}
 
 
 	if (type&2 && !sd && md->mob_id == MOBID_EMPERIUM)
 	if (type&2 && !sd && md->mob_id == MOBID_EMPERIUM)
@@ -4111,9 +4112,9 @@ static unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned shor
  * @param mob_id ID of the monster
  * @param mob_id ID of the monster
  * @param rate_adjust pointer to store ratio if found
  * @param rate_adjust pointer to store ratio if found
  */
  */
-static void item_dropratio_adjust(unsigned short nameid, int mob_id, int *rate_adjust)
+static void item_dropratio_adjust(t_itemid nameid, int mob_id, int *rate_adjust)
 {
 {
-	struct s_mob_item_drop_ratio *item_ratio = (struct s_mob_item_drop_ratio *)idb_get(mob_item_drop_ratio, nameid);
+	struct s_mob_item_drop_ratio *item_ratio = (struct s_mob_item_drop_ratio *)uidb_get(mob_item_drop_ratio, nameid);
 	if( item_ratio) {
 	if( item_ratio) {
 		if( item_ratio->mob_id[0] ) { // only for listed mobs
 		if( item_ratio->mob_id[0] ) { // only for listed mobs
 			int i;
 			int i;
@@ -4269,7 +4270,7 @@ static bool mob_parse_dbrow(char** str)
 
 
 	// MVP Drops: MVP1id,MVP1per,MVP2id,MVP2per,MVP3id,MVP3per
 	// MVP Drops: MVP1id,MVP1per,MVP2id,MVP2per,MVP3id,MVP3per
 	for(i = 0; i < MAX_MVP_DROP; i++) {
 	for(i = 0; i < MAX_MVP_DROP; i++) {
-		entry.mvpitem[i].nameid = atoi(str[31+i*2]);
+		entry.mvpitem[i].nameid = strtoul(str[31+i*2], nullptr, 10);
 
 
 		if( entry.mvpitem[i].nameid ){
 		if( entry.mvpitem[i].nameid ){
 			if( itemdb_search(entry.mvpitem[i].nameid) ){
 			if( itemdb_search(entry.mvpitem[i].nameid) ){
@@ -4288,7 +4289,7 @@ static bool mob_parse_dbrow(char** str)
 	for(i = 0; i < MAX_MOB_DROP; i++) {
 	for(i = 0; i < MAX_MOB_DROP; i++) {
 		int k = 31 + MAX_MVP_DROP*2 + i*2;
 		int k = 31 + MAX_MVP_DROP*2 + i*2;
 
 
-		entry.dropitem[i].nameid = atoi(str[k]);
+		entry.dropitem[i].nameid = strtoul(str[k], nullptr, 10);
 
 
 		if( entry.dropitem[i].nameid ){
 		if( entry.dropitem[i].nameid ){
 			if( itemdb_search( entry.dropitem[i].nameid ) ){
 			if( itemdb_search( entry.dropitem[i].nameid ) ){
@@ -5152,19 +5153,19 @@ static bool mob_readdb_race2(char* fields[], int columns, int current)
  */
  */
 static bool mob_readdb_itemratio(char* str[], int columns, int current)
 static bool mob_readdb_itemratio(char* str[], int columns, int current)
 {
 {
-	unsigned short nameid;
+	t_itemid nameid;
 	int ratio, i;
 	int ratio, i;
 	struct s_mob_item_drop_ratio *item_ratio;
 	struct s_mob_item_drop_ratio *item_ratio;
-	nameid = atoi(str[0]);
+	nameid = strtoul(str[0], nullptr, 10);
 
 
 	if (itemdb_exists(nameid) == NULL) {
 	if (itemdb_exists(nameid) == NULL) {
-		ShowWarning("mob_readdb_itemratio: Invalid item id %hu.\n", nameid);
+		ShowWarning("mob_readdb_itemratio: Invalid item id %u.\n", nameid);
 		return false;
 		return false;
 	}
 	}
 
 
 	ratio = atoi(str[1]);
 	ratio = atoi(str[1]);
 
 
-	if (!(item_ratio = (struct s_mob_item_drop_ratio *)idb_get(mob_item_drop_ratio,nameid)))
+	if (!(item_ratio = (struct s_mob_item_drop_ratio *)uidb_get(mob_item_drop_ratio,nameid)))
 		CREATE(item_ratio, struct s_mob_item_drop_ratio, 1);
 		CREATE(item_ratio, struct s_mob_item_drop_ratio, 1);
 
 
 	item_ratio->drop_ratio = ratio;
 	item_ratio->drop_ratio = ratio;
@@ -5172,14 +5173,14 @@ static bool mob_readdb_itemratio(char* str[], int columns, int current)
 	for (i = 0; i < columns-2; i++) {
 	for (i = 0; i < columns-2; i++) {
 		uint16 mob_id = atoi(str[i+2]);
 		uint16 mob_id = atoi(str[i+2]);
 		if (mob_db(mob_id) == NULL)
 		if (mob_db(mob_id) == NULL)
-			ShowError("mob_readdb_itemratio: Invalid monster with ID %hu (Item:%hu Col:%d).\n", mob_id, nameid, columns);
+			ShowError("mob_readdb_itemratio: Invalid monster with ID %hu (Item:%u Col:%d).\n", mob_id, nameid, columns);
 		else
 		else
 			item_ratio->mob_id[i] = atoi(str[i+2]);
 			item_ratio->mob_id[i] = atoi(str[i+2]);
 	}
 	}
 
 
 	if (!item_ratio->nameid) {
 	if (!item_ratio->nameid) {
 		item_ratio->nameid = nameid;
 		item_ratio->nameid = nameid;
-		idb_put(mob_item_drop_ratio, nameid, item_ratio);
+		uidb_put(mob_item_drop_ratio, nameid, item_ratio);
 	}
 	}
 
 
 	return true;
 	return true;
@@ -5190,7 +5191,8 @@ static bool mob_readdb_itemratio(char* str[], int columns, int current)
  * @author [Cydh]
  * @author [Cydh]
  **/
  **/
 static bool mob_readdb_drop(char* str[], int columns, int current) {
 static bool mob_readdb_drop(char* str[], int columns, int current) {
-	unsigned short mobid, nameid;
+	unsigned short mobid;
+	t_itemid nameid;
 	int rate, i, size, flag = 0;
 	int rate, i, size, flag = 0;
 	struct mob_db *mob;
 	struct mob_db *mob;
 	struct s_mob_drop *drop;
 	struct s_mob_drop *drop;
@@ -5201,7 +5203,7 @@ static bool mob_readdb_drop(char* str[], int columns, int current) {
 		return false;
 		return false;
 	}
 	}
 
 
-	nameid = atoi(str[1]);
+	nameid = strtoul(str[1], nullptr, 10);
 	if (itemdb_exists(nameid) == NULL) {
 	if (itemdb_exists(nameid) == NULL) {
 		ShowWarning("mob_readdb_drop: Invalid item ID %s.\n", str[1]);
 		ShowWarning("mob_readdb_drop: Invalid item ID %s.\n", str[1]);
 		return false;
 		return false;
@@ -5221,7 +5223,7 @@ static bool mob_readdb_drop(char* str[], int columns, int current) {
 		for (i = 0; i < size; i++) {
 		for (i = 0; i < size; i++) {
 			if (drop[i].nameid == nameid) {
 			if (drop[i].nameid == nameid) {
 				memset(&drop[i], 0, sizeof(struct s_mob_drop));
 				memset(&drop[i], 0, sizeof(struct s_mob_drop));
-				ShowInfo("mob_readdb_drop: Removed item '%hu' from monster '%hu'.\n", nameid, mobid);
+				ShowInfo("mob_readdb_drop: Removed item '%u' from monster '%hu'.\n", nameid, mobid);
 				return true;
 				return true;
 			}
 			}
 		}
 		}
@@ -5231,7 +5233,7 @@ static bool mob_readdb_drop(char* str[], int columns, int current) {
 		if (i == size) { // Item is not dropped at all (search all item slots)
 		if (i == size) { // Item is not dropped at all (search all item slots)
 			ARR_FIND(0, size, i, drop[i].nameid == 0);
 			ARR_FIND(0, size, i, drop[i].nameid == 0);
 			if (i == size) { // No empty slots
 			if (i == size) { // No empty slots
-				ShowError("mob_readdb_drop: Cannot add item '%hu' to monster '%hu'. Max drop reached (%d).\n", nameid, mobid, size);
+				ShowError("mob_readdb_drop: Cannot add item '%u' to monster '%hu'. Max drop reached (%d).\n", nameid, mobid, size);
 				return true;
 				return true;
 			}
 			}
 		}
 		}
@@ -5279,7 +5281,7 @@ static void mob_drop_ratio_adjust(void){
 	for( auto &pair : mob_db_data ){
 	for( auto &pair : mob_db_data ){
 		struct mob_db *mob;
 		struct mob_db *mob;
 		struct item_data *id;
 		struct item_data *id;
-		unsigned short nameid;
+		t_itemid nameid;
 		int j, rate, rate_adjust = 0, mob_id;
 		int j, rate, rate_adjust = 0, mob_id;
 
 
 		mob_id = pair.first;
 		mob_id = pair.first;
@@ -5311,7 +5313,7 @@ static void mob_drop_ratio_adjust(void){
 
 
 				// Item is not known anymore(should never happen)
 				// Item is not known anymore(should never happen)
 				if( !id ){
 				if( !id ){
-					ShowWarning( "Monster \"%s\"(id:%hu) is dropping an unknown item(id: %d)\n", mob->name, mob_id, nameid );
+					ShowWarning( "Monster \"%s\"(id:%hu) is dropping an unknown item(id: %u)\n", mob->name, mob_id, nameid );
 					mob->mvpitem[j].nameid = 0;
 					mob->mvpitem[j].nameid = 0;
 					mob->mvpitem[j].p = 0;
 					mob->mvpitem[j].p = 0;
 					continue;
 					continue;
@@ -5341,7 +5343,7 @@ static void mob_drop_ratio_adjust(void){
 
 
 			// Item is not known anymore(should never happen)
 			// Item is not known anymore(should never happen)
 			if( !id ){
 			if( !id ){
-				ShowWarning( "Monster \"%s\"(id:%hu) is dropping an unknown item(id: %d)\n", mob->name, mob_id, nameid );
+				ShowWarning( "Monster \"%s\"(id:%hu) is dropping an unknown item(id: %u)\n", mob->name, mob_id, nameid );
 				mob->dropitem[j].nameid = 0;
 				mob->dropitem[j].nameid = 0;
 				mob->dropitem[j].p = 0;
 				mob->dropitem[j].p = 0;
 				continue;
 				continue;
@@ -5611,7 +5613,7 @@ void mob_db_load(bool is_reload){
 		item_drop_ers = ers_new(sizeof(struct item_drop),"mob.cpp::item_drop_ers",ERS_OPT_CLEAN);
 		item_drop_ers = ers_new(sizeof(struct item_drop),"mob.cpp::item_drop_ers",ERS_OPT_CLEAN);
 		item_drop_list_ers = ers_new(sizeof(struct item_drop_list),"mob.cpp::item_drop_list_ers",ERS_OPT_NONE);
 		item_drop_list_ers = ers_new(sizeof(struct item_drop_list),"mob.cpp::item_drop_list_ers",ERS_OPT_NONE);
 	}
 	}
-	mob_item_drop_ratio = idb_alloc(DB_OPT_BASE);
+	mob_item_drop_ratio = uidb_alloc(DB_OPT_BASE);
 	mob_skill_db = idb_alloc(DB_OPT_BASE);
 	mob_skill_db = idb_alloc(DB_OPT_BASE);
 	mob_summon_db = idb_alloc(DB_OPT_BASE);
 	mob_summon_db = idb_alloc(DB_OPT_BASE);
 	mob_load();
 	mob_load();

+ 1 - 1
src/map/mob.hpp

@@ -155,7 +155,7 @@ struct s_mob_lootitem {
 
 
 /// Struct for monster's drop item
 /// Struct for monster's drop item
 struct s_mob_drop {
 struct s_mob_drop {
-	unsigned short nameid;
+	t_itemid nameid;
 	int p;
 	int p;
 	uint8 randomopt_group;
 	uint8 randomopt_group;
 	unsigned steal_protected : 1;
 	unsigned steal_protected : 1;

+ 33 - 31
src/map/npc.cpp

@@ -1606,7 +1606,7 @@ static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int
 				int delete_amount = price, i;
 				int delete_amount = price, i;
 
 
 				if (!id) { // Item Data is checked at script parsing but in case of item_db reload, check again.
 				if (!id) { // Item Data is checked at script parsing but in case of item_db reload, check again.
-					ShowWarning("Failed to find sellitem %hu for itemshop NPC '%s' (%s, %d, %d)!\n", nd->u.shop.itemshop_nameid, nd->exname, map_mapid2mapname(nd->bl.m), nd->bl.x, nd->bl.y);
+					ShowWarning("Failed to find sellitem %u for itemshop NPC '%s' (%s, %d, %d)!\n", nd->u.shop.itemshop_nameid, nd->exname, map_mapid2mapname(nd->bl.m), nd->bl.x, nd->bl.y);
 					return ERROR_TYPE_PURCHASE_FAIL;
 					return ERROR_TYPE_PURCHASE_FAIL;
 				}
 				}
 				if (cost[1] < points || cost[0] < (price - points)) {
 				if (cost[1] < points || cost[0] < (price - points)) {
@@ -1614,7 +1614,7 @@ static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int
 
 
 					memset(output, '\0', sizeof(output));
 					memset(output, '\0', sizeof(output));
 
 
-					sprintf(output, msg_txt(sd, 712), id->jname, id->nameid); // You do not have enough %s (%hu).
+					sprintf(output, msg_txt(sd, 712), id->jname, id->nameid); // You do not have enough %s (%u).
 					clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);
 					clif_messagecolor(&sd->bl, color_table[COLOR_RED], output, false, SELF);
 					return ERROR_TYPE_PURCHASE_FAIL;
 					return ERROR_TYPE_PURCHASE_FAIL;
 				}
 				}
@@ -1633,13 +1633,13 @@ static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int
 						amount = delete_amount;
 						amount = delete_amount;
 
 
 					if (pc_delitem(sd, i, amount, 0, 0, LOG_TYPE_NPC)) {
 					if (pc_delitem(sd, i, amount, 0, 0, LOG_TYPE_NPC)) {
-						ShowWarning("Failed to delete item %hu from '%s' at itemshop NPC '%s' (%s, %d, %d)!\n", nd->u.shop.itemshop_nameid, sd->status.name, nd->exname, map_mapid2mapname(nd->bl.m), nd->bl.x, nd->bl.y);
+						ShowWarning("Failed to delete item %u from '%s' at itemshop NPC '%s' (%s, %d, %d)!\n", nd->u.shop.itemshop_nameid, sd->status.name, nd->exname, map_mapid2mapname(nd->bl.m), nd->bl.x, nd->bl.y);
 						return ERROR_TYPE_PURCHASE_FAIL;
 						return ERROR_TYPE_PURCHASE_FAIL;
 					}
 					}
 					delete_amount -= amount;
 					delete_amount -= amount;
 				}
 				}
 				if (delete_amount > 0) {
 				if (delete_amount > 0) {
-					ShowError("Item %hu is not enough as payment at itemshop NPC '%s' (%s, %d, %d, AID=%d, CID=%d)!\n", nd->u.shop.itemshop_nameid, nd->exname, map_mapid2mapname(nd->bl.m), nd->bl.x, nd->bl.y, sd->status.account_id, sd->status.char_id);
+					ShowError("Item %u is not enough as payment at itemshop NPC '%s' (%s, %d, %d, AID=%d, CID=%d)!\n", nd->u.shop.itemshop_nameid, nd->exname, map_mapid2mapname(nd->bl.m), nd->bl.x, nd->bl.y, sd->status.account_id, sd->status.char_id);
 					return ERROR_TYPE_PURCHASE_FAIL;
 					return ERROR_TYPE_PURCHASE_FAIL;
 				}
 				}
 			}
 			}
@@ -1675,7 +1675,7 @@ static enum e_CASHSHOP_ACK npc_cashshop_process_payment(struct npc_data *nd, int
 int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub* item_list)
 int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, struct PACKET_CZ_PC_BUY_CASH_POINT_ITEM_sub* item_list)
 {
 {
 	int i, j, amount, new_, w, vt;
 	int i, j, amount, new_, w, vt;
-	unsigned short nameid;
+	t_itemid nameid;
 	struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
 	struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
 	enum e_CASHSHOP_ACK res;
 	enum e_CASHSHOP_ACK res;
 	item_data *id;
 	item_data *id;
@@ -1707,7 +1707,7 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, str
 
 
 		if( !itemdb_isstackable2(id) && amount > 1 )
 		if( !itemdb_isstackable2(id) && amount > 1 )
 		{
 		{
-			ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %hu!\n", sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
+			ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %u!\n", sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
 			amount = item_list[i].amount = 1;
 			amount = item_list[i].amount = 1;
 		}
 		}
 
 
@@ -1797,7 +1797,7 @@ void npc_shop_currency_type(struct map_session_data *sd, struct npc_data *nd, in
 
 
 					memset(output, '\0', sizeof(output));
 					memset(output, '\0', sizeof(output));
 
 
-					sprintf(output, msg_txt(sd, 714), id->jname, id->nameid); // Item Shop List: %s (%hu)
+					sprintf(output, msg_txt(sd, 714), id->jname, id->nameid); // Item Shop List: %s (%u)
 					clif_broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE,SELF);
 					clif_broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE,SELF);
 				}
 				}
 
 
@@ -1833,7 +1833,7 @@ void npc_shop_currency_type(struct map_session_data *sd, struct npc_data *nd, in
  * @param points: Cost of total items
  * @param points: Cost of total items
  * @return clif_cashshop_ack value to display
  * @return clif_cashshop_ack value to display
  */
  */
-int npc_cashshop_buy(struct map_session_data *sd, unsigned short nameid, int amount, int points)
+int npc_cashshop_buy(struct map_session_data *sd, t_itemid nameid, int amount, int points)
 {
 {
 	struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
 	struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
 	struct item_data *item;
 	struct item_data *item;
@@ -1865,7 +1865,7 @@ int npc_cashshop_buy(struct map_session_data *sd, unsigned short nameid, int amo
 
 
 	if(!itemdb_isstackable2(item) && amount > 1)
 	if(!itemdb_isstackable2(item) && amount > 1)
 	{
 	{
-		ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %hu!\n",
+		ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %u!\n",
 			sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
 			sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
 		amount = 1;
 		amount = 1;
 	}
 	}
@@ -1886,7 +1886,7 @@ int npc_cashshop_buy(struct map_session_data *sd, unsigned short nameid, int amo
 
 
 	if( (double)nd->u.shop.shop_item[i].value * amount > INT_MAX )
 	if( (double)nd->u.shop.shop_item[i].value * amount > INT_MAX )
 	{
 	{
-		ShowWarning("npc_cashshop_buy: Item '%s' (%hu) price overflow attempt!\n", item->name, nameid);
+		ShowWarning("npc_cashshop_buy: Item '%s' (%u) price overflow attempt!\n", item->name, nameid);
 		ShowDebug("(NPC:'%s' (%s,%d,%d), player:'%s' (%d/%d), value:%d, amount:%d)\n",
 		ShowDebug("(NPC:'%s' (%s,%d,%d), player:'%s' (%d/%d), value:%d, amount:%d)\n",
 					nd->exname, map_mapid2mapname(nd->bl.m), nd->bl.x, nd->bl.y, sd->status.name, sd->status.account_id, sd->status.char_id, nd->u.shop.shop_item[i].value, amount);
 					nd->exname, map_mapid2mapname(nd->bl.m), nd->bl.x, nd->bl.y, sd->status.name, sd->status.account_id, sd->status.char_id, nd->u.shop.shop_item[i].value, amount);
 		return ERROR_TYPE_ITEM_ID;
 		return ERROR_TYPE_ITEM_ID;
@@ -1979,7 +1979,8 @@ uint8 npc_buylist(struct map_session_data* sd, uint16 n, struct s_npc_buy_list *
 	memset(market_index, 0, sizeof(market_index));
 	memset(market_index, 0, sizeof(market_index));
 	// process entries in buy list, one by one
 	// process entries in buy list, one by one
 	for( i = 0; i < n; ++i ) {
 	for( i = 0; i < n; ++i ) {
-		unsigned short nameid, amount;
+		t_itemid nameid;
+		unsigned short amount;
 		int value;
 		int value;
 		item_data *id;
 		item_data *id;
 
 
@@ -2009,7 +2010,7 @@ uint8 npc_buylist(struct map_session_data* sd, uint16 n, struct s_npc_buy_list *
 			return 3; // item no longer in itemdb
 			return 3; // item no longer in itemdb
 
 
 		if( !itemdb_isstackable2(id) && amount > 1 ) { //Exploit? You can't buy more than 1 of equipment types o.O
 		if( !itemdb_isstackable2(id) && amount > 1 ) { //Exploit? You can't buy more than 1 of equipment types o.O
-			ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %hu!\n",
+			ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %u!\n",
 				sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
 				sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
 			amount = item_list[i].qty = 1;
 			amount = item_list[i].qty = 1;
 		}
 		}
@@ -2051,7 +2052,7 @@ uint8 npc_buylist(struct map_session_data* sd, uint16 n, struct s_npc_buy_list *
 	pc_payzeny(sd, (int)z, LOG_TYPE_NPC, NULL);
 	pc_payzeny(sd, (int)z, LOG_TYPE_NPC, NULL);
 
 
 	for( i = 0; i < n; ++i ) {
 	for( i = 0; i < n; ++i ) {
-		unsigned short nameid = item_list[i].nameid;
+		t_itemid nameid = item_list[i].nameid;
 		unsigned short amount = item_list[i].qty;
 		unsigned short amount = item_list[i].qty;
 
 
 #if PACKETVER >= 20131223
 #if PACKETVER >= 20131223
@@ -2201,7 +2202,7 @@ uint8 npc_selllist(struct map_session_data* sd, int n, unsigned short *item_list
 	// verify the sell list
 	// verify the sell list
 	for( i = 0; i < n; i++ )
 	for( i = 0; i < n; i++ )
 	{
 	{
-		unsigned short nameid;
+		t_itemid nameid;
 		int amount, idx, value;
 		int amount, idx, value;
 
 
 		idx    = item_list[i*2]-2;
 		idx    = item_list[i*2]-2;
@@ -2860,7 +2861,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 	int m, is_discount = 0;
 	int m, is_discount = 0;
 	uint16 dir;
 	uint16 dir;
 	short x, y;
 	short x, y;
-	unsigned short nameid = 0;
+	t_itemid nameid = 0;
 	struct npc_data *nd;
 	struct npc_data *nd;
 	enum npc_subtype type;
 	enum npc_subtype type;
 
 
@@ -2904,12 +2905,12 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 
 
 	switch(type) {
 	switch(type) {
 		case NPCTYPE_ITEMSHOP: {
 		case NPCTYPE_ITEMSHOP: {
-			if (sscanf(p,",%5hu:%11d,",&nameid,&is_discount) < 1) {
+			if (sscanf(p,",%u:%11d,",&nameid,&is_discount) < 1) {
 				ShowError("npc_parse_shop: Invalid item cost definition in file '%s', line '%d'. Ignoring the rest of the line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
 				ShowError("npc_parse_shop: Invalid item cost definition in file '%s', line '%d'. Ignoring the rest of the line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
 				return strchr(start,'\n'); // skip and continue
 				return strchr(start,'\n'); // skip and continue
 			}
 			}
 			if (itemdb_exists(nameid) == NULL) {
 			if (itemdb_exists(nameid) == NULL) {
-				ShowWarning("npc_parse_shop: Invalid item ID cost in file '%s', line '%d' (id '%hu').\n", filepath, strline(buffer,start-buffer), nameid);
+				ShowWarning("npc_parse_shop: Invalid item ID cost in file '%s', line '%d' (id '%u').\n", filepath, strline(buffer,start-buffer), nameid);
 				return strchr(start,'\n'); // skip and continue
 				return strchr(start,'\n'); // skip and continue
 			}
 			}
 			p = strchr(p+1,',');
 			p = strchr(p+1,',');
@@ -2964,7 +2965,8 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 	nd = npc_create_npc(m, x, y);
 	nd = npc_create_npc(m, x, y);
 	nd->u.shop.count = 0;
 	nd->u.shop.count = 0;
 	while ( p ) {
 	while ( p ) {
-		unsigned short nameid2, qty = 0;
+		t_itemid nameid2;
+		unsigned short qty = 0;
 		int value;
 		int value;
 		struct item_data* id;
 		struct item_data* id;
 		bool skip = false;
 		bool skip = false;
@@ -2974,14 +2976,14 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 		switch(type) {
 		switch(type) {
 			case NPCTYPE_MARKETSHOP:
 			case NPCTYPE_MARKETSHOP:
 #if PACKETVER >= 20131223
 #if PACKETVER >= 20131223
-				if (sscanf(p, ",%6hu:%11d:%6hu", &nameid2, &value, &qty) != 3) {
+				if (sscanf(p, ",%u:%11d:%6hu", &nameid2, &value, &qty) != 3) {
 					ShowError("npc_parse_shop: (MARKETSHOP) Invalid item definition in file '%s', line '%d'. Ignoring the rest of the line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer, start - buffer), w1, w2, w3, w4);
 					ShowError("npc_parse_shop: (MARKETSHOP) Invalid item definition in file '%s', line '%d'. Ignoring the rest of the line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer, start - buffer), w1, w2, w3, w4);
 					skip = true;
 					skip = true;
 				}
 				}
 #endif
 #endif
 				break;
 				break;
 			default:
 			default:
-				if (sscanf(p, ",%6hu:%11d", &nameid2, &value) != 2) {
+				if (sscanf(p, ",%u:%11d", &nameid2, &value) != 2) {
 					ShowError("npc_parse_shop: Invalid item definition in file '%s', line '%d'. Ignoring the rest of the line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer, start - buffer), w1, w2, w3, w4);
 					ShowError("npc_parse_shop: Invalid item definition in file '%s', line '%d'. Ignoring the rest of the line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer, start - buffer), w1, w2, w3, w4);
 					skip = true;
 					skip = true;
 				}
 				}
@@ -2992,7 +2994,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 			break;
 			break;
 
 
 		if( (id = itemdb_exists(nameid2)) == NULL ) {
 		if( (id = itemdb_exists(nameid2)) == NULL ) {
-			ShowWarning("npc_parse_shop: Invalid sell item in file '%s', line '%d' (id '%hu').\n", filepath, strline(buffer,start-buffer), nameid2);
+			ShowWarning("npc_parse_shop: Invalid sell item in file '%s', line '%d' (id '%u').\n", filepath, strline(buffer,start-buffer), nameid2);
 			p = strchr(p+1,',');
 			p = strchr(p+1,',');
 			continue;
 			continue;
 		}
 		}
@@ -3001,15 +3003,15 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 			else value = 0; // Cashshop doesn't have a "buy price" in the item_db
 			else value = 0; // Cashshop doesn't have a "buy price" in the item_db
 		}
 		}
 		if (value == 0 && (type == NPCTYPE_SHOP || type == NPCTYPE_MARKETSHOP)) { // NPC selling items for free!
 		if (value == 0 && (type == NPCTYPE_SHOP || type == NPCTYPE_MARKETSHOP)) { // NPC selling items for free!
-			ShowWarning("npc_parse_shop: Item %s [%hu] is being sold for FREE in file '%s', line '%d'.\n",
+			ShowWarning("npc_parse_shop: Item %s [%u] is being sold for FREE in file '%s', line '%d'.\n",
 				id->name, nameid2, filepath, strline(buffer,start-buffer));
 				id->name, nameid2, filepath, strline(buffer,start-buffer));
 		}
 		}
 		if( type == NPCTYPE_SHOP && value*0.75 < id->value_sell*1.24 ) { // Exploit possible: you can buy and sell back with profit
 		if( type == NPCTYPE_SHOP && value*0.75 < id->value_sell*1.24 ) { // Exploit possible: you can buy and sell back with profit
-			ShowWarning("npc_parse_shop: Item %s [%hu] discounted buying price (%d->%d) is less than overcharged selling price (%d->%d) at file '%s', line '%d'.\n",
+			ShowWarning("npc_parse_shop: Item %s [%u] discounted buying price (%d->%d) is less than overcharged selling price (%d->%d) at file '%s', line '%d'.\n",
 				id->name, nameid2, value, (int)(value*0.75), id->value_sell, (int)(id->value_sell*1.24), filepath, strline(buffer,start-buffer));
 				id->name, nameid2, value, (int)(value*0.75), id->value_sell, (int)(id->value_sell*1.24), filepath, strline(buffer,start-buffer));
 		}
 		}
 		if (type == NPCTYPE_MARKETSHOP && (!qty || qty > UINT16_MAX)) {
 		if (type == NPCTYPE_MARKETSHOP && (!qty || qty > UINT16_MAX)) {
-			ShowWarning("npc_parse_shop: Item %s [%hu] is stocked with invalid value %d, changed to 1. File '%s', line '%d'.\n",
+			ShowWarning("npc_parse_shop: Item %s [%u] is stocked with invalid value %d, changed to 1. File '%s', line '%d'.\n",
 				id->name, nameid2, qty, filepath, strline(buffer,start-buffer));
 				id->name, nameid2, qty, filepath, strline(buffer,start-buffer));
 			qty = 1;
 			qty = 1;
 		}
 		}
@@ -3625,7 +3627,7 @@ int npc_instancedestroy(struct npc_data* nd)
  **/
  **/
 void npc_market_tosql(const char *exname, struct npc_item_list *list) {
 void npc_market_tosql(const char *exname, struct npc_item_list *list) {
 	SqlStmt* stmt = SqlStmt_Malloc(mmysql_handle);
 	SqlStmt* stmt = SqlStmt_Malloc(mmysql_handle);
-	if (SQL_ERROR == SqlStmt_Prepare(stmt, "REPLACE INTO `%s` (`name`,`nameid`,`price`,`amount`,`flag`) VALUES ('%s','%hu','%d','%hu','%" PRIu8 "')",
+	if (SQL_ERROR == SqlStmt_Prepare(stmt, "REPLACE INTO `%s` (`name`,`nameid`,`price`,`amount`,`flag`) VALUES ('%s','%u','%d','%hu','%" PRIu8 "')",
 		market_table, exname, list->nameid, list->value, list->qty, list->flag) ||
 		market_table, exname, list->nameid, list->value, list->qty, list->flag) ||
 		SQL_ERROR == SqlStmt_Execute(stmt))
 		SQL_ERROR == SqlStmt_Execute(stmt))
 		SqlStmt_ShowDebug(stmt);
 		SqlStmt_ShowDebug(stmt);
@@ -3638,14 +3640,14 @@ void npc_market_tosql(const char *exname, struct npc_item_list *list) {
  * @param nameid Item ID
  * @param nameid Item ID
  * @param clear True: will removes all records related with the NPC
  * @param clear True: will removes all records related with the NPC
  **/
  **/
-void npc_market_delfromsql_(const char *exname, unsigned short nameid, bool clear) {
+void npc_market_delfromsql_(const char *exname, t_itemid nameid, bool clear) {
 	SqlStmt* stmt = SqlStmt_Malloc(mmysql_handle);
 	SqlStmt* stmt = SqlStmt_Malloc(mmysql_handle);
 	if (clear) {
 	if (clear) {
 		if( SQL_ERROR == SqlStmt_Prepare(stmt, "DELETE FROM `%s` WHERE `name`='%s'", market_table, exname) ||
 		if( SQL_ERROR == SqlStmt_Prepare(stmt, "DELETE FROM `%s` WHERE `name`='%s'", market_table, exname) ||
 			SQL_ERROR == SqlStmt_Execute(stmt))
 			SQL_ERROR == SqlStmt_Execute(stmt))
 			SqlStmt_ShowDebug(stmt);
 			SqlStmt_ShowDebug(stmt);
 	} else {
 	} else {
-		if (SQL_ERROR == SqlStmt_Prepare(stmt, "DELETE FROM `%s` WHERE `name`='%s' AND `nameid`='%d' LIMIT 1", market_table, exname, nameid) ||
+		if (SQL_ERROR == SqlStmt_Prepare(stmt, "DELETE FROM `%s` WHERE `name`='%s' AND `nameid`='%u' LIMIT 1", market_table, exname, nameid) ||
 			SQL_ERROR == SqlStmt_Execute(stmt))
 			SQL_ERROR == SqlStmt_Execute(stmt))
 			SqlStmt_ShowDebug(stmt);
 			SqlStmt_ShowDebug(stmt);
 	}
 	}
@@ -3683,7 +3685,7 @@ static int npc_market_checkall_sub(DBKey key, DBData *data, va_list ap) {
 		uint16 j;
 		uint16 j;
 
 
 		if (!list->nameid || !itemdb_exists(list->nameid)) {
 		if (!list->nameid || !itemdb_exists(list->nameid)) {
-			ShowError("npc_market_checkall_sub: NPC '%s' sells invalid item '%hu', deleting...\n", nd->exname, list->nameid);
+			ShowError("npc_market_checkall_sub: NPC '%s' sells invalid item '%u', deleting...\n", nd->exname, list->nameid);
 			npc_market_delfromsql(nd->exname, list->nameid);
 			npc_market_delfromsql(nd->exname, list->nameid);
 			continue;
 			continue;
 		}
 		}
@@ -3708,7 +3710,7 @@ static int npc_market_checkall_sub(DBKey key, DBData *data, va_list ap) {
 			npc_market_tosql(nd->exname, &nd->u.shop.shop_item[j]);
 			npc_market_tosql(nd->exname, &nd->u.shop.shop_item[j]);
 		}
 		}
 		else { // Removing "out-of-date" entry
 		else { // Removing "out-of-date" entry
-			ShowError("npc_market_checkall_sub: NPC '%s' does not sell item %hu (qty %hu), deleting...\n", nd->exname, list->nameid, list->qty);
+			ShowError("npc_market_checkall_sub: NPC '%s' does not sell item %u (qty %hu), deleting...\n", nd->exname, list->nameid, list->qty);
 			npc_market_delfromsql(nd->exname, list->nameid);
 			npc_market_delfromsql(nd->exname, list->nameid);
 		}
 		}
 	}
 	}
@@ -3771,7 +3773,7 @@ static void npc_market_fromsql(void) {
 			strdb_put(NPCMarketDB, market->exname, market);
 			strdb_put(NPCMarketDB, market->exname, market);
 		}
 		}
 
 
-		Sql_GetData(mmysql_handle, 1, &data, NULL); list.nameid = atoi(data);
+		Sql_GetData(mmysql_handle, 1, &data, NULL); list.nameid = strtoul(data, nullptr, 10);
 		Sql_GetData(mmysql_handle, 2, &data, NULL); list.value = atoi(data);
 		Sql_GetData(mmysql_handle, 2, &data, NULL); list.value = atoi(data);
 		Sql_GetData(mmysql_handle, 3, &data, NULL); list.qty = atoi(data);
 		Sql_GetData(mmysql_handle, 3, &data, NULL); list.qty = atoi(data);
 		Sql_GetData(mmysql_handle, 4, &data, NULL); list.flag = atoi(data);
 		Sql_GetData(mmysql_handle, 4, &data, NULL); list.flag = atoi(data);
@@ -4250,7 +4252,7 @@ static const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, con
 
 
 				if (!strcmpi(drop_arg1, "random"))
 				if (!strcmpi(drop_arg1, "random"))
 					args.nightmaredrop.drop_id = -1;
 					args.nightmaredrop.drop_id = -1;
-				else if (itemdb_exists((args.nightmaredrop.drop_id = atoi(drop_arg1))) == NULL) {
+				else if (itemdb_exists((args.nightmaredrop.drop_id = strtol(drop_arg1, nullptr, 10))) == NULL) {
 					args.nightmaredrop.drop_id = 0;
 					args.nightmaredrop.drop_id = 0;
 					ShowWarning("npc_parse_mapflag: Invalid item ID '%d' supplied for mapflag 'pvp_nightmaredrop' (file '%s', line '%d'), removing.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", args.nightmaredrop.drop_id, filepath, strline(buffer, start - buffer), w1, w2, w3, w4);
 					ShowWarning("npc_parse_mapflag: Invalid item ID '%d' supplied for mapflag 'pvp_nightmaredrop' (file '%s', line '%d'), removing.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", args.nightmaredrop.drop_id, filepath, strline(buffer, start - buffer), w1, w2, w3, w4);
 					break;
 					break;

+ 4 - 4
src/map/npc.hpp

@@ -25,7 +25,7 @@ struct npc_label_list {
 
 
 /// Item list for NPC sell/buy list
 /// Item list for NPC sell/buy list
 struct npc_item_list {
 struct npc_item_list {
-	unsigned short nameid;
+	t_itemid nameid;
 	unsigned int value;
 	unsigned int value;
 #if PACKETVER >= 20131223
 #if PACKETVER >= 20131223
 	unsigned short qty; ///< Stock counter (Market shop)
 	unsigned short qty; ///< Stock counter (Market shop)
@@ -92,7 +92,7 @@ struct npc_data {
 		struct {
 		struct {
 			struct npc_item_list *shop_item;
 			struct npc_item_list *shop_item;
 			uint16 count;
 			uint16 count;
-			unsigned short itemshop_nameid; // Item Shop cost item ID
+			t_itemid itemshop_nameid; // Item Shop cost item ID
 			char pointshop_str[32]; // Point Shop cost variable name
 			char pointshop_str[32]; // Point Shop cost variable name
 			bool discount;
 			bool discount;
 		} shop;
 		} shop;
@@ -1287,7 +1287,7 @@ int npc_script_event(struct map_session_data* sd, enum npce_event type);
 int npc_duplicate4instance(struct npc_data *snd, int16 m);
 int npc_duplicate4instance(struct npc_data *snd, int16 m);
 int npc_instanceinit(struct npc_data* nd);
 int npc_instanceinit(struct npc_data* nd);
 int npc_instancedestroy(struct npc_data* nd);
 int npc_instancedestroy(struct npc_data* nd);
-int npc_cashshop_buy(struct map_session_data *sd, unsigned short nameid, int amount, int points);
+int npc_cashshop_buy(struct map_session_data *sd, t_itemid nameid, int amount, int points);
 
 
 void npc_shop_currency_type(struct map_session_data *sd, struct npc_data *nd, int cost[2], bool display);
 void npc_shop_currency_type(struct map_session_data *sd, struct npc_data *nd, int cost[2], bool display);
 
 
@@ -1298,7 +1298,7 @@ bool npc_shop_discount(struct npc_data* nd);
 
 
 #if PACKETVER >= 20131223
 #if PACKETVER >= 20131223
 void npc_market_tosql(const char *exname, struct npc_item_list *list);
 void npc_market_tosql(const char *exname, struct npc_item_list *list);
-void npc_market_delfromsql_(const char *exname, unsigned short nameid, bool clear);
+void npc_market_delfromsql_(const char *exname, t_itemid nameid, bool clear);
 #endif
 #endif
 
 
 #ifdef SECURE_NPCTIMEOUT
 #ifdef SECURE_NPCTIMEOUT

+ 11 - 0
src/map/packets.hpp

@@ -164,10 +164,20 @@ struct PACKET_ZC_ACK_GUILDSTORAGE_LOG{
 	#pragma pack( pop )
 	#pragma pack( pop )
 #endif
 #endif
 
 
+DEFINE_PACKET_HEADER(ZC_ITEM_ENTRY, 0x9d)
+DEFINE_PACKET_HEADER(ZC_MVP_GETTING_ITEM, 0x10a)
+DEFINE_PACKET_HEADER(ZC_ACK_TOUSESKILL, 0x110)
 DEFINE_PACKET_HEADER(CZ_REQMAKINGITEM, 0x18e)
 DEFINE_PACKET_HEADER(CZ_REQMAKINGITEM, 0x18e)
+DEFINE_PACKET_HEADER(ZC_ACK_REQMAKINGITEM, 0x18f)
 DEFINE_PACKET_HEADER(CZ_REQ_MAKINGARROW, 0x1ae)
 DEFINE_PACKET_HEADER(CZ_REQ_MAKINGARROW, 0x1ae)
 DEFINE_PACKET_HEADER(CZ_REQ_ITEMREPAIR, 0x1fd)
 DEFINE_PACKET_HEADER(CZ_REQ_ITEMREPAIR, 0x1fd)
+DEFINE_PACKET_HEADER(ZC_ACK_WEAPONREFINE, 0x223)
 DEFINE_PACKET_HEADER(CZ_REQ_MAKINGITEM, 0x25b)
 DEFINE_PACKET_HEADER(CZ_REQ_MAKINGITEM, 0x25b)
+DEFINE_PACKET_HEADER(ZC_CASH_TIME_COUNTER, 0x298)
+DEFINE_PACKET_HEADER(ZC_CASH_ITEM_DELETE, 0x299)
+DEFINE_PACKET_HEADER(ZC_ITEM_PICKUP_PARTY, 0x2b8)
+DEFINE_PACKET_HEADER(ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER, 0x824)
+DEFINE_PACKET_HEADER(CZ_SSILIST_ITEM_CLICK, 0x83c)
 DEFINE_PACKET_HEADER(CZ_REQ_CASH_BARGAIN_SALE_ITEM_INFO, 0x9ac)
 DEFINE_PACKET_HEADER(CZ_REQ_CASH_BARGAIN_SALE_ITEM_INFO, 0x9ac)
 DEFINE_PACKET_HEADER(ZC_ACK_CASH_BARGAIN_SALE_ITEM_INFO, 0x9ad)
 DEFINE_PACKET_HEADER(ZC_ACK_CASH_BARGAIN_SALE_ITEM_INFO, 0x9ad)
 DEFINE_PACKET_HEADER(CZ_REQ_APPLY_BARGAIN_SALE_ITEM, 0x9ae)
 DEFINE_PACKET_HEADER(CZ_REQ_APPLY_BARGAIN_SALE_ITEM, 0x9ae)
@@ -176,6 +186,7 @@ DEFINE_PACKET_HEADER(ZC_NOTIFY_BARGAIN_SALE_SELLING, 0x9b2)
 DEFINE_PACKET_HEADER(ZC_NOTIFY_BARGAIN_SALE_CLOSE, 0x9b3)
 DEFINE_PACKET_HEADER(ZC_NOTIFY_BARGAIN_SALE_CLOSE, 0x9b3)
 DEFINE_PACKET_HEADER(ZC_ACK_COUNT_BARGAIN_SALE_ITEM, 0x9c4)
 DEFINE_PACKET_HEADER(ZC_ACK_COUNT_BARGAIN_SALE_ITEM, 0x9c4)
 DEFINE_PACKET_HEADER(ZC_ACK_GUILDSTORAGE_LOG, 0x9da)
 DEFINE_PACKET_HEADER(ZC_ACK_GUILDSTORAGE_LOG, 0x9da)
+DEFINE_PACKET_HEADER(CZ_NPC_MARKET_PURCHASE, 0x9d6)
 DEFINE_PACKET_HEADER(CZ_REQ_APPLY_BARGAIN_SALE_ITEM2, 0xa3d)
 DEFINE_PACKET_HEADER(CZ_REQ_APPLY_BARGAIN_SALE_ITEM2, 0xa3d)
 
 
 const int16 MAX_INVENTORY_ITEM_PACKET_NORMAL = ( ( INT16_MAX - ( sizeof( struct packet_itemlist_normal ) - ( sizeof( struct NORMALITEM_INFO ) * MAX_ITEMLIST) ) ) / sizeof( struct NORMALITEM_INFO ) );
 const int16 MAX_INVENTORY_ITEM_PACKET_NORMAL = ( ( INT16_MAX - ( sizeof( struct packet_itemlist_normal ) - ( sizeof( struct NORMALITEM_INFO ) * MAX_ITEMLIST) ) ) / sizeof( struct NORMALITEM_INFO ) );

+ 53 - 48
src/map/pc.cpp

@@ -202,14 +202,14 @@ uint64 AttendanceDatabase::parseBodyNode(const YAML::Node &node){
 			}
 			}
 
 
 			if( this->nodeExists( rewardNode, "ItemId" ) ){
 			if( this->nodeExists( rewardNode, "ItemId" ) ){
-				uint16 item_id;
+				t_itemid item_id;
 
 
-				if( !this->asUInt16( rewardNode, "ItemId", item_id ) ){
+				if( !this->asUInt32( rewardNode, "ItemId", item_id ) ){
 					continue;
 					continue;
 				}
 				}
 
 
 				if( item_id == 0 || !itemdb_exists( item_id ) ){
 				if( item_id == 0 || !itemdb_exists( item_id ) ){
-					ShowError( "pc_attendance_load: Unknown item ID %hu for day %d.\n", item_id, day + 1 );
+					ShowError( "pc_attendance_load: Unknown item ID %u for day %d.\n", item_id, day + 1 );
 					continue;
 					continue;
 				}
 				}
 
 
@@ -319,7 +319,7 @@ void pc_set_reg_load( bool val ){
 DBMap* itemcd_db = NULL; // char_id -> struct item_cd
 DBMap* itemcd_db = NULL; // char_id -> struct item_cd
 struct item_cd {
 struct item_cd {
 	t_tick tick[MAX_ITEMDELAYS]; //tick
 	t_tick tick[MAX_ITEMDELAYS]; //tick
-	unsigned short nameid[MAX_ITEMDELAYS]; //item id
+	t_itemid nameid[MAX_ITEMDELAYS]; //item id
 };
 };
 
 
 /**
 /**
@@ -1007,7 +1007,7 @@ void pc_setinventorydata(struct map_session_data *sd)
 	nullpo_retv(sd);
 	nullpo_retv(sd);
 
 
 	for(i = 0; i < MAX_INVENTORY; i++) {
 	for(i = 0; i < MAX_INVENTORY; i++) {
-		unsigned short id = sd->inventory.u.items_inventory[i].nameid;
+		t_itemid id = sd->inventory.u.items_inventory[i].nameid;
 		sd->inventory_data[i] = id?itemdb_search(id):NULL;
 		sd->inventory_data[i] = id?itemdb_search(id):NULL;
 	}
 	}
 }
 }
@@ -1074,7 +1074,7 @@ void pc_setequipindex(struct map_session_data *sd)
 	}
 	}
 
 
 	for (i = 0; i < MAX_INVENTORY; i++) {
 	for (i = 0; i < MAX_INVENTORY; i++) {
-		if (sd->inventory.u.items_inventory[i].nameid <= 0)
+		if (sd->inventory.u.items_inventory[i].nameid == 0)
 			continue;
 			continue;
 		if (sd->inventory.u.items_inventory[i].equip) {
 		if (sd->inventory.u.items_inventory[i].equip) {
 			uint8 j;
 			uint8 j;
@@ -1133,7 +1133,7 @@ void pc_setequipindex(struct map_session_data *sd)
  * @param nameid : itemid
  * @param nameid : itemid
  * @return 1:yes, 0:no
  * @return 1:yes, 0:no
  */
  */
-bool pc_isequipped(struct map_session_data *sd, unsigned short nameid)
+bool pc_isequipped(struct map_session_data *sd, t_itemid nameid)
 {
 {
 	uint8 i;
 	uint8 i;
 
 
@@ -2586,14 +2586,14 @@ static void pc_bonus_addeff_onskill(std::vector<s_addeffectonskill> &effect, enu
  * @param race: target race. if < 0, means monster_id
  * @param race: target race. if < 0, means monster_id
  * @param rate: rate value: 1 ~ 10000. If < 0, it will be multiplied with mob level/10
  * @param rate: rate value: 1 ~ 10000. If < 0, it will be multiplied with mob level/10
  */
  */
-static void pc_bonus_item_drop(std::vector<s_add_drop> &drop, unsigned short nameid, uint16 group, int class_, short race, int rate)
+static void pc_bonus_item_drop(std::vector<s_add_drop> &drop, t_itemid nameid, uint16 group, int class_, short race, int rate)
 {
 {
 	if (!nameid && !group) {
 	if (!nameid && !group) {
 		ShowWarning("pc_bonus_item_drop: No Item ID nor Item Group ID specified.\n");
 		ShowWarning("pc_bonus_item_drop: No Item ID nor Item Group ID specified.\n");
 		return;
 		return;
 	}
 	}
 	if (nameid && !itemdb_exists(nameid)) {
 	if (nameid && !itemdb_exists(nameid)) {
-		ShowWarning("pc_bonus_item_drop: Invalid item id %hu\n",nameid);
+		ShowWarning("pc_bonus_item_drop: Invalid item id %u\n",nameid);
 		return;
 		return;
 	}
 	}
 	if (group && !itemdb_group_exists(group)) {
 	if (group && !itemdb_group_exists(group)) {
@@ -2602,7 +2602,7 @@ static void pc_bonus_item_drop(std::vector<s_add_drop> &drop, unsigned short nam
 	}
 	}
 
 
 	if (drop.size() == MAX_PC_BONUS) {
 	if (drop.size() == MAX_PC_BONUS) {
-		ShowWarning("pc_bonus_item_drop: Reached max (%d) number of added drops per character! (nameid: %hu group: %d class_: %d race: %d rate: %d)\n", MAX_PC_BONUS, nameid, group, class_, race, rate);
+		ShowWarning("pc_bonus_item_drop: Reached max (%d) number of added drops per character! (nameid: %u group: %d class_: %d race: %d rate: %d)\n", MAX_PC_BONUS, nameid, group, class_, race, rate);
 		return;
 		return;
 	}
 	}
 
 
@@ -3652,10 +3652,10 @@ void pc_bonus(struct map_session_data *sd,int type,int val)
 			break;
 			break;
 		default:
 		default:
 			if (current_equip_combo_pos > 0) {
 			if (current_equip_combo_pos > 0) {
-				ShowWarning("pc_bonus: unknown bonus type %d %d in a combo with item #%d\n", type, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
+				ShowWarning("pc_bonus: unknown bonus type %d %d in a combo with item #%u\n", type, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
 			}
 			}
 			else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
 			else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
-				ShowWarning("pc_bonus: unknown bonus type %d %d in item #%d\n", type, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
+				ShowWarning("pc_bonus: unknown bonus type %d %d in item #%u\n", type, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
 			}
 			}
 			else {
 			else {
 				ShowWarning("pc_bonus: unknown bonus type %d %d in unknown usage. Report this!\n", type, val);
 				ShowWarning("pc_bonus: unknown bonus type %d %d in unknown usage. Report this!\n", type, val);
@@ -4245,10 +4245,10 @@ void pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
 		break;
 		break;
 	default:
 	default:
 		if (current_equip_combo_pos > 0) {
 		if (current_equip_combo_pos > 0) {
-			ShowWarning("pc_bonus2: unknown bonus type %d %d %d in a combo with item #%d\n", type, type2, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
+			ShowWarning("pc_bonus2: unknown bonus type %d %d %d in a combo with item #%u\n", type, type2, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
 		} 
 		} 
 		else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
 		else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
-			ShowWarning("pc_bonus2: unknown bonus type %d %d %d in item #%d\n", type, type2, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
+			ShowWarning("pc_bonus2: unknown bonus type %d %d %d in item #%u\n", type, type2, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
 		}
 		}
 		else {
 		else {
 			ShowWarning("pc_bonus2: unknown bonus type %d %d %d in unknown usage. Report this!\n", type, type2, val);
 			ShowWarning("pc_bonus2: unknown bonus type %d %d %d in unknown usage. Report this!\n", type, type2, val);
@@ -4385,10 +4385,10 @@ void pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
 		break;
 		break;
 	default:
 	default:
 		if (current_equip_combo_pos > 0) {
 		if (current_equip_combo_pos > 0) {
-			ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in a combo with item #%d\n", type, type2, type3, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
+			ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in a combo with item #%u\n", type, type2, type3, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
 		}
 		}
 		else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
 		else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
-			ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in item #%d\n", type, type2, type3, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
+			ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in item #%u\n", type, type2, type3, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
 		}
 		}
 		else {
 		else {
 			ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in unknown usage. Report this!\n", type, type2, type3, val);
 			ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in unknown usage. Report this!\n", type, type2, type3, val);
@@ -4468,10 +4468,10 @@ void pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type
 
 
 	default:
 	default:
 		if (current_equip_combo_pos > 0) {
 		if (current_equip_combo_pos > 0) {
-			ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in a combo with item #%d\n", type, type2, type3, type4, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
+			ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in a combo with item #%u\n", type, type2, type3, type4, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
 		}
 		}
 		else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
 		else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
-			ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in item #%d\n", type, type2, type3, type4, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
+			ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in item #%u\n", type, type2, type3, type4, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
 		}
 		}
 		else {
 		else {
 			ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in unknown usage. Report this!\n", type, type2, type3, type4, val);
 			ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in unknown usage. Report this!\n", type, type2, type3, type4, val);
@@ -4517,10 +4517,10 @@ void pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type
 
 
 	default:
 	default:
 		if (current_equip_combo_pos > 0) {
 		if (current_equip_combo_pos > 0) {
-			ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in a combo with item #%d\n", type, type2, type3, type4, type5, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
+			ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in a combo with item #%u\n", type, type2, type3, type4, type5, val, sd->inventory_data[pc_checkequip( sd, current_equip_combo_pos )]->nameid);
 		}
 		}
 		else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
 		else if (current_equip_card_id > 0 || current_equip_item_index > 0) {
-			ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in item #%d\n", type, type2, type3, type4, type5, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
+			ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in item #%u\n", type, type2, type3, type4, type5, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid);
 		}
 		}
 		else {
 		else {
 			ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in unknown usage. Report this!\n", type, type2, type3, type4, type5, val);
 			ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in unknown usage. Report this!\n", type, type2, type3, type4, type5, val);
@@ -4624,7 +4624,7 @@ int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip)
 	}
 	}
 
 
 	int i;
 	int i;
-	unsigned short nameid;
+	t_itemid nameid;
 	struct item_data* item_eq = sd->inventory_data[idx_equip];
 	struct item_data* item_eq = sd->inventory_data[idx_equip];
 	struct item_data* item_card = sd->inventory_data[idx_card];
 	struct item_data* item_card = sd->inventory_data[idx_card];
 
 
@@ -4632,9 +4632,9 @@ int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip)
 		return 0; //Invalid item index.
 		return 0; //Invalid item index.
 	if(item_card == nullptr)
 	if(item_card == nullptr)
 		return 0; //Invalid card index.
 		return 0; //Invalid card index.
-	if( sd->inventory.u.items_inventory[idx_equip].nameid <= 0 || sd->inventory.u.items_inventory[idx_equip].amount < 1 )
+	if( sd->inventory.u.items_inventory[idx_equip].nameid == 0 || sd->inventory.u.items_inventory[idx_equip].amount < 1 )
 		return 0; // target item missing
 		return 0; // target item missing
-	if( sd->inventory.u.items_inventory[idx_card].nameid <= 0 || sd->inventory.u.items_inventory[idx_card].amount < 1 )
+	if( sd->inventory.u.items_inventory[idx_card].nameid == 0 || sd->inventory.u.items_inventory[idx_card].amount < 1 )
 		return 0; // target card missing
 		return 0; // target card missing
 	if( item_eq->type != IT_WEAPON && item_eq->type != IT_ARMOR )
 	if( item_eq->type != IT_WEAPON && item_eq->type != IT_ARMOR )
 		return 0; // only weapons and armor are allowed
 		return 0; // only weapons and armor are allowed
@@ -4745,7 +4745,7 @@ int pc_modifysellvalue(struct map_session_data *sd,int orig_value)
  * @param amount
  * @param amount
  * @return e_chkitem_result
  * @return e_chkitem_result
  *------------------------------------------*/
  *------------------------------------------*/
-char pc_checkadditem(struct map_session_data *sd, unsigned short nameid, int amount)
+char pc_checkadditem(struct map_session_data *sd, t_itemid nameid, int amount)
 {
 {
 	int i;
 	int i;
 	struct item_data* data;
 	struct item_data* data;
@@ -4981,7 +4981,7 @@ int pc_getcash(struct map_session_data *sd, int cash, int points, e_log_pick_typ
  * @param nameid Find this Item!
  * @param nameid Find this Item!
  * @return Stored index in inventory, or -1 if not found.
  * @return Stored index in inventory, or -1 if not found.
  **/
  **/
-short pc_search_inventory(struct map_session_data *sd, unsigned short nameid) {
+short pc_search_inventory(struct map_session_data *sd, t_itemid nameid) {
 	short i;
 	short i;
 	nullpo_retr(-1, sd);
 	nullpo_retr(-1, sd);
 
 
@@ -5154,7 +5154,7 @@ bool pc_dropitem(struct map_session_data *sd,int n,int amount)
 	if(amount <= 0)
 	if(amount <= 0)
 		return false;
 		return false;
 
 
-	if(sd->inventory.u.items_inventory[n].nameid <= 0 ||
+	if(sd->inventory.u.items_inventory[n].nameid == 0 ||
 		sd->inventory.u.items_inventory[n].amount <= 0 ||
 		sd->inventory.u.items_inventory[n].amount <= 0 ||
 		sd->inventory.u.items_inventory[n].amount < amount ||
 		sd->inventory.u.items_inventory[n].amount < amount ||
 		sd->state.trading || sd->state.vending ||
 		sd->state.trading || sd->state.vending ||
@@ -5269,7 +5269,7 @@ bool pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
 bool pc_isUseitem(struct map_session_data *sd,int n)
 bool pc_isUseitem(struct map_session_data *sd,int n)
 {
 {
 	struct item_data *item;
 	struct item_data *item;
-	unsigned short nameid;
+	t_itemid nameid;
 
 
 	nullpo_ret(sd);
 	nullpo_ret(sd);
 
 
@@ -5442,7 +5442,7 @@ int pc_useitem(struct map_session_data *sd,int n)
 {
 {
 	t_tick tick = gettick();
 	t_tick tick = gettick();
 	int amount;
 	int amount;
-	unsigned short nameid;
+	t_itemid nameid;
 	struct script_code *script;
 	struct script_code *script;
 	struct item item;
 	struct item item;
 	struct item_data *id;
 	struct item_data *id;
@@ -5748,7 +5748,7 @@ int pc_bound_chk(TBL_PC *sd,enum bound_type type,int *idxlist)
 int pc_show_steal(struct block_list *bl,va_list ap)
 int pc_show_steal(struct block_list *bl,va_list ap)
 {
 {
 	struct map_session_data *sd;
 	struct map_session_data *sd;
-	int itemid;
+	t_itemid itemid;
 
 
 	struct item_data *item=NULL;
 	struct item_data *item=NULL;
 	char output[100];
 	char output[100];
@@ -5757,7 +5757,7 @@ int pc_show_steal(struct block_list *bl,va_list ap)
 	itemid=va_arg(ap,int);
 	itemid=va_arg(ap,int);
 
 
 	if((item=itemdb_exists(itemid))==NULL)
 	if((item=itemdb_exists(itemid))==NULL)
-		sprintf(output,"%s stole an Unknown Item (id: %i).",sd->status.name, itemid);
+		sprintf(output,"%s stole an Unknown Item (id: %u).",sd->status.name, itemid);
 	else
 	else
 		sprintf(output,"%s stole %s.",sd->status.name,item->jname);
 		sprintf(output,"%s stole %s.",sd->status.name,item->jname);
 	clif_displaymessage( ((struct map_session_data *)bl)->fd, output);
 	clif_displaymessage( ((struct map_session_data *)bl)->fd, output);
@@ -5774,7 +5774,8 @@ int pc_show_steal(struct block_list *bl,va_list ap)
  */
  */
 bool pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skill_lv)
 bool pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skill_lv)
 {
 {
-	int i,itemid;
+	int i;
+	t_itemid itemid;
 	double rate;
 	double rate;
 	unsigned char flag = 0;
 	unsigned char flag = 0;
 	struct status_data *sd_status, *md_status;
 	struct status_data *sd_status, *md_status;
@@ -5927,6 +5928,7 @@ enum e_setpos pc_setpos(struct map_session_data* sd, unsigned short mapindex, in
 	sd->state.changemap = (sd->mapindex != mapindex);
 	sd->state.changemap = (sd->mapindex != mapindex);
 	sd->state.warping = 1;
 	sd->state.warping = 1;
 	sd->state.workinprogress = WIP_DISABLE_NONE;
 	sd->state.workinprogress = WIP_DISABLE_NONE;
+	sd->state.mail_writing = false;
 
 
 	if( sd->state.changemap ) { // Misc map-changing settings
 	if( sd->state.changemap ) { // Misc map-changing settings
 		int curr_map_instance_id = map_getmapdata(sd->bl.m)->instance_id, new_map_instance_id = (mapdata ? mapdata->instance_id : 0);
 		int curr_map_instance_id = map_getmapdata(sd->bl.m)->instance_id, new_map_instance_id = (mapdata ? mapdata->instance_id : 0);
@@ -6383,7 +6385,7 @@ short pc_checkequip(struct map_session_data *sd,int pos, bool checkall)
  * @max : see pc.hpp enum equip_index for @min to ?
  * @max : see pc.hpp enum equip_index for @min to ?
  * -return true,false
  * -return true,false
  *------------------------------------------*/
  *------------------------------------------*/
-bool pc_checkequip2(struct map_session_data *sd, unsigned short nameid, int min, int max)
+bool pc_checkequip2(struct map_session_data *sd, t_itemid nameid, int min, int max)
 {
 {
 	int i;
 	int i;
 
 
@@ -9062,7 +9064,7 @@ void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int ty
  * @param sp: SP to heal
  * @param sp: SP to heal
  * @return Amount healed to an object
  * @return Amount healed to an object
  */
  */
-int pc_itemheal(struct map_session_data *sd, int itemid, int hp, int sp)
+int pc_itemheal(struct map_session_data *sd, t_itemid itemid, int hp, int sp)
 {
 {
 	int bonus, tmp, penalty = 0;
 	int bonus, tmp, penalty = 0;
 
 
@@ -10200,8 +10202,8 @@ static int pc_checkcombo(struct map_session_data *sd, struct item_data *data) {
 	for( i = 0; i < data->combos_count; i++ ) {
 	for( i = 0; i < data->combos_count; i++ ) {
 		struct itemchk {
 		struct itemchk {
 			int idx;
 			int idx;
-			unsigned short nameid;
-			short card[MAX_SLOTS];
+			t_itemid nameid;
+			t_itemid card[MAX_SLOTS];
 		} *combo_idx;
 		} *combo_idx;
 		int idx, j;
 		int idx, j;
 		int nb_itemCombo;
 		int nb_itemCombo;
@@ -10222,11 +10224,14 @@ static int pc_checkcombo(struct map_session_data *sd, struct item_data *data) {
 		for(j=0; j < nb_itemCombo; j++){
 		for(j=0; j < nb_itemCombo; j++){
 			combo_idx[j].idx=-1;
 			combo_idx[j].idx=-1;
 			combo_idx[j].nameid=-1;
 			combo_idx[j].nameid=-1;
-			memset(combo_idx[j].card,-1,MAX_SLOTS);
+			for( int k = 0; k < MAX_SLOTS; k++ ){
+				combo_idx[j].card[k] = -1;
+			}
 		}
 		}
 			
 			
 		for( j = 0; j < nb_itemCombo; j++ ) {
 		for( j = 0; j < nb_itemCombo; j++ ) {
-			uint16 id = data->combos[i]->nameid[j], k;
+			t_itemid id = data->combos[i]->nameid[j];
+			uint16 k;
 			bool found = false;
 			bool found = false;
 			
 			
 			for( k = 0; k < EQI_MAX; k++ ) {
 			for( k = 0; k < EQI_MAX; k++ ) {
@@ -10437,7 +10442,7 @@ bool pc_equipitem(struct map_session_data *sd,short n,int req_pos,bool equipswit
 	pos = pc_equippoint(sd,n); //With a few exceptions, item should go in all specified slots.
 	pos = pc_equippoint(sd,n); //With a few exceptions, item should go in all specified slots.
 
 
 	if(battle_config.battle_log && !equipswitch)
 	if(battle_config.battle_log && !equipswitch)
-		ShowInfo("equip %hu (%d) %x:%x\n",sd->inventory.u.items_inventory[n].nameid,n,id?id->equip:0,req_pos);
+		ShowInfo("equip %u (%d) %x:%x\n",sd->inventory.u.items_inventory[n].nameid,n,id?id->equip:0,req_pos);
 
 
 	if((res = pc_isequip(sd,n))) {
 	if((res = pc_isequip(sd,n))) {
 		if( equipswitch ){
 		if( equipswitch ){
@@ -11043,7 +11048,7 @@ void pc_checkitem(struct map_session_data *sd) {
 void pc_check_available_item(struct map_session_data *sd, uint8 type)
 void pc_check_available_item(struct map_session_data *sd, uint8 type)
 {
 {
 	int i;
 	int i;
-	unsigned short nameid;
+	t_itemid nameid;
 	char output[256];
 	char output[256];
 
 
 	nullpo_retv(sd);
 	nullpo_retv(sd);
@@ -11055,9 +11060,9 @@ void pc_check_available_item(struct map_session_data *sd, uint8 type)
 			if (!nameid)
 			if (!nameid)
 				continue;
 				continue;
 			if (!itemdb_available(nameid)) {
 			if (!itemdb_available(nameid)) {
-				sprintf(output, msg_txt(sd, 709), nameid); // Item %hu has been removed from your inventory.
+				sprintf(output, msg_txt(sd, 709), nameid); // Item %u has been removed from your inventory.
 				clif_displaymessage(sd->fd, output);
 				clif_displaymessage(sd->fd, output);
-				ShowWarning("Removed invalid/disabled item (ID: %hu, amount: %d) from inventory (char_id: %d).\n", nameid, sd->inventory.u.items_inventory[i].amount, sd->status.char_id);
+				ShowWarning("Removed invalid/disabled item (ID: %u, amount: %d) from inventory (char_id: %d).\n", nameid, sd->inventory.u.items_inventory[i].amount, sd->status.char_id);
 				pc_delitem(sd, i, sd->inventory.u.items_inventory[i].amount, 4, 0, LOG_TYPE_OTHER);
 				pc_delitem(sd, i, sd->inventory.u.items_inventory[i].amount, 4, 0, LOG_TYPE_OTHER);
 				continue;
 				continue;
 			}
 			}
@@ -11073,9 +11078,9 @@ void pc_check_available_item(struct map_session_data *sd, uint8 type)
 			if (!nameid)
 			if (!nameid)
 				continue;
 				continue;
 			if (!itemdb_available(nameid)) {
 			if (!itemdb_available(nameid)) {
-				sprintf(output, msg_txt(sd, 710), nameid); // Item %hu has been removed from your cart.
+				sprintf(output, msg_txt(sd, 710), nameid); // Item %u has been removed from your cart.
 				clif_displaymessage(sd->fd, output);
 				clif_displaymessage(sd->fd, output);
-				ShowWarning("Removed invalid/disabled item (ID: %hu, amount: %d) from cart (char_id: %d).\n", nameid, sd->cart.u.items_cart[i].amount, sd->status.char_id);
+				ShowWarning("Removed invalid/disabled item (ID: %u, amount: %d) from cart (char_id: %d).\n", nameid, sd->cart.u.items_cart[i].amount, sd->status.char_id);
 				pc_cart_delitem(sd, i, sd->cart.u.items_cart[i].amount, 0, LOG_TYPE_OTHER);
 				pc_cart_delitem(sd, i, sd->cart.u.items_cart[i].amount, 0, LOG_TYPE_OTHER);
 				continue;
 				continue;
 			}
 			}
@@ -11091,9 +11096,9 @@ void pc_check_available_item(struct map_session_data *sd, uint8 type)
 			if (!nameid)
 			if (!nameid)
 				continue;
 				continue;
 			if (!itemdb_available(nameid)) {
 			if (!itemdb_available(nameid)) {
-				sprintf(output, msg_txt(sd, 711), nameid); // Item %hu has been removed from your storage.
+				sprintf(output, msg_txt(sd, 711), nameid); // Item %u has been removed from your storage.
 				clif_displaymessage(sd->fd, output);
 				clif_displaymessage(sd->fd, output);
-				ShowWarning("Removed invalid/disabled item (ID: %hu, amount: %d) from storage (char_id: %d).\n", nameid, sd->storage.u.items_storage[i].amount, sd->status.char_id);
+				ShowWarning("Removed invalid/disabled item (ID: %u, amount: %d) from storage (char_id: %d).\n", nameid, sd->storage.u.items_storage[i].amount, sd->status.char_id);
 				storage_delitem(sd, &sd->storage, i, sd->storage.u.items_storage[i].amount);
 				storage_delitem(sd, &sd->storage, i, sd->storage.u.items_storage[i].amount);
 				continue;
 				continue;
 			}
 			}
@@ -11517,7 +11522,7 @@ void pc_overheat(struct map_session_data *sd, int16 heat) {
 /**
 /**
  * Check if player is autolooting given itemID.
  * Check if player is autolooting given itemID.
  */
  */
-bool pc_isautolooting(struct map_session_data *sd, unsigned short nameid)
+bool pc_isautolooting(struct map_session_data *sd, t_itemid nameid)
 {
 {
 	uint8 i = 0;
 	uint8 i = 0;
 
 
@@ -12477,7 +12482,7 @@ uint8 pc_itemcd_add(struct map_session_data *sd, struct item_data *id, t_tick ti
 		if( !(id->nameid == ITEMID_REINS_OF_MOUNT && sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR)) )
 		if( !(id->nameid == ITEMID_REINS_OF_MOUNT && sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR)) )
 			sd->item_delay[i].tick = tick + sd->inventory_data[n]->delay;
 			sd->item_delay[i].tick = tick + sd->inventory_data[n]->delay;
 	} else {// should not happen
 	} else {// should not happen
-		ShowError("pc_itemcd_add: Exceeded item delay array capacity! (nameid=%hu, char_id=%d)\n", id->nameid, sd->status.char_id);
+		ShowError("pc_itemcd_add: Exceeded item delay array capacity! (nameid=%u, char_id=%d)\n", id->nameid, sd->status.char_id);
 	}
 	}
 	//clean up used delays so we can give room for more
 	//clean up used delays so we can give room for more
 	for(i = 0; i < MAX_ITEMDELAYS; i++) {
 	for(i = 0; i < MAX_ITEMDELAYS; i++) {
@@ -13110,7 +13115,7 @@ short pc_maxaspd(struct map_session_data *sd) {
 * @param nameid Item ID
 * @param nameid Item ID
 * @return Heal rate
 * @return Heal rate
 **/
 **/
-short pc_get_itemgroup_bonus(struct map_session_data* sd, unsigned short nameid) {
+short pc_get_itemgroup_bonus(struct map_session_data* sd, t_itemid nameid) {
 	if (sd->itemgrouphealrate.empty())
 	if (sd->itemgrouphealrate.empty())
 		return 0;
 		return 0;
 
 

+ 29 - 24
src/map/pc.hpp

@@ -217,8 +217,8 @@ struct s_addeffectonskill {
 
 
 ///Struct of add drop item/group rate
 ///Struct of add drop item/group rate
 struct s_add_drop {
 struct s_add_drop {
-	unsigned short nameid, ///Item ID
-		group; ///Group ID
+	t_itemid nameid; ///Item ID
+	unsigned short group; ///Group ID
 	int rate; ///Rate, 1 ~ 10000, -1 ~ -100000
 	int rate; ///Rate, 1 ~ 10000, -1 ~ -100000
 	short race; ///Target Race, bitwise value of 1<<x. if < 0 means Monster ID
 	short race; ///Target Race, bitwise value of 1<<x. if < 0 means Monster ID
 	unsigned short class_; ///Target Class, bitwise value of 1<<x
 	unsigned short class_; ///Target Class, bitwise value of 1<<x
@@ -305,7 +305,7 @@ struct map_session_data {
 		unsigned int callshop : 1; // flag to indicate that a script used callshop; on a shop
 		unsigned int callshop : 1; // flag to indicate that a script used callshop; on a shop
 		short pmap; // Previous map on Map Change
 		short pmap; // Previous map on Map Change
 		unsigned short autoloot;
 		unsigned short autoloot;
-		unsigned short autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus]
+		t_itemid autolootid[AUTOLOOTITEM_SIZE]; // [Zephyrus]
 		unsigned short autoloottype;
 		unsigned short autoloottype;
 		unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid
 		unsigned int autolooting : 1; //performance-saver, autolooting state for @alootid
 		unsigned int autobonus; //flag to indicate if an autobonus is activated. [Inkfish]
 		unsigned int autobonus; //flag to indicate if an autobonus is activated. [Inkfish]
@@ -412,7 +412,7 @@ struct map_session_data {
 	t_tick equipswitch_tick; // Equip switch
 	t_tick equipswitch_tick; // Equip switch
 
 
 	struct s_item_delay {
 	struct s_item_delay {
-		unsigned short nameid;
+		t_itemid nameid;
 		t_tick tick;
 		t_tick tick;
 	} item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
 	} item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
 
 
@@ -541,7 +541,7 @@ struct map_session_data {
 	int matk_rate;
 	int matk_rate;
 	int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate;
 	int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate;
 
 
-	int itemid;
+	t_itemid itemid;
 	short itemindex;	//Used item's index in sd->inventory [Skotlex]
 	short itemindex;	//Used item's index in sd->inventory [Skotlex]
 
 
 	uint16 catch_target_class; // pet catching, stores a pet class to catch [zzo]
 	uint16 catch_target_class; // pet catching, stores a pet class to catch [zzo]
@@ -637,7 +637,7 @@ struct map_session_data {
 	// Mail System [Zephyrus]
 	// Mail System [Zephyrus]
 	struct s_mail {
 	struct s_mail {
 		struct {
 		struct {
-			unsigned short nameid;
+			t_itemid nameid;
 			int index, amount;
 			int index, amount;
 		} item[MAIL_MAX_ITEM];
 		} item[MAIL_MAX_ITEM];
 		int zeny;
 		int zeny;
@@ -853,16 +853,21 @@ enum ammo_type {
 };
 };
 
 
 enum idletime_option {
 enum idletime_option {
-	IDLE_WALK          = 0x001,
-	IDLE_USESKILLTOID  = 0x002,
-	IDLE_USESKILLTOPOS = 0x004,
-	IDLE_USEITEM       = 0x008,
-	IDLE_ATTACK        = 0x010,
-	IDLE_CHAT          = 0x020,
-	IDLE_SIT           = 0x040,
-	IDLE_EMOTION       = 0x080,
-	IDLE_DROPITEM      = 0x100,
-	IDLE_ATCOMMAND     = 0x200,
+	IDLE_WALK          = 0x0001,
+	IDLE_USESKILLTOID  = 0x0002,
+	IDLE_USESKILLTOPOS = 0x0004,
+	IDLE_USEITEM       = 0x0008,
+	IDLE_ATTACK        = 0x0010,
+	IDLE_CHAT          = 0x0020,
+	IDLE_SIT           = 0x0040,
+	IDLE_EMOTION       = 0x0080,
+	IDLE_DROPITEM      = 0x0100,
+	IDLE_ATCOMMAND     = 0x0200,
+	IDLE_NPC_CLOSE     = 0x0400,
+	IDLE_NPC_INPUT     = 0x0800,
+	IDLE_NPC_MENU      = 0x1000,
+	IDLE_NPC_NEXT      = 0x2000,
+	IDLE_NPC_PROGRESS  = 0x4000,
 };
 };
 
 
 enum adopt_responses {
 enum adopt_responses {
@@ -1041,7 +1046,7 @@ short pc_maxaspd(struct map_session_data *sd);
 #endif
 #endif
 
 
 struct s_attendance_reward {
 struct s_attendance_reward {
-	uint16 item_id;
+	t_itemid item_id;
 	uint16 amount;
 	uint16 amount;
 };
 };
 
 
@@ -1104,7 +1109,7 @@ int pc_get_skillcooldown(struct map_session_data *sd, uint16 skill_id, uint16 sk
 uint8 pc_checkskill(struct map_session_data *sd,uint16 skill_id);
 uint8 pc_checkskill(struct map_session_data *sd,uint16 skill_id);
 uint8 pc_checkskill_summoner(map_session_data *sd, e_summoner_power_type type);
 uint8 pc_checkskill_summoner(map_session_data *sd, e_summoner_power_type type);
 short pc_checkequip(struct map_session_data *sd,int pos,bool checkall=false);
 short pc_checkequip(struct map_session_data *sd,int pos,bool checkall=false);
-bool pc_checkequip2(struct map_session_data *sd, unsigned short nameid, int min, int max);
+bool pc_checkequip2(struct map_session_data *sd, t_itemid nameid, int min, int max);
 
 
 void pc_scdata_received(struct map_session_data *sd);
 void pc_scdata_received(struct map_session_data *sd);
 void pc_check_expiration(struct map_session_data *sd);
 void pc_check_expiration(struct map_session_data *sd);
@@ -1131,9 +1136,9 @@ void pc_setsavepoint(struct map_session_data *sd, short mapindex,int x,int y);
 char pc_randomwarp(struct map_session_data *sd,clr_type type);
 char pc_randomwarp(struct map_session_data *sd,clr_type type);
 bool pc_memo(struct map_session_data* sd, int pos);
 bool pc_memo(struct map_session_data* sd, int pos);
 
 
-char pc_checkadditem(struct map_session_data *sd, unsigned short nameid, int amount);
+char pc_checkadditem(struct map_session_data *sd, t_itemid nameid, int amount);
 uint8 pc_inventoryblank(struct map_session_data *sd);
 uint8 pc_inventoryblank(struct map_session_data *sd);
-short pc_search_inventory(struct map_session_data *sd, unsigned short nameid);
+short pc_search_inventory(struct map_session_data *sd, t_itemid nameid);
 char pc_payzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
 char pc_payzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
 enum e_additem_result pc_additem(struct map_session_data *sd, struct item *item, int amount, e_log_pick_type log_type);
 enum e_additem_result pc_additem(struct map_session_data *sd, struct item *item, int amount, e_log_pick_type log_type);
 char pc_getzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
 char pc_getzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd);
@@ -1157,7 +1162,7 @@ int pc_cartitem_amount(struct map_session_data *sd,int idx,int amount);
 bool pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem);
 bool pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem);
 bool pc_dropitem(struct map_session_data *sd,int n,int amount);
 bool pc_dropitem(struct map_session_data *sd,int n,int amount);
 
 
-bool pc_isequipped(struct map_session_data *sd, unsigned short nameid);
+bool pc_isequipped(struct map_session_data *sd, t_itemid nameid);
 enum adopt_responses pc_try_adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
 enum adopt_responses pc_try_adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
 bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
 bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
 
 
@@ -1237,7 +1242,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src);
 void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp);
 void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp);
 bool pc_revive_item(struct map_session_data *sd);
 bool pc_revive_item(struct map_session_data *sd);
 void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int type);
 void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int type);
-int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp);
+int pc_itemheal(struct map_session_data *sd, t_itemid itemid, int hp,int sp);
 int pc_percentheal(struct map_session_data *sd,int,int);
 int pc_percentheal(struct map_session_data *sd,int,int);
 bool pc_jobchange(struct map_session_data *sd, int job, char upper);
 bool pc_jobchange(struct map_session_data *sd, int job, char upper);
 void pc_setoption(struct map_session_data *,int);
 void pc_setoption(struct map_session_data *,int);
@@ -1359,7 +1364,7 @@ void pc_inventory_rental_add(struct map_session_data *sd, unsigned int seconds);
 
 
 int pc_read_motd(void); // [Valaris]
 int pc_read_motd(void); // [Valaris]
 int pc_disguise(struct map_session_data *sd, int class_);
 int pc_disguise(struct map_session_data *sd, int class_);
-bool pc_isautolooting(struct map_session_data *sd, unsigned short nameid);
+bool pc_isautolooting(struct map_session_data *sd, t_itemid nameid);
 
 
 void pc_overheat(struct map_session_data *sd, int16 heat);
 void pc_overheat(struct map_session_data *sd, int16 heat);
 
 
@@ -1393,7 +1398,7 @@ void pc_bonus_script_clear(struct map_session_data *sd, uint16 flag);
 
 
 void pc_cell_basilica(struct map_session_data *sd);
 void pc_cell_basilica(struct map_session_data *sd);
 
 
-short pc_get_itemgroup_bonus(struct map_session_data* sd, unsigned short nameid);
+short pc_get_itemgroup_bonus(struct map_session_data* sd, t_itemid nameid);
 short pc_get_itemgroup_bonus_group(struct map_session_data* sd, uint16 group_id);
 short pc_get_itemgroup_bonus_group(struct map_session_data* sd, uint16 group_id);
 
 
 bool pc_is_same_equip_index(enum equip_index eqi, short *equip_index, short index);
 bool pc_is_same_equip_index(enum equip_index eqi, short *equip_index, short index);

+ 18 - 9
src/map/pet.cpp

@@ -373,6 +373,11 @@ uint64 PetDatabase::parseBodyNode( const YAML::Node &node ){
 			return 0;
 			return 0;
 		}
 		}
 
 
+		if( pet->pet_bonus_script != nullptr ){
+			script_free_code( pet->pet_bonus_script );
+			pet->pet_bonus_script = nullptr;
+		}
+
 		pet->pet_bonus_script = parse_script( script.c_str(), this->getCurrentFile().c_str(), node["Script"].Mark().line + 1, SCRIPT_IGNORE_EXTERNAL_BRACKETS );
 		pet->pet_bonus_script = parse_script( script.c_str(), this->getCurrentFile().c_str(), node["Script"].Mark().line + 1, SCRIPT_IGNORE_EXTERNAL_BRACKETS );
 	}else{
 	}else{
 		if( !exists ){
 		if( !exists ){
@@ -387,6 +392,11 @@ uint64 PetDatabase::parseBodyNode( const YAML::Node &node ){
 			return 0;
 			return 0;
 		}
 		}
 
 
+		if( pet->pet_support_script != nullptr ){
+			script_free_code( pet->pet_support_script );
+			pet->pet_support_script = nullptr;
+		}
+
 		pet->pet_support_script = parse_script( script.c_str(), this->getCurrentFile().c_str(), node["SupportScript"].Mark().line + 1, SCRIPT_IGNORE_EXTERNAL_BRACKETS );
 		pet->pet_support_script = parse_script( script.c_str(), this->getCurrentFile().c_str(), node["SupportScript"].Mark().line + 1, SCRIPT_IGNORE_EXTERNAL_BRACKETS );
 	}else{
 	}else{
 		if( !exists ){
 		if( !exists ){
@@ -438,9 +448,9 @@ uint64 PetDatabase::parseBodyNode( const YAML::Node &node ){
 					return 0;
 					return 0;
 				}
 				}
 
 
-				uint32 amount;
+				uint16 amount;
 
 
-				if( !this->asUInt32( requirementNode, "Amount", amount ) ){
+				if( !this->asUInt16( requirementNode, "Amount", amount ) ){
 					return 0;
 					return 0;
 				}
 				}
 
 
@@ -649,7 +659,7 @@ void pet_set_intimate(struct pet_data *pd, int value)
  * @param item_id : item ID of tamer
  * @param item_id : item ID of tamer
  * @return true:success, false:failure
  * @return true:success, false:failure
  */
  */
-bool pet_create_egg(struct map_session_data *sd, unsigned short item_id)
+bool pet_create_egg(struct map_session_data *sd, t_itemid item_id)
 {
 {
 	std::shared_ptr<s_pet_db> pet = pet_db_search(item_id, PET_EGG);
 	std::shared_ptr<s_pet_db> pet = pet_db_search(item_id, PET_EGG);
 
 
@@ -1186,7 +1196,7 @@ int pet_select_egg(struct map_session_data *sd,short egg_index)
 
 
 	std::shared_ptr<s_pet_db> pet = pet_db_search(sd->inventory.u.items_inventory[egg_index].nameid, PET_EGG);
 	std::shared_ptr<s_pet_db> pet = pet_db_search(sd->inventory.u.items_inventory[egg_index].nameid, PET_EGG);
 	if (!pet) {
 	if (!pet) {
-		ShowError("pet does not exist, egg id %d\n", sd->inventory.u.items_inventory[egg_index].nameid);
+		ShowError("pet does not exist, egg id %u\n", sd->inventory.u.items_inventory[egg_index].nameid);
 		return 0;
 		return 0;
 	}
 	}
 
 
@@ -1232,7 +1242,8 @@ int pet_catch_process2(struct map_session_data* sd, int target_id)
 	if(!md || md->bl.type != BL_MOB || md->bl.prev == NULL) { // Invalid inputs/state, abort capture.
 	if(!md || md->bl.type != BL_MOB || md->bl.prev == NULL) { // Invalid inputs/state, abort capture.
 		clif_pet_roulette(sd,0);
 		clif_pet_roulette(sd,0);
 		sd->catch_target_class = PET_CATCH_FAIL;
 		sd->catch_target_class = PET_CATCH_FAIL;
-		sd->itemid = sd->itemindex = -1;
+		sd->itemid = 0;
+		sd->itemindex = -1;
 		return 1;
 		return 1;
 	}
 	}
 
 
@@ -1450,7 +1461,6 @@ int pet_change_name_ack(struct map_session_data *sd, char* name, int flag)
 int pet_equipitem(struct map_session_data *sd,int index)
 int pet_equipitem(struct map_session_data *sd,int index)
 {
 {
 	struct pet_data *pd;
 	struct pet_data *pd;
-	unsigned short nameid;
 
 
 	nullpo_retr(1, sd);
 	nullpo_retr(1, sd);
 
 
@@ -1465,7 +1475,7 @@ int pet_equipitem(struct map_session_data *sd,int index)
 		return 1;
 		return 1;
 	}
 	}
 
 
-	nameid = sd->inventory.u.items_inventory[index].nameid;
+	t_itemid nameid = sd->inventory.u.items_inventory[index].nameid;
 
 
 	if(pet_db_ptr->AcceID == 0 || nameid != pet_db_ptr->AcceID || pd->pet.equip != 0) {
 	if(pet_db_ptr->AcceID == 0 || nameid != pet_db_ptr->AcceID || pd->pet.equip != 0) {
 		clif_equipitemack(sd,0,0,ITEM_EQUIP_ACK_FAIL);
 		clif_equipitemack(sd,0,0,ITEM_EQUIP_ACK_FAIL);
@@ -1503,13 +1513,12 @@ int pet_equipitem(struct map_session_data *sd,int index)
 static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
 static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
 {
 {
 	struct item tmp_item;
 	struct item tmp_item;
-	unsigned short nameid;
 	unsigned char flag = 0;
 	unsigned char flag = 0;
 
 
 	if(pd->pet.equip == 0)
 	if(pd->pet.equip == 0)
 		return 1;
 		return 1;
 
 
-	nameid = pd->pet.equip;
+	t_itemid nameid = pd->pet.equip;
 	pd->pet.equip = 0;
 	pd->pet.equip = 0;
 	status_set_viewdata(&pd->bl, pd->pet.class_);
 	status_set_viewdata(&pd->bl, pd->pet.class_);
 	clif_pet_equip_area(pd);
 	clif_pet_equip_area(pd);

+ 6 - 6
src/map/pet.hpp

@@ -22,16 +22,16 @@
 
 
 struct s_pet_evo_data {
 struct s_pet_evo_data {
 	uint16 target_mob_id;
 	uint16 target_mob_id;
-	std::unordered_map<uint16, uint32> requirements;
+	std::unordered_map<t_itemid, uint16> requirements;
 };
 };
 
 
 /// Pet DB
 /// Pet DB
 struct s_pet_db {
 struct s_pet_db {
 	uint16 class_; ///< Monster ID
 	uint16 class_; ///< Monster ID
-	uint16 itemID; ///< Lure ID
-	uint16 EggID; ///< Egg ID
-	uint16 AcceID; ///< Accessory ID
-	uint16 FoodID; ///< Food ID
+	t_itemid itemID; ///< Lure ID
+	t_itemid EggID; ///< Egg ID
+	t_itemid AcceID; ///< Accessory ID
+	t_itemid FoodID; ///< Food ID
 	uint16 fullness; ///< Amount of hunger decresed each hungry_delay interval
 	uint16 fullness; ///< Amount of hunger decresed each hungry_delay interval
 	uint32 hungry_delay; ///< Hunger value decrease each x seconds
 	uint32 hungry_delay; ///< Hunger value decrease each x seconds
 	int32 hunger_increase; ///< Hunger increased every time the pet is fed.
 	int32 hunger_increase; ///< Hunger increased every time the pet is fed.
@@ -184,7 +184,7 @@ struct pet_data {
 	}
 	}
 };
 };
 
 
-bool pet_create_egg(struct map_session_data *sd, unsigned short item_id);
+bool pet_create_egg(struct map_session_data *sd, t_itemid item_id);
 int pet_hungry_val(struct pet_data *pd);
 int pet_hungry_val(struct pet_data *pd);
 void pet_set_intimate(struct pet_data *pd, int value);
 void pet_set_intimate(struct pet_data *pd, int value);
 int pet_target_check(struct pet_data *pd,struct block_list *bl,int type);
 int pet_target_check(struct pet_data *pd,struct block_list *bl,int type);

+ 1 - 0
src/map/quest.cpp

@@ -902,4 +902,5 @@ void do_init_quest(void)
  */
  */
 void do_final_quest(void)
 void do_final_quest(void)
 {
 {
+	quest_db.clear();
 }
 }

+ 1 - 1
src/map/quest.hpp

@@ -16,7 +16,7 @@ struct map_session_data;
 enum e_size : uint8;
 enum e_size : uint8;
 
 
 struct s_quest_dropitem {
 struct s_quest_dropitem {
-	uint16 nameid;
+	t_itemid nameid;
 	uint16 count;
 	uint16 count;
 	uint16 rate;
 	uint16 rate;
 	uint16 mob_id;
 	uint16 mob_id;

+ 141 - 122
src/map/script.cpp

@@ -6933,7 +6933,7 @@ static int script_countitem_sub(struct item *items, struct item_data *id, int si
 	int count = 0;
 	int count = 0;
 
 
 	if (!expanded) { // For non-expanded functions
 	if (!expanded) { // For non-expanded functions
-		unsigned short nameid = id->nameid;
+		t_itemid nameid = id->nameid;
 
 
 		for (int i = 0; i < size; i++) {
 		for (int i = 0; i < size; i++) {
 			item *itm = &items[i];
 			item *itm = &items[i];
@@ -7258,7 +7258,8 @@ BUILDIN_FUNC(checkweight)
 	slots = pc_inventoryblank(sd); //nb of empty slot
 	slots = pc_inventoryblank(sd); //nb of empty slot
 
 
 	for (i = 2; i < nbargs; i += 2) {
 	for (i = 2; i < nbargs; i += 2) {
-		unsigned short nameid, amount;
+		t_itemid nameid;
+		unsigned short amount;
 
 
 		if( script_isstring(st, i) ) // item name
 		if( script_isstring(st, i) ) // item name
 			id = itemdb_searchname(script_getstr(st, i));
 			id = itemdb_searchname(script_getstr(st, i));
@@ -7367,14 +7368,14 @@ BUILDIN_FUNC(checkweight2)
 
 
 	slots = pc_inventoryblank(sd);
 	slots = pc_inventoryblank(sd);
 	for(i=0; i<nb_it; i++) {
 	for(i=0; i<nb_it; i++) {
-		unsigned short nameid = (unsigned short)get_val2_num( st, reference_uid( id_it, idx_it + i ), reference_getref( data_it ) );
+		t_itemid nameid = (t_itemid)get_val2_num( st, reference_uid( id_it, idx_it + i ), reference_getref( data_it ) );
 		unsigned short amount = (unsigned short)get_val2_num( st, reference_uid( id_nb, idx_nb + i ), reference_getref( data_nb ) );
 		unsigned short amount = (unsigned short)get_val2_num( st, reference_uid( id_nb, idx_nb + i ), reference_getref( data_nb ) );
 
 
 		if(fail)
 		if(fail)
 			continue; //cpntonie to depop rest
 			continue; //cpntonie to depop rest
 
 
 		if(itemdb_exists(nameid) == NULL ) {
 		if(itemdb_exists(nameid) == NULL ) {
-			ShowError("buildin_checkweight2: Invalid item '%d'.\n", nameid);
+			ShowError("buildin_checkweight2: Invalid item '%u'.\n", nameid);
 			fail=1;
 			fail=1;
 			continue;
 			continue;
 		}
 		}
@@ -7430,7 +7431,8 @@ BUILDIN_FUNC(checkweight2)
 BUILDIN_FUNC(getitem)
 BUILDIN_FUNC(getitem)
 {
 {
 	int get_count, i;
 	int get_count, i;
-	unsigned short nameid, amount;
+	t_itemid nameid;
+	unsigned short amount;
 	struct item it;
 	struct item it;
 	TBL_PC *sd;
 	TBL_PC *sd;
 	unsigned char flag = 0;
 	unsigned char flag = 0;
@@ -7449,7 +7451,7 @@ BUILDIN_FUNC(getitem)
 	} else {// <item id>
 	} else {// <item id>
 		nameid = script_getnum(st, 2);
 		nameid = script_getnum(st, 2);
 		if( !(id = itemdb_exists(nameid)) ){
 		if( !(id = itemdb_exists(nameid)) ){
-			ShowError("buildin_getitem: Nonexistant item %d requested.\n", nameid);
+			ShowError("buildin_getitem: Nonexistant item %u requested.\n", nameid);
 			return SCRIPT_CMD_FAILURE; //No item created.
 			return SCRIPT_CMD_FAILURE; //No item created.
 		}
 		}
 	}
 	}
@@ -7521,9 +7523,10 @@ BUILDIN_FUNC(getitem)
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(getitem2)
 BUILDIN_FUNC(getitem2)
 {
 {
-	unsigned short nameid, amount;
+	t_itemid nameid;
+	unsigned short amount;
 	int iden, ref, attr;
 	int iden, ref, attr;
-	unsigned short c1, c2, c3, c4;
+	t_itemid c1, c2, c3, c4;
 	char bound = BOUND_NONE;
 	char bound = BOUND_NONE;
 	struct item_data *item_data = NULL;
 	struct item_data *item_data = NULL;
 	struct item item_tmp;
 	struct item item_tmp;
@@ -7566,7 +7569,7 @@ BUILDIN_FUNC(getitem2)
 	} else {
 	} else {
 		nameid = script_getnum(st, 2);
 		nameid = script_getnum(st, 2);
 		if( (item_data = itemdb_exists(nameid)) == NULL ){
 		if( (item_data = itemdb_exists(nameid)) == NULL ){
-			ShowError("buildin_getitem2: Nonexistant item %d requested (by conv_num).\n", nameid);
+			ShowError("buildin_getitem2: Nonexistant item %u requested (by conv_num).\n", nameid);
 			return SCRIPT_CMD_FAILURE; //No item created.
 			return SCRIPT_CMD_FAILURE; //No item created.
 		}
 		}
 	}
 	}
@@ -7575,10 +7578,10 @@ BUILDIN_FUNC(getitem2)
 	iden = script_getnum(st,4);
 	iden = script_getnum(st,4);
 	ref = script_getnum(st,5);
 	ref = script_getnum(st,5);
 	attr = script_getnum(st,6);
 	attr = script_getnum(st,6);
-	c1 = (unsigned short)script_getnum(st,7);
-	c2 = (unsigned short)script_getnum(st,8);
-	c3 = (unsigned short)script_getnum(st,9);
-	c4 = (unsigned short)script_getnum(st,10);
+	c1 = script_getnum(st,7);
+	c2 = script_getnum(st,8);
+	c3 = script_getnum(st,9);
+	c4 = script_getnum(st,10);
 
 
 	if( item_data ) {
 	if( item_data ) {
 		int get_count = 0, i;
 		int get_count = 0, i;
@@ -7644,7 +7647,7 @@ BUILDIN_FUNC(rentitem) {
 	struct map_session_data *sd;
 	struct map_session_data *sd;
 	struct item it;
 	struct item it;
 	int seconds;
 	int seconds;
-	unsigned short nameid = 0;
+	t_itemid nameid = 0;
 	unsigned char flag = 0;
 	unsigned char flag = 0;
 
 
 	if (!script_accid2sd(4,sd))
 	if (!script_accid2sd(4,sd))
@@ -7667,7 +7670,7 @@ BUILDIN_FUNC(rentitem) {
 		nameid = script_getnum(st, 2);
 		nameid = script_getnum(st, 2);
 		if( nameid == 0 || !itemdb_exists(nameid) )
 		if( nameid == 0 || !itemdb_exists(nameid) )
 		{
 		{
-			ShowError("buildin_rentitem: Nonexistant item %hu requested.\n", nameid);
+			ShowError("buildin_rentitem: Nonexistant item %u requested.\n", nameid);
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
 		}
 		}
 	}
 	}
@@ -7700,9 +7703,10 @@ BUILDIN_FUNC(rentitem2) {
 	struct item it;
 	struct item it;
 	struct item_data *id;
 	struct item_data *id;
 	int seconds;
 	int seconds;
-	unsigned short nameid = 0;
+	t_itemid nameid = 0;
 	unsigned char flag = 0;
 	unsigned char flag = 0;
-	int iden,ref,attr,c1,c2,c3,c4;
+	int iden,ref,attr;
+	t_itemid c1,c2,c3,c4;
 	const char *funcname = script_getfuncname(st);
 	const char *funcname = script_getfuncname(st);
 
 
 	if (funcname[strlen(funcname)-1] == '3') {
 	if (funcname[strlen(funcname)-1] == '3') {
@@ -7723,7 +7727,7 @@ BUILDIN_FUNC(rentitem2) {
 	} else {
 	} else {
 		nameid = script_getnum(st, 2);
 		nameid = script_getnum(st, 2);
 		if( !(id = itemdb_search(nameid))) {
 		if( !(id = itemdb_search(nameid))) {
-			ShowError("buildin_rentitem2: Nonexistant item %hu requested.\n", nameid);
+			ShowError("buildin_rentitem2: Nonexistant item %u requested.\n", nameid);
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
 		}
 		}
 	}
 	}
@@ -7745,20 +7749,20 @@ BUILDIN_FUNC(rentitem2) {
 		ref = attr = 0;
 		ref = attr = 0;
 	}
 	}
 
 
-	c1 = (short)script_getnum(st,7);
-	c2 = (short)script_getnum(st,8);
-	c3 = (short)script_getnum(st,9);
-	c4 = (short)script_getnum(st,10);
+	c1 = script_getnum(st,7);
+	c2 = script_getnum(st,8);
+	c3 = script_getnum(st,9);
+	c4 = script_getnum(st,10);
 
 
 	memset(&it, 0, sizeof(it));
 	memset(&it, 0, sizeof(it));
 	it.nameid = nameid;
 	it.nameid = nameid;
 	it.identify = iden;
 	it.identify = iden;
 	it.refine = ref;
 	it.refine = ref;
 	it.attribute = attr;
 	it.attribute = attr;
-	it.card[0] = (short)c1;
-	it.card[1] = (short)c2;
-	it.card[2] = (short)c3;
-	it.card[3] = (short)c4;
+	it.card[0] = c1;
+	it.card[1] = c2;
+	it.card[2] = c3;
+	it.card[3] = c4;
 	it.expire_time = (unsigned int)(time(NULL) + seconds);
 	it.expire_time = (unsigned int)(time(NULL) + seconds);
 	it.bound = BOUND_NONE;
 	it.bound = BOUND_NONE;
 
 
@@ -7784,7 +7788,7 @@ BUILDIN_FUNC(rentitem2) {
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(getnameditem)
 BUILDIN_FUNC(getnameditem)
 {
 {
-	unsigned short nameid;
+	t_itemid nameid;
 	struct item item_tmp;
 	struct item item_tmp;
 	TBL_PC *sd, *tsd;
 	TBL_PC *sd, *tsd;
 
 
@@ -7864,7 +7868,8 @@ BUILDIN_FUNC(grouprandomitem) {
 * makeitem "<item name>",<amount>,"<map name>",<X>,<Y>;
 * makeitem "<item name>",<amount>,"<map name>",<X>,<Y>;
 */
 */
 BUILDIN_FUNC(makeitem) {
 BUILDIN_FUNC(makeitem) {
-	uint16 nameid, amount, flag = 0, x, y;
+	t_itemid nameid;
+	uint16 amount, flag = 0, x, y;
 	const char *mapname;
 	const char *mapname;
 	int m;
 	int m;
 	struct item item_tmp;
 	struct item item_tmp;
@@ -7875,11 +7880,26 @@ BUILDIN_FUNC(makeitem) {
 
 
 		if( item_data )
 		if( item_data )
 			nameid = item_data->nameid;
 			nameid = item_data->nameid;
-		else
-			nameid = UNKNOWN_ITEM_ID;
+		else{
+			ShowError( "buildin_makeitem: Unknown item %s\n", name );
+			return SCRIPT_CMD_FAILURE;
+		}
+	}
+	else {
+		int32 val = script_getnum( st, 2 );
+
+		if( val < 0 ){
+			flag = 1;
+			nameid = (t_itemid)( -1 * val );
+		}else{
+			nameid = (t_itemid)val;
+		}
+
+		if( !itemdb_exists( nameid ) ){
+			ShowError( "buildin_makeitem: Unknown item id %u\n", nameid );
+			return SCRIPT_CMD_FAILURE;
+		}
 	}
 	}
-	else
-		nameid = script_getnum(st, 2);
 
 
 	amount = script_getnum(st,3);
 	amount = script_getnum(st,3);
 	mapname	= script_getstr(st,4);
 	mapname	= script_getstr(st,4);
@@ -7894,21 +7914,14 @@ BUILDIN_FUNC(makeitem) {
 	} else
 	} else
 		m = map_mapname2mapid(mapname);
 		m = map_mapname2mapid(mapname);
 
 
-	if(nameid<0) {
-		nameid = -nameid;
-		flag = 1;
-	}
-
-	if(nameid > 0) {
-		memset(&item_tmp,0,sizeof(item_tmp));
-		item_tmp.nameid = nameid;
-		if(!flag)
-			item_tmp.identify = 1;
-		else
-			item_tmp.identify = itemdb_isidentified(nameid);
+	memset(&item_tmp,0,sizeof(item_tmp));
+	item_tmp.nameid = nameid;
+	if (!flag)
+		item_tmp.identify = 1;
+	else
+		item_tmp.identify = itemdb_isidentified(nameid);
 
 
-		map_addflooritem(&item_tmp,amount,m,x,y,0,0,0,4,0);
-	}
+	map_addflooritem(&item_tmp,amount,m,x,y,0,0,0,4,0);
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
 }
 }
 
 
@@ -7920,24 +7933,32 @@ BUILDIN_FUNC(makeitem) {
  * makeitem3 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>;
  * makeitem3 "<item name>",<amount>,"<map name>",<X>,<Y>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>,<RandomIDArray>,<RandomValueArray>,<RandomParamArray>;
  */
  */
 BUILDIN_FUNC(makeitem2) {
 BUILDIN_FUNC(makeitem2) {
-	uint16 nameid, amount, x, y;
+	t_itemid nameid;
+	uint16 amount, x, y;
 	const char *mapname;
 	const char *mapname;
 	int m;
 	int m;
 	struct item item_tmp;
 	struct item item_tmp;
 	struct item_data *id;
 	struct item_data *id;
 	const char *funcname = script_getfuncname(st);
 	const char *funcname = script_getfuncname(st);
 
 
-	if( script_isstring(st, 2) ){
-		const char *name = script_getstr(st, 2);
-		struct item_data *item_data = itemdb_searchname(name);
+	if( script_isstring( st, 2 ) ){
+		const char *name = script_getstr( st, 2 );
+		struct item_data *item_data = itemdb_searchname( name );
 
 
-		if( item_data )
+		if( item_data ){
 			nameid = item_data->nameid;
 			nameid = item_data->nameid;
-		else
-			nameid = UNKNOWN_ITEM_ID;
+		}else{
+			ShowError( "buildin_%s: Unknown item %s\n", funcname, name );
+			return SCRIPT_CMD_FAILURE;
+		}
+	}else{
+		nameid = (t_itemid)script_getnum( st, 2 );
+
+		if( !itemdb_exists( nameid ) ){
+			ShowError( "buildin_%s: Unknown item id %u\n", funcname, nameid );
+			return SCRIPT_CMD_FAILURE;
+		}
 	}
 	}
-	else
-		nameid = script_getnum(st, 2);
 
 
 	amount = script_getnum(st,3);
 	amount = script_getnum(st,3);
 	mapname	= script_getstr(st,4);
 	mapname	= script_getstr(st,4);
@@ -8281,7 +8302,7 @@ BUILDIN_FUNC(delitem)
 		it.nameid = script_getnum(st, 2);// <item id>
 		it.nameid = script_getnum(st, 2);// <item id>
 		if( !itemdb_exists( it.nameid ) )
 		if( !itemdb_exists( it.nameid ) )
 		{
 		{
-			ShowError("buildin_%s: unknown item \"%hu\".\n", command, it.nameid);
+			ShowError("buildin_%s: unknown item \"%u\".\n", command, it.nameid);
 			st->state = END;
 			st->state = END;
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
 		}
 		}
@@ -8297,7 +8318,7 @@ BUILDIN_FUNC(delitem)
 		return SCRIPT_CMD_SUCCESS;
 		return SCRIPT_CMD_SUCCESS;
 	}
 	}
 
 
-	ShowError("buildin_%s: failed to delete %d items (AID=%d item_id=%hu).\n", command, it.amount, sd->status.account_id, it.nameid);
+	ShowError("buildin_%s: failed to delete %d items (AID=%d item_id=%u).\n", command, it.amount, sd->status.account_id, it.nameid);
 	st->state = END;
 	st->state = END;
 	st->mes_active = 0;
 	st->mes_active = 0;
 	clif_scriptclose(sd, st->oid);
 	clif_scriptclose(sd, st->oid);
@@ -8375,7 +8396,7 @@ BUILDIN_FUNC(delitem2)
 		it.nameid = script_getnum(st, 2);// <item id>
 		it.nameid = script_getnum(st, 2);// <item id>
 		if( !itemdb_exists( it.nameid ) )
 		if( !itemdb_exists( it.nameid ) )
 		{
 		{
-			ShowError("buildin_%s: unknown item \"%hu\".\n", command, it.nameid);
+			ShowError("buildin_%s: unknown item \"%u\".\n", command, it.nameid);
 			st->state = END;
 			st->state = END;
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
 		}
 		}
@@ -8385,10 +8406,10 @@ BUILDIN_FUNC(delitem2)
 	it.identify=script_getnum(st,4);
 	it.identify=script_getnum(st,4);
 	it.refine=script_getnum(st,5);
 	it.refine=script_getnum(st,5);
 	it.attribute=script_getnum(st,6);
 	it.attribute=script_getnum(st,6);
-	it.card[0]=(short)script_getnum(st,7);
-	it.card[1]=(short)script_getnum(st,8);
-	it.card[2]=(short)script_getnum(st,9);
-	it.card[3]=(short)script_getnum(st,10);
+	it.card[0]=script_getnum(st,7);
+	it.card[1]=script_getnum(st,8);
+	it.card[2]=script_getnum(st,9);
+	it.card[3]=script_getnum(st,10);
 
 
 	if (command[strlen(command)-1] == '3') {
 	if (command[strlen(command)-1] == '3') {
 		int res = script_getitem_randomoption(st, sd, &it, command, 11);
 		int res = script_getitem_randomoption(st, sd, &it, command, 11);
@@ -8405,7 +8426,7 @@ BUILDIN_FUNC(delitem2)
 		return SCRIPT_CMD_SUCCESS;
 		return SCRIPT_CMD_SUCCESS;
 	}
 	}
 
 
-	ShowError("buildin_%s: failed to delete %d items (AID=%d item_id=%hu).\n", command, it.amount, sd->status.account_id, it.nameid);
+	ShowError("buildin_%s: failed to delete %d items (AID=%d item_id=%u).\n", command, it.amount, sd->status.account_id, it.nameid);
 	st->state = END;
 	st->state = END;
 	st->mes_active = 0;
 	st->mes_active = 0;
 	clif_scriptclose(sd, st->oid);
 	clif_scriptclose(sd, st->oid);
@@ -10598,7 +10619,7 @@ BUILDIN_FUNC(getmobdrops)
 
 
 	for( i = 0; i < MAX_MOB_DROP_TOTAL; i++ )
 	for( i = 0; i < MAX_MOB_DROP_TOTAL; i++ )
 	{
 	{
-		if( mob->dropitem[i].nameid < 1 )
+		if( mob->dropitem[i].nameid == 0 )
 			continue;
 			continue;
 		if( itemdb_exists(mob->dropitem[i].nameid) == NULL )
 		if( itemdb_exists(mob->dropitem[i].nameid) == NULL )
 			continue;
 			continue;
@@ -11526,7 +11547,7 @@ BUILDIN_FUNC(getunits)
  *------------------------------------------*/
  *------------------------------------------*/
 static int buildin_getareadropitem_sub(struct block_list *bl,va_list ap)
 static int buildin_getareadropitem_sub(struct block_list *bl,va_list ap)
 {
 {
-	unsigned short nameid = (unsigned short)va_arg(ap, int);
+	t_itemid nameid = va_arg(ap, t_itemid);
 	unsigned short *amount = (unsigned short *)va_arg(ap, int *);
 	unsigned short *amount = (unsigned short *)va_arg(ap, int *);
 	struct flooritem_data *drop=(struct flooritem_data *)bl;
 	struct flooritem_data *drop=(struct flooritem_data *)bl;
 
 
@@ -11539,7 +11560,8 @@ BUILDIN_FUNC(getareadropitem)
 {
 {
 	const char *str;
 	const char *str;
 	int16 m,x0,y0,x1,y1;
 	int16 m,x0,y0,x1,y1;
-	unsigned short nameid, amount = 0;
+	t_itemid nameid;
+	unsigned short amount = 0;
 
 
 	str=script_getstr(st,2);
 	str=script_getstr(st,2);
 	x0=script_getnum(st,3);
 	x0=script_getnum(st,3);
@@ -11551,12 +11573,21 @@ BUILDIN_FUNC(getareadropitem)
 		const char *name = script_getstr(st, 7);
 		const char *name = script_getstr(st, 7);
 		struct item_data *item_data = itemdb_searchname(name);
 		struct item_data *item_data = itemdb_searchname(name);
 
 
-		nameid=UNKNOWN_ITEM_ID;
 		if( item_data )
 		if( item_data )
 			nameid=item_data->nameid;
 			nameid=item_data->nameid;
-	}else
+		else{
+			ShowError( "buildin_getareadropitem: Unknown item %s\n", name );
+			return SCRIPT_CMD_FAILURE;
+		}
+	}else{
 		nameid = script_getnum(st, 7);
 		nameid = script_getnum(st, 7);
 
 
+		if( !itemdb_exists( nameid ) ){
+			ShowError( "buildin_getareadropitem: Unknown item id %u\n", nameid );
+			return SCRIPT_CMD_FAILURE;
+		}
+	}
+
 	if( (m=map_mapname2mapid(str))< 0){
 	if( (m=map_mapname2mapid(str))< 0){
 		script_pushint(st,-1);
 		script_pushint(st,-1);
 		return SCRIPT_CMD_SUCCESS;
 		return SCRIPT_CMD_SUCCESS;
@@ -13834,7 +13865,7 @@ BUILDIN_FUNC(guardianinfo)
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(getitemname)
 BUILDIN_FUNC(getitemname)
 {
 {
-	unsigned short item_id = 0;
+	t_itemid item_id = 0;
 	struct item_data *i_data;
 	struct item_data *i_data;
 	char *item_name;
 	char *item_name;
 
 
@@ -13865,10 +13896,9 @@ BUILDIN_FUNC(getitemname)
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(getitemslots)
 BUILDIN_FUNC(getitemslots)
 {
 {
-	unsigned short item_id;
 	struct item_data *i_data;
 	struct item_data *i_data;
 
 
-	item_id=script_getnum(st,2);
+	t_itemid item_id=script_getnum(st,2);
 
 
 	i_data = itemdb_exists(item_id);
 	i_data = itemdb_exists(item_id);
 
 
@@ -13907,10 +13937,10 @@ BUILDIN_FUNC(getitemslots)
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(getiteminfo)
 BUILDIN_FUNC(getiteminfo)
 {
 {
-	unsigned short item_id,n;
+	unsigned short n;
 	struct item_data *i_data;
 	struct item_data *i_data;
 
 
-	item_id	= script_getnum(st,2);
+	t_itemid item_id = script_getnum(st,2);
 	n	= script_getnum(st,3);
 	n	= script_getnum(st,3);
 	i_data = itemdb_exists(item_id);
 	i_data = itemdb_exists(item_id);
 
 
@@ -13948,20 +13978,28 @@ BUILDIN_FUNC(getiteminfo)
 		12 elv;
 		12 elv;
 		13 wlv;
 		13 wlv;
 		14 view id
 		14 view id
+		15 eLvmax
+		16 matk (renewal)
   * Returns Value or -1 if the wrong field's been set
   * Returns Value or -1 if the wrong field's been set
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(setiteminfo)
 BUILDIN_FUNC(setiteminfo)
 {
 {
-	unsigned short item_id;
 	int n,value;
 	int n,value;
 	struct item_data *i_data;
 	struct item_data *i_data;
 
 
-	item_id	= script_getnum(st,2);
+	t_itemid item_id = script_getnum(st,2);
 	n	= script_getnum(st,3);
 	n	= script_getnum(st,3);
 	value	= script_getnum(st,4);
 	value	= script_getnum(st,4);
 	i_data = itemdb_exists(item_id);
 	i_data = itemdb_exists(item_id);
 
 
-	if (i_data && n>=0 && n<=14) {
+#ifndef RENEWAL
+	if( n == 16 ){
+		script_pushint( st, -1 );
+		return SCRIPT_CMD_SUCCESS;
+	}
+#endif
+
+	if (i_data && n>=0 && n<=16) {
 		int *item_arr = (int*)&i_data->value_buy;
 		int *item_arr = (int*)&i_data->value_buy;
 		item_arr[n] = value;
 		item_arr[n] = value;
 		script_pushint(st,value);
 		script_pushint(st,value);
@@ -14584,14 +14622,6 @@ BUILDIN_FUNC(skilleffect)
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
-	uint16 skill_lv_cap = cap_value(skill_lv, 1, skill_get_max(skill_id));
-
-	if (skill_lv != skill_lv_cap) {
-		ShowWarning("buildin_skilleffect: Invalid skill level %d, capping to %d.\n", skill_lv, skill_lv_cap);
-		skill_lv = skill_lv_cap;
-		script_reportsrc(st);
-	}
-
 	/* Ensure we're standing because the following packet causes the client to virtually set the char to stand,
 	/* Ensure we're standing because the following packet causes the client to virtually set the char to stand,
 	 * which leaves the server thinking it still is sitting. */
 	 * which leaves the server thinking it still is sitting. */
 	if( pc_issit(sd) && pc_setstand(sd, false) ) {
 	if( pc_issit(sd) && pc_setstand(sd, false) ) {
@@ -14631,14 +14661,6 @@ BUILDIN_FUNC(npcskilleffect)
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
-	uint16 skill_lv_cap = cap_value(skill_lv, 1, skill_get_max(skill_id));
-
-	if (skill_lv != skill_lv_cap) {
-		ShowWarning("buildin_npcskilleffect: Invalid skill level %d, capping to %d.\n", skill_lv, skill_lv_cap);
-		skill_lv = skill_lv_cap;
-		script_reportsrc(st);
-	}
-
 	script_skill_effect(bl, skill_id, skill_lv, bl->x, bl->y);
 	script_skill_effect(bl, skill_id, skill_lv, bl->x, bl->y);
 
 
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
@@ -15821,14 +15843,13 @@ BUILDIN_FUNC(unequip) {
  * equip <item id>{,<char_id>};
  * equip <item id>{,<char_id>};
  **/
  **/
 BUILDIN_FUNC(equip) {
 BUILDIN_FUNC(equip) {
-	unsigned short nameid = 0;
 	TBL_PC *sd;
 	TBL_PC *sd;
 	struct item_data *item_data;
 	struct item_data *item_data;
 
 
 	if (!script_charid2sd(3,sd))
 	if (!script_charid2sd(3,sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 
 
-	nameid = script_getnum(st,2);
+	t_itemid nameid = script_getnum(st,2);
 	if ((item_data = itemdb_exists(nameid))) {
 	if ((item_data = itemdb_exists(nameid))) {
 		int i;
 		int i;
 
 
@@ -15840,28 +15861,27 @@ BUILDIN_FUNC(equip) {
 		}
 		}
 	}
 	}
 
 
-	ShowError("buildin_equip: Item %hu cannot be equipped\n",nameid);
+	ShowError("buildin_equip: Item %u cannot be equipped\n",nameid);
 	script_pushint(st,0);
 	script_pushint(st,0);
 	return SCRIPT_CMD_FAILURE;
 	return SCRIPT_CMD_FAILURE;
 }
 }
 
 
 BUILDIN_FUNC(autoequip)
 BUILDIN_FUNC(autoequip)
 {
 {
-	unsigned short nameid;
 	int flag;
 	int flag;
 	struct item_data *item_data;
 	struct item_data *item_data;
-	nameid=script_getnum(st,2);
+	t_itemid nameid=script_getnum(st,2);
 	flag=script_getnum(st,3);
 	flag=script_getnum(st,3);
 
 
 	if( ( item_data = itemdb_exists(nameid) ) == NULL )
 	if( ( item_data = itemdb_exists(nameid) ) == NULL )
 	{
 	{
-		ShowError("buildin_autoequip: Invalid item '%hu'.\n", nameid);
+		ShowError("buildin_autoequip: Invalid item '%u'.\n", nameid);
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
 	if( !itemdb_isequip2(item_data) )
 	if( !itemdb_isequip2(item_data) )
 	{
 	{
-		ShowError("buildin_autoequip: Item '%hu' cannot be equipped.\n", nameid);
+		ShowError("buildin_autoequip: Item '%u' cannot be equipped.\n", nameid);
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
@@ -17144,7 +17164,8 @@ BUILDIN_FUNC(npcshopadditem)
 #if PACKETVER >= 20131223
 #if PACKETVER >= 20131223
 	if (nd->subtype == NPCTYPE_MARKETSHOP) {
 	if (nd->subtype == NPCTYPE_MARKETSHOP) {
 		for (n = 0, i = 3; n < amount; n++, i += offs) {
 		for (n = 0, i = 3; n < amount; n++, i += offs) {
-			uint16 nameid = script_getnum(st,i), j;
+			t_itemid nameid = script_getnum(st,i);
+			uint16 j;
 
 
 			// Check existing entries
 			// Check existing entries
 			ARR_FIND(0, nd->u.shop.count, j, nd->u.shop.shop_item[j].nameid == nameid);
 			ARR_FIND(0, nd->u.shop.count, j, nd->u.shop.shop_item[j].nameid == nameid);
@@ -17196,7 +17217,7 @@ BUILDIN_FUNC(npcshopdelitem)
 
 
 	// remove specified items from the shop item list
 	// remove specified items from the shop item list
 	for( i = 3; i < 3 + amount; i++ ) {
 	for( i = 3; i < 3 + amount; i++ ) {
-		unsigned short nameid = script_getnum(st,i);
+		t_itemid nameid = script_getnum(st,i);
 
 
 		ARR_FIND( 0, size, n, nd->u.shop.shop_item[n].nameid == nameid );
 		ARR_FIND( 0, size, n, nd->u.shop.shop_item[n].nameid == nameid );
 		if( n < size ) {
 		if( n < size ) {
@@ -17255,13 +17276,12 @@ BUILDIN_FUNC(npcshopattach)
  *------------------------------------------*/
  *------------------------------------------*/
 BUILDIN_FUNC(setitemscript)
 BUILDIN_FUNC(setitemscript)
 {
 {
-	unsigned short item_id;
 	int n = 0;
 	int n = 0;
 	const char *script;
 	const char *script;
 	struct item_data *i_data;
 	struct item_data *i_data;
 	struct script_code **dstscript;
 	struct script_code **dstscript;
 
 
-	item_id	= script_getnum(st,2);
+	t_itemid item_id = script_getnum(st,2);
 	script = script_getstr(st,3);
 	script = script_getstr(st,3);
 	if( script_hasdata(st,4) )
 	if( script_hasdata(st,4) )
 		n=script_getnum(st,4);
 		n=script_getnum(st,4);
@@ -17303,7 +17323,6 @@ BUILDIN_FUNC(setitemscript)
 BUILDIN_FUNC(addmonsterdrop)
 BUILDIN_FUNC(addmonsterdrop)
 {
 {
 	struct mob_db *mob;
 	struct mob_db *mob;
-	unsigned short item_id;
 	int rate;
 	int rate;
 
 
 	if(script_isstring(st, 2))
 	if(script_isstring(st, 2))
@@ -17311,11 +17330,11 @@ BUILDIN_FUNC(addmonsterdrop)
 	else
 	else
 		mob = mob_db(script_getnum(st,2));
 		mob = mob_db(script_getnum(st,2));
 
 
-	item_id=script_getnum(st,3);
+	t_itemid item_id=script_getnum(st,3);
 	rate=script_getnum(st,4);
 	rate=script_getnum(st,4);
 
 
 	if(!itemdb_exists(item_id)){
 	if(!itemdb_exists(item_id)){
-		ShowError("addmonsterdrop: Nonexistant item %hu requested.\n", item_id );
+		ShowError("addmonsterdrop: Nonexistant item %u requested.\n", item_id );
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
@@ -17358,17 +17377,16 @@ BUILDIN_FUNC(addmonsterdrop)
 BUILDIN_FUNC(delmonsterdrop)
 BUILDIN_FUNC(delmonsterdrop)
 {
 {
 	struct mob_db *mob;
 	struct mob_db *mob;
-	unsigned short item_id;
 
 
 	if(script_isstring(st, 2))
 	if(script_isstring(st, 2))
 		mob = mob_db(mobdb_searchname(script_getstr(st,2)));
 		mob = mob_db(mobdb_searchname(script_getstr(st,2)));
 	else
 	else
 		mob = mob_db(script_getnum(st,2));
 		mob = mob_db(script_getnum(st,2));
 
 
-	item_id=script_getnum(st,3);
+	t_itemid item_id=script_getnum(st,3);
 
 
 	if(!itemdb_exists(item_id)){
 	if(!itemdb_exists(item_id)){
-		ShowError("delmonsterdrop: Nonexistant item %hu requested.\n", item_id );
+		ShowError("delmonsterdrop: Nonexistant item %u requested.\n", item_id );
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
 	}
 	}
 
 
@@ -21824,10 +21842,10 @@ BUILDIN_FUNC(consumeitem)
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
 		}
 		}
 	} else {
 	} else {
-		unsigned short nameid = script_getnum(st, 2);
+		t_itemid nameid = script_getnum(st, 2);
 
 
 		if( ( item_data = itemdb_exists( nameid ) ) == NULL ){
 		if( ( item_data = itemdb_exists( nameid ) ) == NULL ){
-			ShowError("buildin_consumeitem: Nonexistant item %hu requested.\n", nameid );
+			ShowError("buildin_consumeitem: Nonexistant item %u requested.\n", nameid );
 			return SCRIPT_CMD_FAILURE;
 			return SCRIPT_CMD_FAILURE;
 		}
 		}
 	}
 	}
@@ -22554,7 +22572,8 @@ BUILDIN_FUNC(mergeitem) {
 BUILDIN_FUNC(mergeitem2) {
 BUILDIN_FUNC(mergeitem2) {
 	struct map_session_data *sd;
 	struct map_session_data *sd;
 	struct item *items = NULL;
 	struct item *items = NULL;
-	uint16 i, count = 0, nameid = 0;
+	uint16 i, count = 0;
+	t_itemid nameid = 0;
 
 
 	if (!script_charid2sd(3, sd))
 	if (!script_charid2sd(3, sd))
 		return SCRIPT_CMD_FAILURE;
 		return SCRIPT_CMD_FAILURE;
@@ -22573,7 +22592,7 @@ BUILDIN_FUNC(mergeitem2) {
 		} else {// <item id>
 		} else {// <item id>
 			nameid = script_getnum(st, 2);
 			nameid = script_getnum(st, 2);
 			if (!itemdb_exists(nameid)) {
 			if (!itemdb_exists(nameid)) {
-				ShowError("buildin_mergeitem: Nonexistant item %d requested.\n", nameid);
+				ShowError("buildin_mergeitem: Nonexistant item %u requested.\n", nameid);
 				script_pushint(st, count);
 				script_pushint(st, count);
 				return SCRIPT_CMD_FAILURE;
 				return SCRIPT_CMD_FAILURE;
 			}
 			}
@@ -22635,7 +22654,7 @@ BUILDIN_FUNC(mergeitem2) {
 BUILDIN_FUNC(npcshopupdate) {
 BUILDIN_FUNC(npcshopupdate) {
 	const char* npcname = script_getstr(st, 2);
 	const char* npcname = script_getstr(st, 2);
 	struct npc_data* nd = npc_name2id(npcname);
 	struct npc_data* nd = npc_name2id(npcname);
-	uint16 nameid = script_getnum(st, 3);
+	t_itemid nameid = script_getnum(st, 3);
 	int price = script_getnum(st, 4);
 	int price = script_getnum(st, 4);
 #if PACKETVER >= 20131223
 #if PACKETVER >= 20131223
 	uint16 stock = script_hasdata(st,5) ? script_getnum(st,5) : 0;
 	uint16 stock = script_hasdata(st,5) ? script_getnum(st,5) : 0;
@@ -24364,11 +24383,11 @@ BUILDIN_FUNC(mail){
 		}
 		}
 
 
 		for( i = 0; i < num_items && start < end; i++, start++ ){
 		for( i = 0; i < num_items && start < end; i++, start++ ){
-			msg.item[i].nameid = (unsigned short)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
+			msg.item[i].nameid = (t_itemid)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
 			msg.item[i].identify = 1;
 			msg.item[i].identify = 1;
 
 
 			if( !itemdb_exists(msg.item[i].nameid) ){
 			if( !itemdb_exists(msg.item[i].nameid) ){
-				ShowError( "buildin_mail: invalid item id %hu.\n", msg.item[i].nameid );
+				ShowError( "buildin_mail: invalid item id %u.\n", msg.item[i].nameid );
 				return SCRIPT_CMD_FAILURE;
 				return SCRIPT_CMD_FAILURE;
 			}
 			}
 		}
 		}
@@ -24391,18 +24410,18 @@ BUILDIN_FUNC(mail){
 			msg.item[i].amount = (short)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
 			msg.item[i].amount = (short)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
 
 
 			if( msg.item[i].amount <= 0 ){
 			if( msg.item[i].amount <= 0 ){
-				ShowError( "buildin_mail: amount %d for item %hu is invalid.\n", msg.item[i].amount, msg.item[i].nameid );
+				ShowError( "buildin_mail: amount %d for item %u is invalid.\n", msg.item[i].amount, msg.item[i].nameid );
 				return SCRIPT_CMD_FAILURE;
 				return SCRIPT_CMD_FAILURE;
 			}else if( itemdb_isstackable2(item) ){
 			}else if( itemdb_isstackable2(item) ){
 				uint16 max = item->stack.amount > 0 ? item->stack.amount : MAX_AMOUNT;
 				uint16 max = item->stack.amount > 0 ? item->stack.amount : MAX_AMOUNT;
 
 
 				if( msg.item[i].amount > max ){
 				if( msg.item[i].amount > max ){
-					ShowWarning( "buildin_mail: amount %d for item %hu is exceeding the maximum of %d. Capping...\n", msg.item[i].amount, msg.item[i].nameid, max );
+					ShowWarning( "buildin_mail: amount %d for item %u is exceeding the maximum of %d. Capping...\n", msg.item[i].amount, msg.item[i].nameid, max );
 					msg.item[i].amount = max;
 					msg.item[i].amount = max;
 				}
 				}
 			}else{
 			}else{
 				if( msg.item[i].amount > 1 ){
 				if( msg.item[i].amount > 1 ){
-					ShowWarning( "buildin_mail: amount %d is invalid for non-stackable item %hu.\n", msg.item[i].amount, msg.item[i].nameid );
+					ShowWarning( "buildin_mail: amount %d is invalid for non-stackable item %u.\n", msg.item[i].amount, msg.item[i].nameid );
 					msg.item[i].amount = 1;
 					msg.item[i].amount = 1;
 				}
 				}
 			}
 			}
@@ -24455,7 +24474,7 @@ BUILDIN_FUNC(mail){
 			script_removetop(st, -1, 0);
 			script_removetop(st, -1, 0);
 
 
 			if( msg.item[i].bound <= BOUND_NONE || msg.item[i].bound >= BOUND_MAX ){
 			if( msg.item[i].bound <= BOUND_NONE || msg.item[i].bound >= BOUND_MAX ){
-				ShowError( "buildin_mail: bound %d for item %hu is invalid.\n", msg.item[i].bound, msg.item[i].nameid );
+				ShowError( "buildin_mail: bound %d for item %u is invalid.\n", msg.item[i].bound, msg.item[i].nameid );
 				return SCRIPT_CMD_FAILURE;
 				return SCRIPT_CMD_FAILURE;
 			}
 			}
 		}
 		}
@@ -24473,10 +24492,10 @@ BUILDIN_FUNC(mail){
 			}
 			}
 
 
 			for( k = 0; k < num_items && start < end; k++, start++ ){
 			for( k = 0; k < num_items && start < end; k++, start++ ){
-				msg.item[k].card[i] = (unsigned short)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
+				msg.item[k].card[i] = (t_itemid)get_val2_num( st, reference_uid( id, start ), reference_getref( data ) );
 
 
 				if( msg.item[k].card[i] != 0 && !itemdb_exists(msg.item[k].card[i]) ){
 				if( msg.item[k].card[i] != 0 && !itemdb_exists(msg.item[k].card[i]) ){
-					ShowError( "buildin_mail: invalid card id %hu.\n", msg.item[k].card[i] );
+					ShowError( "buildin_mail: invalid card id %u.\n", msg.item[k].card[i] );
 					return SCRIPT_CMD_FAILURE;
 					return SCRIPT_CMD_FAILURE;
 				}
 				}
 			}
 			}

+ 1 - 0
src/map/script_constants.hpp

@@ -7833,6 +7833,7 @@
 	export_constant(UNT_GROUNDDRIFT_POISON);
 	export_constant(UNT_GROUNDDRIFT_POISON);
 	export_constant(UNT_GROUNDDRIFT_WATER);
 	export_constant(UNT_GROUNDDRIFT_WATER);
 	export_constant(UNT_GROUNDDRIFT_FIRE);
 	export_constant(UNT_GROUNDDRIFT_FIRE);
+	export_constant(UNT_EARTHQUAKE);
 	export_constant(UNT_EVILLAND);
 	export_constant(UNT_EVILLAND);
 	export_constant(UNT_EPICLESIS);
 	export_constant(UNT_EPICLESIS);
 	export_constant(UNT_EARTHSTRAIN);
 	export_constant(UNT_EARTHSTRAIN);

+ 6 - 6
src/map/searchstore.cpp

@@ -38,7 +38,7 @@ enum e_searchstore_effecttype
 };
 };
 
 
 /// Type for shop search function
 /// Type for shop search function
-typedef bool (*searchstore_search_t)(struct map_session_data* sd, unsigned short nameid);
+typedef bool (*searchstore_search_t)(struct map_session_data* sd, t_itemid nameid);
 typedef bool (*searchstore_searchall_t)(struct map_session_data* sd, const struct s_search_store_search* s);
 typedef bool (*searchstore_searchall_t)(struct map_session_data* sd, const struct s_search_store_search* s);
 
 
 /**
 /**
@@ -173,14 +173,14 @@ void searchstore_query(struct map_session_data* sd, unsigned char type, unsigned
 	// validate lists
 	// validate lists
 	for( i = 0; i < item_count; i++ ) {
 	for( i = 0; i < item_count; i++ ) {
 		if( !itemdb_exists(itemlist[i].itemId) ) {
 		if( !itemdb_exists(itemlist[i].itemId) ) {
-			ShowWarning("searchstore_query: Client resolved item %hu is not known.\n", itemlist[i].itemId);
+			ShowWarning("searchstore_query: Client resolved item %u is not known.\n", itemlist[i].itemId);
 			clif_search_store_info_failed(sd, SSI_FAILED_NOTHING_SEARCH_ITEM);
 			clif_search_store_info_failed(sd, SSI_FAILED_NOTHING_SEARCH_ITEM);
 			return;
 			return;
 		}
 		}
 	}
 	}
 	for( i = 0; i < card_count; i++ ) {
 	for( i = 0; i < card_count; i++ ) {
 		if( !itemdb_exists(cardlist[i].itemId) ) {
 		if( !itemdb_exists(cardlist[i].itemId) ) {
-			ShowWarning("searchstore_query: Client resolved card %hu is not known.\n", cardlist[i].itemId);
+			ShowWarning("searchstore_query: Client resolved card %u is not known.\n", cardlist[i].itemId);
 			clif_search_store_info_failed(sd, SSI_FAILED_NOTHING_SEARCH_ITEM);
 			clif_search_store_info_failed(sd, SSI_FAILED_NOTHING_SEARCH_ITEM);
 			return;
 			return;
 		}
 		}
@@ -309,7 +309,7 @@ void searchstore_close(struct map_session_data* sd)
  * @param store_id : store ID created by client
  * @param store_id : store ID created by client
  * @param nameid : item being searched
  * @param nameid : item being searched
  */
  */
-void searchstore_click(struct map_session_data* sd, uint32 account_id, int store_id, unsigned short nameid)
+void searchstore_click(struct map_session_data* sd, uint32 account_id, int store_id, t_itemid nameid)
 {
 {
 	unsigned int i;
 	unsigned int i;
 	struct map_session_data* pl_sd;
 	struct map_session_data* pl_sd;
@@ -322,7 +322,7 @@ void searchstore_click(struct map_session_data* sd, uint32 account_id, int store
 
 
 	ARR_FIND( 0, sd->searchstore.count, i,  sd->searchstore.items[i].store_id == store_id && sd->searchstore.items[i].account_id == account_id && sd->searchstore.items[i].nameid == nameid );
 	ARR_FIND( 0, sd->searchstore.count, i,  sd->searchstore.items[i].store_id == store_id && sd->searchstore.items[i].account_id == account_id && sd->searchstore.items[i].nameid == nameid );
 	if( i == sd->searchstore.count ) { // no such result, crafted
 	if( i == sd->searchstore.count ) { // no such result, crafted
-		ShowWarning("searchstore_click: Received request with item %hu of account %d, which is not part of current result set (account_id=%d, char_id=%d).\n", nameid, account_id, sd->bl.id, sd->status.char_id);
+		ShowWarning("searchstore_click: Received request with item %u of account %d, which is not part of current result set (account_id=%d, char_id=%d).\n", nameid, account_id, sd->bl.id, sd->status.char_id);
 		clif_search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE);
 		clif_search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE);
 		return;
 		return;
 	}
 	}
@@ -400,7 +400,7 @@ void searchstore_clearremote(struct map_session_data* sd)
  * @param card : card in the item
  * @param card : card in the item
  * @param refine : refine of the item
  * @param refine : refine of the item
  */
  */
-bool searchstore_result(struct map_session_data* sd, int store_id, uint32 account_id, const char* store_name, unsigned short nameid, unsigned short amount, unsigned int price, const unsigned short* card, unsigned char refine)
+bool searchstore_result(struct map_session_data* sd, int store_id, uint32 account_id, const char* store_name, t_itemid nameid, unsigned short amount, unsigned int price, const t_itemid* card, unsigned char refine)
 {
 {
 	struct s_search_store_info_item* ssitem;
 	struct s_search_store_info_item* ssitem;
 
 

+ 4 - 4
src/map/searchstore.hpp

@@ -27,10 +27,10 @@ struct s_search_store_info_item {
 	int store_id;
 	int store_id;
 	uint32 account_id;
 	uint32 account_id;
 	char store_name[MESSAGE_SIZE];
 	char store_name[MESSAGE_SIZE];
-	unsigned short nameid;
+	t_itemid nameid;
 	unsigned short amount;
 	unsigned short amount;
 	unsigned int price;
 	unsigned int price;
-	unsigned short card[MAX_SLOTS];
+	t_itemid card[MAX_SLOTS];
 	unsigned char refine;
 	unsigned char refine;
 };
 };
 
 
@@ -52,9 +52,9 @@ bool searchstore_querynext(struct map_session_data* sd);
 void searchstore_next(struct map_session_data* sd);
 void searchstore_next(struct map_session_data* sd);
 void searchstore_clear(struct map_session_data* sd);
 void searchstore_clear(struct map_session_data* sd);
 void searchstore_close(struct map_session_data* sd);
 void searchstore_close(struct map_session_data* sd);
-void searchstore_click(struct map_session_data* sd, uint32 account_id, int store_id, unsigned short nameid);
+void searchstore_click(struct map_session_data* sd, uint32 account_id, int store_id, t_itemid nameid);
 bool searchstore_queryremote(struct map_session_data* sd, uint32 account_id);
 bool searchstore_queryremote(struct map_session_data* sd, uint32 account_id);
 void searchstore_clearremote(struct map_session_data* sd);
 void searchstore_clearremote(struct map_session_data* sd);
-bool searchstore_result(struct map_session_data* sd, int store_id, uint32 account_id, const char* store_name, unsigned short nameid, unsigned short amount, unsigned int price, const unsigned short* card, unsigned char refine);
+bool searchstore_result(struct map_session_data* sd, int store_id, uint32 account_id, const char* store_name, t_itemid nameid, unsigned short amount, unsigned int price, const t_itemid* card, unsigned char refine);
 
 
 #endif /* SEARCHSTORE_HPP */
 #endif /* SEARCHSTORE_HPP */

+ 226 - 258
src/map/skill.cpp

@@ -94,7 +94,7 @@ ReadingSpellbookDatabase reading_spellbook_db;
 #define MAX_SKILL_CHANGEMATERIAL_DB 75
 #define MAX_SKILL_CHANGEMATERIAL_DB 75
 #define MAX_SKILL_CHANGEMATERIAL_SET 3
 #define MAX_SKILL_CHANGEMATERIAL_SET 3
 struct s_skill_changematerial_db {
 struct s_skill_changematerial_db {
-	unsigned short nameid;
+	t_itemid nameid;
 	unsigned short rate;
 	unsigned short rate;
 	unsigned short qty[MAX_SKILL_CHANGEMATERIAL_SET];
 	unsigned short qty[MAX_SKILL_CHANGEMATERIAL_SET];
 	unsigned short qty_rate[MAX_SKILL_CHANGEMATERIAL_SET];
 	unsigned short qty_rate[MAX_SKILL_CHANGEMATERIAL_SET];
@@ -1704,20 +1704,12 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
 	case AB_ADORAMUS:
 	case AB_ADORAMUS:
 		sc_start(src,bl, SC_ADORAMUS, skill_lv * 4 + (sd ? sd->status.job_level : 50) / 2, skill_lv, skill_get_time2(skill_id, skill_lv));
 		sc_start(src,bl, SC_ADORAMUS, skill_lv * 4 + (sd ? sd->status.job_level : 50) / 2, skill_lv, skill_get_time2(skill_id, skill_lv));
 		break;
 		break;
-	case WL_CRIMSONROCK:
-		sc_start(src,bl, SC_STUN, 40, skill_lv, skill_get_time(skill_id, skill_lv));
-		break;
 	case WL_COMET:
 	case WL_COMET:
+		sc_start(src, bl, status_skill2sc(skill_id), 100, skill_lv, 20000);
+		break;
 	case NPC_COMET:
 	case NPC_COMET:
 		sc_start4(src,bl,SC_BURNING,100,skill_lv,1000,src->id,0,skill_get_time(skill_id,skill_lv));
 		sc_start4(src,bl,SC_BURNING,100,skill_lv,1000,src->id,0,skill_get_time(skill_id,skill_lv));
 		break;
 		break;
-	case WL_EARTHSTRAIN:
-		if (dmg_lv != ATK_DEF) // Only strip if we make a successful hit.
-			break;
-
-		skill_strip_equip(src, bl, skill_id, skill_lv);
-		break;
-	case WL_JACKFROST:
 	case NPC_JACKFROST:
 	case NPC_JACKFROST:
 		sc_start(src,bl,SC_FREEZE,200,skill_lv,skill_get_time(skill_id,skill_lv));
 		sc_start(src,bl,SC_FREEZE,200,skill_lv,skill_get_time(skill_id,skill_lv));
 		break;
 		break;
@@ -1867,7 +1859,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
 						break;
 						break;
 					}
 					}
 			}
 			}
-			sd->itemid = -1;
+			sd->itemid = 0;
 		}
 		}
 		break;
 		break;
 	case GN_HELLS_PLANT_ATK:
 	case GN_HELLS_PLANT_ATK:
@@ -2802,13 +2794,6 @@ bool skill_strip_equip(struct block_list *src, struct block_list *target, uint16
 		case SC_STRIPACCESSARY:
 		case SC_STRIPACCESSARY:
 			location = EQP_ACC;
 			location = EQP_ACC;
 			break;
 			break;
-		case WL_EARTHSTRAIN:
-			location = EQP_SHIELD|EQP_ARMOR|EQP_HELM;
-			if (skill_lv >= 4)
-				location |= EQP_WEAPON;
-			if (skill_lv >= 5)
-				location |= EQP_ACC;
-			break;
 	}
 	}
 
 
 	for (uint8 i = 0; i < ARRAYLENGTH(pos); i++) {
 	for (uint8 i = 0; i < ARRAYLENGTH(pos); i++) {
@@ -3480,10 +3465,6 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *
 	dmg_type = (skill_id == 0) ? DMG_SPLASH : skill_get_hit(skill_id);
 	dmg_type = (skill_id == 0) ? DMG_SPLASH : skill_get_hit(skill_id);
 
 
 	switch( skill_id ) {
 	switch( skill_id ) {
-		case WL_HELLINFERNO:
-			if (dmg.dmg_lv == ATK_DEF && !(flag&ELE_DARK)) // Burning only starts if the fire attack successfully lands
-				sc_start4(src, bl, SC_BURNING, 55 + 5 * skill_lv, skill_lv, 1000, src->id, 0, skill_get_time(skill_id, skill_lv));
-			break;
 		case SC_TRIANGLESHOT:
 		case SC_TRIANGLESHOT:
 			if( rnd()%100 > (1 + skill_lv) )
 			if( rnd()%100 > (1 + skill_lv) )
 				dmg.blewcount = 0;
 				dmg.blewcount = 0;
@@ -3552,7 +3533,6 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *
 			else // the central target doesn't display an animation
 			else // the central target doesn't display an animation
 				dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, -2, DMG_SPLASH); // needs -2(!) as skill level
 				dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, -2, DMG_SPLASH); // needs -2(!) as skill level
 			break;
 			break;
-		case WL_HELLINFERNO:
 		case SR_EARTHSHAKER:
 		case SR_EARTHSHAKER:
 			dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,1,skill_id,-2,DMG_SINGLE);
 			dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,1,skill_id,-2,DMG_SINGLE);
 			break;
 			break;
@@ -3580,6 +3560,9 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *
 		case LG_OVERBRAND_PLUSATK:
 		case LG_OVERBRAND_PLUSATK:
 			dmg.dmotion = clif_skill_damage(dsrc,bl,tick,status_get_amotion(src),dmg.dmotion,damage,dmg.div_,skill_id,-1,DMG_SPLASH);
 			dmg.dmotion = clif_skill_damage(dsrc,bl,tick,status_get_amotion(src),dmg.dmotion,damage,dmg.div_,skill_id,-1,DMG_SPLASH);
 			break;
 			break;
+		case NPC_EARTHQUAKE:
+			dmg.dmotion = clif_skill_damage(src, bl, tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skill_id, -1, DMG_ENDURE);
+			break;
 		case NPC_DARKPIERCING:
 		case NPC_DARKPIERCING:
 		case EL_FIRE_BOMB:
 		case EL_FIRE_BOMB:
 		case EL_FIRE_BOMB_ATK:
 		case EL_FIRE_BOMB_ATK:
@@ -4058,7 +4041,8 @@ static int skill_check_condition_mercenary(struct block_list *bl, uint16 skill_i
 	struct status_data *status;
 	struct status_data *status;
 	struct map_session_data *sd = NULL;
 	struct map_session_data *sd = NULL;
 	int i, hp, sp, hp_rate, sp_rate, state, mhp;
 	int i, hp, sp, hp_rate, sp_rate, state, mhp;
-	int itemid[MAX_SKILL_ITEM_REQUIRE],amount[ARRAYLENGTH(itemid)],index[ARRAYLENGTH(itemid)];
+	t_itemid itemid[MAX_SKILL_ITEM_REQUIRE];
+	int amount[ARRAYLENGTH(itemid)], index[ARRAYLENGTH(itemid)];
 
 
 	nullpo_retr(0, bl);
 	nullpo_retr(0, bl);
 
 
@@ -4130,7 +4114,7 @@ static int skill_check_condition_mercenary(struct block_list *bl, uint16 skill_i
 	for( i = 0; i < ARRAYLENGTH(itemid); i++ )
 	for( i = 0; i < ARRAYLENGTH(itemid); i++ )
 	{
 	{
 		index[i] = -1;
 		index[i] = -1;
-		if( itemid[i] < 1 ) continue; // No item
+		if( itemid[i] == 0 ) continue; // No item
 		index[i] = pc_search_inventory(sd, itemid[i]);
 		index[i] = pc_search_inventory(sd, itemid[i]);
 		if( index[i] < 0 || sd->inventory.u.items_inventory[index[i]].amount < amount[i] )
 		if( index[i] < 0 || sd->inventory.u.items_inventory[index[i]].amount < amount[i] )
 		{
 		{
@@ -4262,14 +4246,6 @@ static TIMER_FUNC(skill_timerskill){
 				case BS_HAMMERFALL:
 				case BS_HAMMERFALL:
 					sc_start(src, target, status_skill2sc(skl->skill_id), skl->type, skl->skill_lv, skill_get_time2(skl->skill_id, skl->skill_lv));
 					sc_start(src, target, status_skill2sc(skl->skill_id), skl->type, skl->skill_lv, skill_get_time2(skl->skill_id, skl->skill_lv));
 					break;
 					break;
-				case NPC_EARTHQUAKE:
-					if( skl->type > 1 )
-						skill_addtimerskill(src,tick+250,src->id,0,0,skl->skill_id,skl->skill_lv,skl->type-1,skl->flag);
-					skill_area_temp[0] = map_foreachinallrange(skill_area_sub, src, skill_get_splash(skl->skill_id, skl->skill_lv), BL_CHAR, src, skl->skill_id, skl->skill_lv, tick, BCT_ENEMY, skill_area_sub_count);
-					skill_area_temp[1] = src->id;
-					skill_area_temp[2] = 0;
-					map_foreachinallrange(skill_area_sub, src, skill_get_splash(skl->skill_id, skl->skill_lv), splash_target(src), src, skl->skill_id, skl->skill_lv, tick, skl->flag, skill_castend_damage_id);
-					break;
 				case WZ_WATERBALL:
 				case WZ_WATERBALL:
 				{
 				{
 					//Get the next waterball cell to consume
 					//Get the next waterball cell to consume
@@ -4342,11 +4318,7 @@ static TIMER_FUNC(skill_timerskill){
 							}
 							}
 							if (j) {
 							if (j) {
 								i = applyeffects[rnd()%j];
 								i = applyeffects[rnd()%j];
-								status_change_start(src, target, static_cast<sc_type>(i), 10000, skl->skill_lv,
-									(i == SC_BURNING ? 1000 : (i == SC_BLEEDING ? src->id : 0)),
-									(i == SC_BURNING ? src->id : 0), 0,
-									(i == SC_BURNING ? 15000 : (i == SC_FREEZING ? 40000 :
-									(i == SC_BLEEDING ? 120000 : 5000))), SCSTART_NONE);
+								sc_start(src, target, static_cast<sc_type>(i), 100, skl->skill_lv, (i == SC_BURNING ? 18000 : (i == SC_FREEZING ? 27000 : (i == SC_BLEEDING ? 108000 : 4500))));
 							}
 							}
 						}
 						}
 					}
 					}
@@ -5111,7 +5083,6 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
 	case NJ_HUUMA:
 	case NJ_HUUMA:
 	case ASC_METEORASSAULT:
 	case ASC_METEORASSAULT:
 	case GS_SPREADATTACK:
 	case GS_SPREADATTACK:
-	case NPC_EARTHQUAKE:
 	case NPC_PULSESTRIKE:
 	case NPC_PULSESTRIKE:
 	case NPC_HELLJUDGEMENT:
 	case NPC_HELLJUDGEMENT:
 	case NPC_VAMPIRE_GIFT:
 	case NPC_VAMPIRE_GIFT:
@@ -5226,9 +5197,6 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
 				case MH_XENO_SLASHER:
 				case MH_XENO_SLASHER:
 					clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, DMG_SINGLE);
 					clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, DMG_SINGLE);
 					break;
 					break;
-				case NPC_EARTHQUAKE: //FIXME: Isn't EarthQuake a ground skill after all?
-					skill_addtimerskill(src,tick+250,src->id,0,0,skill_id,skill_lv,2,flag|BCT_ENEMY|SD_SPLASH|1);
-					break;
 				case NPC_REVERBERATION_ATK:
 				case NPC_REVERBERATION_ATK:
 				case NC_ARMSCANNON:
 				case NC_ARMSCANNON:
 					skill_area_temp[1] = 0;
 					skill_area_temp[1] = 0;
@@ -5733,86 +5701,99 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
 		break;
 		break;
 
 
 	case WL_TETRAVORTEX:
 	case WL_TETRAVORTEX:
-		if( sc ) { // No SC? No spheres
-			int spheres[5] = { 0, 0, 0, 0, 0 },
-				positions[5] = {-1,-1,-1,-1,-1 },
-				i, j = 0, k, subskill = 0;
-
-			for( i = SC_SPHERE_1; i <= SC_SPHERE_5; i++ )
-				if( sc->data[i] ) {
-					spheres[j] = i;
-					positions[j] = sc->data[i]->val2;
-					j++;
-				}
+		if (sd == nullptr) { // Monster usage
+			uint8 i = 0;
+			const static std::vector<std::vector<uint16>> tetra_skills = { { WL_TETRAVORTEX_FIRE, 1 },
+																		   { WL_TETRAVORTEX_WIND, 4 },
+																		   { WL_TETRAVORTEX_WATER, 2 },
+																		   { WL_TETRAVORTEX_GROUND, 8 } };
+
+			for (const auto &skill : tetra_skills) {
+				if (skill_lv > 5) {
+					skill_area_temp[0] = i;
+					skill_area_temp[1] = skill[1];
+					map_foreachinallrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, src, skill[0], skill_lv, tick, flag | BCT_ENEMY, skill_castend_damage_id);
+				} else
+					skill_addtimerskill(src, tick + i * 200, bl->id, skill[1], 0, skill[0], skill_lv, i, flag);
+				i++;
+			}
+		} else if (sc) { // No SC? No spheres
+			int i, k = 0;
 
 
-			// Sphere Sort, this time from new to old
-			for( i = 0; i <= j - 2; i++ )
-				for( k = i + 1; k <= j - 1; k++ )
-					if( positions[i] < positions[k] ) {
-						SWAP(positions[i],positions[k]);
-						SWAP(spheres[i],spheres[k]);
-					}
+			if (sc->data[SC_SPHERE_5]) // If 5 spheres, remove last one (based on reverse order) and only do 4 actions (Official behavior)
+				status_change_end(src, SC_SPHERE_1, INVALID_TIMER);
 
 
-			if(j == 5) { // If 5 spheres, remove last one and only do 4 actions (Official behavior)
-				status_change_end(src, static_cast<sc_type>(spheres[4]), INVALID_TIMER);
-				j = 4;
-			}
+			for (i = SC_SPHERE_5; i >= SC_SPHERE_1; i--) { // Loop should always be 4 for regular players, but unconditional_skill could be less
+				if (sc->data[static_cast<sc_type>(i)] == nullptr)
+					continue;
+
+				uint16 subskill = 0;
 
 
-			k = 0;
-			for( i = 0; i < j; i++ ) { // Loop should always be 4 for regular players, but unconditional_skill could be less
-				switch( sc->data[spheres[i]]->val1 ) {
-					case WLS_FIRE:  subskill = WL_TETRAVORTEX_FIRE; k |= 1; break;
-					case WLS_WIND:  subskill = WL_TETRAVORTEX_WIND; k |= 4; break;
-					case WLS_WATER: subskill = WL_TETRAVORTEX_WATER; k |= 2; break;
-					case WLS_STONE: subskill = WL_TETRAVORTEX_GROUND; k |= 8; break;
+				switch (sc->data[static_cast<sc_type>(i)]->val1) {
+					case WLS_FIRE:
+						subskill = WL_TETRAVORTEX_FIRE;
+						k |= 1;
+						break;
+					case WLS_WIND:
+						subskill = WL_TETRAVORTEX_WIND;
+						k |= 4;
+						break;
+					case WLS_WATER:
+						subskill = WL_TETRAVORTEX_WATER;
+						k |= 2;
+						break;
+					case WLS_STONE:
+						subskill = WL_TETRAVORTEX_GROUND;
+						k |= 8;
+						break;
 				}
 				}
 
 
 				if (skill_lv > 5) {
 				if (skill_lv > 5) {
-					skill_area_temp[0] = i;
+					skill_area_temp[0] = abs(i - SC_SPHERE_5);
 					skill_area_temp[1] = k;
 					skill_area_temp[1] = k;
 					map_foreachinallrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, src, subskill, skill_lv, tick, flag | BCT_ENEMY, skill_castend_damage_id);
 					map_foreachinallrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, src, subskill, skill_lv, tick, flag | BCT_ENEMY, skill_castend_damage_id);
 				} else
 				} else
-					skill_addtimerskill(src, tick + i * 200, bl->id, k, 0, subskill, skill_lv, i, flag);
-				status_change_end(src, static_cast<sc_type>(spheres[i]), INVALID_TIMER);
+					skill_addtimerskill(src, tick + abs(i - SC_SPHERE_5) * 200, bl->id, k, 0, subskill, skill_lv, abs(i - SC_SPHERE_5), flag);
+				status_change_end(src, static_cast<sc_type>(i), INVALID_TIMER);
 			}
 			}
 		}
 		}
 		break;
 		break;
 
 
 	case WL_RELEASE:
 	case WL_RELEASE:
-		if( sd )
-		{
+		if (sc == nullptr)
+			break;
+		if (sd) {
 			int i;
 			int i;
 
 
 			skill_toggle_magicpower(src, skill_id); // No hit will be amplified
 			skill_toggle_magicpower(src, skill_id); // No hit will be amplified
-			// Priority is to release SpellBook
-			if( sc && sc->data[SC_FREEZE_SP] )
-			{ // SpellBook
-				uint16 pres_skill_id, pres_skill_lv, point, s = 0;
-				int spell[SC_MAXSPELLBOOK-SC_SPELLBOOK1 + 1];
-				int cooldown;
+			if (skill_lv == 1) { // SpellBook
+				if (sc->data[SC_FREEZE_SP] == nullptr)
+					break;
 
 
-				for(i = SC_MAXSPELLBOOK; i >= SC_SPELLBOOK1; i--) // List all available spell to be released
-					if( sc->data[i] ) spell[s++] = i;
+				bool found_spell = false;
 
 
-				if ( s == 0 )
-					break;
+				for (i = SC_MAXSPELLBOOK; i >= SC_SPELLBOOK1; i--) { // List all available spell to be released
+					if (sc->data[i] != nullptr) {
+						found_spell = true;
+						break;
+					}
+				}
 
 
-				i = spell[s==1?0:rnd()%s];// Random select of spell to be released.
-				if(sc->data[i] ){// Now extract the data from the preserved spell
-					pres_skill_id = sc->data[i]->val1;
-					pres_skill_lv = sc->data[i]->val2;
-					point = sc->data[i]->val3;
-					status_change_end(src, static_cast<sc_type>(i), INVALID_TIMER);
-				}else //something went wrong :(
+				if (!found_spell)
 					break;
 					break;
 
 
+				// Now extract the data from the preserved spell
+				uint16 pres_skill_id = sc->data[i]->val1;
+				uint16 pres_skill_lv = sc->data[i]->val2;
+				uint16 point = sc->data[i]->val3;
+
+				status_change_end(src, static_cast<sc_type>(i), INVALID_TIMER);
+
 				if( sc->data[SC_FREEZE_SP]->val2 > point )
 				if( sc->data[SC_FREEZE_SP]->val2 > point )
 					sc->data[SC_FREEZE_SP]->val2 -= point;
 					sc->data[SC_FREEZE_SP]->val2 -= point;
 				else // Last spell to be released
 				else // Last spell to be released
 					status_change_end(src, SC_FREEZE_SP, INVALID_TIMER);
 					status_change_end(src, SC_FREEZE_SP, INVALID_TIMER);
 
 
-				if( bl->type != BL_SKILL ) /* skill types will crash the client */
-					clif_skill_nodamage(src, bl, pres_skill_id, pres_skill_lv, 1);
 				if( !skill_check_condition_castbegin(sd, pres_skill_id, pres_skill_lv) )
 				if( !skill_check_condition_castbegin(sd, pres_skill_id, pres_skill_lv) )
 					break;
 					break;
 
 
@@ -5835,62 +5816,41 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
 				sd->ud.canact_tick = i64max(tick + skill_delayfix(src, pres_skill_id, pres_skill_lv), sd->ud.canact_tick);
 				sd->ud.canact_tick = i64max(tick + skill_delayfix(src, pres_skill_id, pres_skill_lv), sd->ud.canact_tick);
 				clif_status_change(src, EFST_POSTDELAY, 1, skill_delayfix(src, pres_skill_id, pres_skill_lv), 0, 0, 0);
 				clif_status_change(src, EFST_POSTDELAY, 1, skill_delayfix(src, pres_skill_id, pres_skill_lv), 0, 0, 0);
 
 
-				cooldown = pc_get_skillcooldown(sd,pres_skill_id, pres_skill_lv);
-				if( cooldown )
-					skill_blockpc_start(sd, pres_skill_id, cooldown);
-			}
-			else
-			{ // Summon Balls
-				int j = 0, k;
-				int spheres[5] = { 0, 0, 0, 0, 0 },
-					positions[5] = {-1,-1,-1,-1,-1 };
+				int cooldown = pc_get_skillcooldown(sd,pres_skill_id, pres_skill_lv);
 
 
-				for( i = SC_SPHERE_1; i <= SC_SPHERE_5; i++ )
-					if( sc && sc->data[i] )
-					{
-						spheres[j] = i;
-						positions[j] = sc->data[i]->val2;
-						sc->data[i]->val2--; // Prepares for next position
-						j++;
-					}
-
-				if( j == 0 )
-				{ // No Spheres
-					clif_skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON_NONE,0);
-					break;
-				}
+				if( cooldown > 0 )
+					skill_blockpc_start(sd, pres_skill_id, cooldown);
+			} else { // Summoned Balls
+				for (i = SC_SPHERE_5; i >= SC_SPHERE_1; i--) {
+					if (sc->data[static_cast<sc_type>(i)] == nullptr)
+						continue;
 
 
-				// Sphere Sort
-				for( i = 0; i <= j - 2; i++ )
-					for( k = i + 1; k <= j - 1; k++ )
-						if( positions[i] > positions[k] )
-						{
-							SWAP(positions[i],positions[k]);
-							SWAP(spheres[i],spheres[k]);
-						}
+					int skele = WL_RELEASE - 5 + sc->data[static_cast<sc_type>(i)]->val1 - WLS_FIRE; // Convert Ball Element into Skill ATK for balls
 
 
-				if( skill_lv == 1 ) j = 1; // Limit only to one ball
-				for( i = 0; i < j; i++ )
-				{
-					int skele = WL_RELEASE - 5 + sc->data[spheres[i]]->val1 - WLS_FIRE; // Convert Ball Element into Skill ATK for balls
 					// WL_SUMMON_ATK_FIRE, WL_SUMMON_ATK_WIND, WL_SUMMON_ATK_WATER, WL_SUMMON_ATK_GROUND
 					// WL_SUMMON_ATK_FIRE, WL_SUMMON_ATK_WIND, WL_SUMMON_ATK_WATER, WL_SUMMON_ATK_GROUND
-					skill_addtimerskill(src,tick+(t_tick)status_get_adelay(src)*i,bl->id,0,0,skele,sc->data[spheres[i]]->val3,BF_MAGIC,flag|SD_LEVEL);
-					status_change_end(src, static_cast<sc_type>(spheres[i]), INVALID_TIMER); // Eliminate ball
+					skill_addtimerskill(src, tick + (t_tick)status_get_adelay(src) * abs(i - SC_SPHERE_1), bl->id, 0, 0, skele, sc->data[static_cast<sc_type>(i)]->val2, BF_MAGIC, flag | SD_LEVEL);
+					status_change_end(src, static_cast<sc_type>(i), INVALID_TIMER); // Eliminate ball
 				}
 				}
-				clif_skill_nodamage(src,bl,skill_id,0,1);
+				clif_skill_nodamage(src, bl, skill_id, 0, 1);
 			}
 			}
 		}
 		}
 		break;
 		break;
 	case WL_FROSTMISTY:
 	case WL_FROSTMISTY:
 		// Causes Freezing status through walls.
 		// Causes Freezing status through walls.
-		sc_start(src,bl,status_skill2sc(skill_id),20+12*skill_lv+(sd ? sd->status.job_level : 50)/5,skill_lv,skill_get_time(skill_id,skill_lv));
+		sc_start(src, bl, status_skill2sc(skill_id), 25 + 5 * skill_lv, skill_lv, skill_get_time(skill_id, skill_lv));
+		sc_start(src, bl, SC_MISTY_FROST, 100, skill_lv, skill_get_time2(skill_id, skill_lv));
 		// Doesn't deal damage through non-shootable walls.
 		// Doesn't deal damage through non-shootable walls.
 		if( !battle_config.skill_wall_check || (battle_config.skill_wall_check && path_search(NULL,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKWALL)) )
 		if( !battle_config.skill_wall_check || (battle_config.skill_wall_check && path_search(NULL,src->m,src->x,src->y,bl->x,bl->y,1,CELL_CHKWALL)) )
 			skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION);
 			skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION);
 		break;
 		break;
 	case WL_HELLINFERNO:
 	case WL_HELLINFERNO:
-		skill_attack(BF_MAGIC,src,src,bl,skill_id,skill_lv,tick,flag);
-		skill_addtimerskill(src,tick + 200,bl->id,0,0,skill_id,skill_lv,BF_MAGIC,flag|ELE_DARK);
+		if (flag & 1) {
+			skill_attack(BF_MAGIC, src, src, bl, skill_id, skill_lv, tick, flag);
+			skill_addtimerskill(src, tick + 300, bl->id, 0, 0, skill_id, skill_lv, BF_MAGIC, flag | 2);
+		} else {
+			clif_skill_nodamage(src, bl, skill_id, skill_lv, 1);
+			map_foreachinrange(skill_area_sub, bl, skill_get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag | BCT_ENEMY | SD_SPLASH | 1, skill_castend_damage_id);
+		}
 		break;
 		break;
 	case RA_WUGSTRIKE:
 	case RA_WUGSTRIKE:
 		if( sd && pc_isridingwug(sd) ){
 		if( sd && pc_isridingwug(sd) ){
@@ -7585,7 +7545,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 		clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
 		clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
 	case SR_EARTHSHAKER:
 	case SR_EARTHSHAKER:
 	case NC_INFRAREDSCAN:
 	case NC_INFRAREDSCAN:
-	case NPC_EARTHQUAKE:
 	case NPC_VAMPIRE_GIFT:
 	case NPC_VAMPIRE_GIFT:
 	case NPC_HELLJUDGEMENT:
 	case NPC_HELLJUDGEMENT:
 	case NPC_PULSESTRIKE:
 	case NPC_PULSESTRIKE:
@@ -10072,12 +10031,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 			clif_skill_fail(sd,skill_id,USESKILL_FAIL_TOTARGET,0);
 			clif_skill_fail(sd,skill_id,USESKILL_FAIL_TOTARGET,0);
 		break;
 		break;
 
 
-	case WL_FROSTMISTY:
-		clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
-		map_foreachinallrange(skill_area_sub,bl,skill_get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill_castend_damage_id);
-		break;
-
-	case WL_JACKFROST:
 	case NPC_JACKFROST:
 	case NPC_JACKFROST:
 		clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
 		clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
 		map_foreachinrange(skill_area_sub,bl,skill_get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id);
 		map_foreachinrange(skill_area_sub,bl,skill_get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id);
@@ -10123,53 +10076,65 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 	case WL_SUMMONWB:
 	case WL_SUMMONWB:
 	case WL_SUMMONSTONE:
 	case WL_SUMMONSTONE:
 		{
 		{
-			short element = 0, sctype = 0, pos = -1;
-			struct status_change *sc = status_get_sc(src);
+			status_change *sc = status_get_sc(src);
 
 
-			if( !sc )
+			if (sc == nullptr)
 				break;
 				break;
 
 
-			for( i = SC_SPHERE_1; i <= SC_SPHERE_5; i++ ) {
-				if( !sctype && !sc->data[i] )
-					sctype = i; // Take the free SC
-				if( sc->data[i] )
-					pos = max(sc->data[i]->val2,pos);
-			}
+			e_wl_spheres element;
 
 
-			if( !sctype ) {
-				if( sd ) // No free slots to put SC
-					clif_skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON,0);
-				break;
+			switch (skill_id) { // Set val2. The SC element for this ball
+				case WL_SUMMONFB:
+					element = WLS_FIRE;
+					break;
+				case WL_SUMMONBL:
+					element = WLS_WIND;
+					break;
+				case WL_SUMMONWB:
+					element = WLS_WATER;
+					break;
+				case WL_SUMMONSTONE:
+					element = WLS_STONE;
+					break;
 			}
 			}
 
 
-			pos++; // Used in val2 for SC. Indicates the order of this ball
-			switch( skill_id ) { // Set val1. The SC element for this ball
-				case WL_SUMMONFB:    element = WLS_FIRE;  break;
-				case WL_SUMMONBL:    element = WLS_WIND;  break;
-				case WL_SUMMONWB:    element = WLS_WATER; break;
-				case WL_SUMMONSTONE: element = WLS_STONE; break;
+			if (skill_lv == 1) {
+				sc_type sphere = SC_NONE;
+
+				for (i = SC_SPHERE_1; i <= SC_SPHERE_5; i++) {
+					if (sc->data[i] == nullptr) {
+						sphere = static_cast<sc_type>(i); // Take the free SC
+						break;
+					}
+				}
+
+				if (sphere == SC_NONE) {
+					if (sd) // No free slots to put SC
+						clif_skill_fail(sd, skill_id, USESKILL_FAIL_SUMMON, 0);
+					break;
+				}
+
+				sc_start2(src, src, sphere, 100, element, skill_lv, skill_get_time(skill_id, skill_lv));
+			} else {
+				for (i = SC_SPHERE_1; i <= SC_SPHERE_5; i++) {
+					status_change_end(src, static_cast<sc_type>(i), INVALID_TIMER); // Removes previous type
+					sc_start2(src, src, static_cast<sc_type>(i), 100, element, skill_lv, skill_get_time(skill_id, skill_lv));
+				}
 			}
 			}
 
 
-			sc_start4(src,src,(enum sc_type)sctype,100,element,pos,skill_lv,0,skill_get_time(skill_id,skill_lv));
-			clif_skill_nodamage(src,bl,skill_id,0,0);
+			clif_skill_nodamage(src, bl, skill_id, 0, 0);
 		}
 		}
 		break;
 		break;
 
 
-	case WL_READING_SB:
-		if( sd ) {
-			struct status_change *sc = status_get_sc(bl);
-
-			for( i = SC_SPELLBOOK1; i <= SC_MAXSPELLBOOK; i++)
-				if( sc && !sc->data[i] )
-					break;
-			if( i == SC_MAXSPELLBOOK ) {
-				clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_READING, 0);
+	case WL_READING_SB_READING:
+		if (sd) {
+			if (pc_checkskill(sd, WL_READING_SB) == 0 || skill_lv < 1 || skill_lv > 10) {
+				clif_skill_fail(sd, skill_id, USESKILL_FAIL_SPELLBOOK_READING, 0);
 				break;
 				break;
 			}
 			}
 
 
-			sc_start(src,bl, SC_STOP, 100, skill_lv, INFINITE_TICK); //Can't move while selecting a spellbook.
-			clif_spellbook_list(sd);
 			clif_skill_nodamage(src, bl, skill_id, skill_lv, 1);
 			clif_skill_nodamage(src, bl, skill_id, skill_lv, 1);
+			skill_spellbook(sd, ITEMID_WL_MB_SG + skill_lv - 1);
 		}
 		}
 		break;
 		break;
 
 
@@ -11015,13 +10980,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 		break;
 		break;
 	case GN_SLINGITEM:
 	case GN_SLINGITEM:
 		if( sd ) {
 		if( sd ) {
-			int ammo_id;
-
 			i = sd->equip_index[EQI_AMMO];
 			i = sd->equip_index[EQI_AMMO];
 			if( i < 0 )
 			if( i < 0 )
 				break; // No ammo.
 				break; // No ammo.
-			ammo_id = sd->inventory_data[i]->nameid;
-			if( ammo_id <= 0 )
+			t_itemid ammo_id = sd->inventory_data[i]->nameid;
+			if( ammo_id == 0 )
 				break;
 				break;
 			sd->itemid = ammo_id;
 			sd->itemid = ammo_id;
 			if( itemdb_group_item_exists(IG_BOMB, ammo_id) ) {
 			if( itemdb_group_item_exists(IG_BOMB, ammo_id) ) {
@@ -11872,6 +11835,7 @@ TIMER_FUNC(skill_castend_id){
 				}
 				}
 			case GN_WALLOFTHORN:
 			case GN_WALLOFTHORN:
 			case SC_ESCAPE:
 			case SC_ESCAPE:
+			case WL_FROSTMISTY:
 			case SU_CN_POWDERING:
 			case SU_CN_POWDERING:
 				ud->skillx = target->x;
 				ud->skillx = target->x;
 				ud->skilly = target->y;
 				ud->skilly = target->y;
@@ -12448,6 +12412,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
 		skill_unitsetting(src,skill_id,skill_lv,x,y,0);
 		skill_unitsetting(src,skill_id,skill_lv,x,y,0);
 		flag|=1;
 		flag|=1;
 		break;
 		break;
+	case NPC_EARTHQUAKE:
+		clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, DMG_SINGLE);
+		skill_unitsetting(src, skill_id, skill_lv, x, y, 0);
+		break;
 #ifndef RENEWAL
 #ifndef RENEWAL
 	case HP_BASILICA:
 	case HP_BASILICA:
 		if( sc->data[SC_BASILICA] ) {
 		if( sc->data[SC_BASILICA] ) {
@@ -12739,6 +12707,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
 	case NC_COLDSLOWER:
 	case NC_COLDSLOWER:
 	case RK_DRAGONBREATH:
 	case RK_DRAGONBREATH:
 	case RK_DRAGONBREATH_WATER:
 	case RK_DRAGONBREATH_WATER:
+	case WL_FROSTMISTY:
 	case RL_HAMMER_OF_GOD:
 	case RL_HAMMER_OF_GOD:
 		// Cast center might be relevant later (e.g. for knockback direction)
 		// Cast center might be relevant later (e.g. for knockback direction)
 		skill_area_temp[4] = x;
 		skill_area_temp[4] = x;
@@ -13318,7 +13287,8 @@ struct skill_unit_group *skill_unitsetting(struct block_list *src, uint16 skill_
 	int i, val1 = 0, val2 = 0, val3 = 0;
 	int i, val1 = 0, val2 = 0, val3 = 0;
 	t_tick limit;
 	t_tick limit;
 	int link_group_id = 0;
 	int link_group_id = 0;
-	int target, interval, range, req_item = 0;
+	int target, interval, range;
+	t_itemid req_item = 0;
 	struct s_skill_unit_layout *layout;
 	struct s_skill_unit_layout *layout;
 	struct map_session_data *sd;
 	struct map_session_data *sd;
 	struct status_data *status;
 	struct status_data *status;
@@ -14448,6 +14418,11 @@ int skill_unit_onplace_timer(struct skill_unit *unit, struct block_list *bl, t_t
 			}
 			}
 			break;
 			break;
 
 
+		case UNT_EARTHQUAKE:
+			sg->val1++; // Hit count
+			skill_attack(skill_get_type(sg->skill_id), ss, &unit->bl, bl, sg->skill_id, sg->skill_lv, tick, map_foreachinallrange(skill_area_sub, &unit->bl, skill_get_splash(sg->skill_id, sg->skill_lv), BL_CHAR, &unit->bl, sg->skill_id, sg->skill_lv, tick, BCT_ENEMY, skill_area_sub_count) | (sg->val1 == 1 ? NPC_EARTHQUAKE_FLAG : 0));
+			break;
+
 		case UNT_ELECTRICSHOCKER:
 		case UNT_ELECTRICSHOCKER:
 			if( bl->id != ss->id ) {
 			if( bl->id != ss->id ) {
 				if( status_change_start(ss, bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill_get_time2(sg->skill_id, sg->skill_lv), SCSTART_NORATEDEF) ) {
 				if( status_change_start(ss, bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill_get_time2(sg->skill_id, sg->skill_lv), SCSTART_NORATEDEF) ) {
@@ -15241,8 +15216,8 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap)
 		if (*c >= 2) // Check for two companions for Benedictio. [Skotlex]
 		if (*c >= 2) // Check for two companions for Benedictio. [Skotlex]
 			return 0;
 			return 0;
 	}
 	}
-	else if (is_chorus || skill_id == WL_COMET) {
-		if (*c == MAX_PARTY) // Check for partners for Chorus or Comet; Cap if the entire party is accounted for.
+	else if (is_chorus) {
+		if (*c == MAX_PARTY) // Check for partners for Chorus; Cap if the entire party is accounted for.
 			return 0;
 			return 0;
 	}
 	}
 	else if (*c >= 1) // Check for one companion for all other cases.
 	else if (*c >= 1) // Check for one companion for all other cases.
@@ -15279,11 +15254,6 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap)
 				if( (tsd->class_&MAPID_UPPERMASK) == MAPID_PRIEST )
 				if( (tsd->class_&MAPID_UPPERMASK) == MAPID_PRIEST )
 					p_sd[(*c)++] = tsd->bl.id;
 					p_sd[(*c)++] = tsd->bl.id;
 				return 1;
 				return 1;
-			case WL_COMET:
-			// Comet does not consume Red Gemstones when there is at least 1 Warlock class next to the caster
-				if( ( sd->class_&MAPID_THIRDMASK ) == MAPID_WARLOCK )
-					p_sd[(*c)++] = tsd->bl.id;
-				return 1;
 			default: //Warning: Assuming Ensemble Dance/Songs for code speed. [Skotlex]
 			default: //Warning: Assuming Ensemble Dance/Songs for code speed. [Skotlex]
 				{
 				{
 					uint16 skill_lv;
 					uint16 skill_lv;
@@ -15371,7 +15341,7 @@ int skill_check_pc_partner(struct map_session_data *sd, uint16 skill_id, uint16
 	memset (p_sd, 0, sizeof(p_sd));
 	memset (p_sd, 0, sizeof(p_sd));
 	i = map_foreachinallrange(skill_check_condition_char_sub, &sd->bl, range, BL_PC, &sd->bl, &c, &p_sd, skill_id);
 	i = map_foreachinallrange(skill_check_condition_char_sub, &sd->bl, range, BL_PC, &sd->bl, &c, &p_sd, skill_id);
 
 
-	if ( skill_id != PR_BENEDICTIO && skill_id != AB_ADORAMUS && skill_id != WL_COMET && skill_id != WM_GREAT_ECHO ) //Apply the average lv to encore skills.
+	if ( skill_id != PR_BENEDICTIO && skill_id != AB_ADORAMUS && skill_id != WM_GREAT_ECHO ) //Apply the average lv to encore skills.
 		*skill_lv = (i+(*skill_lv))/(c+1); //I know c should be one, but this shows how it could be used for the average of n partners.
 		*skill_lv = (i+(*skill_lv))/(c+1); //I know c should be one, but this shows how it could be used for the average of n partners.
 	return c;
 	return c;
 }
 }
@@ -15545,11 +15515,13 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
 				sd->inventory.u.items_inventory[i].amount < 1
 				sd->inventory.u.items_inventory[i].amount < 1
 				)
 				)
 			{	//Something went wrong, item exploit?
 			{	//Something went wrong, item exploit?
-				sd->itemid = sd->itemindex = -1;
+				sd->itemid = 0;
+				sd->itemindex = -1;
 				return false;
 				return false;
 			}
 			}
 			//Consume
 			//Consume
-			sd->itemid = sd->itemindex = -1;
+			sd->itemid = 0;
+			sd->itemindex = -1;
 			if( (skill_id == WZ_EARTHSPIKE && sc && sc->data[SC_EARTHSCROLL] && rnd()%100 > sc->data[SC_EARTHSCROLL]->val2) || sd->inventory_data[i]->flag.delay_consume == 2 ) // [marquis007]
 			if( (skill_id == WZ_EARTHSPIKE && sc && sc->data[SC_EARTHSCROLL] && rnd()%100 > sc->data[SC_EARTHSCROLL]->val2) || sd->inventory_data[i]->flag.delay_consume == 2 ) // [marquis007]
 				; //Do not consume item.
 				; //Do not consume item.
 			else if( sd->inventory.u.items_inventory[i].expire_time == 0 )
 			else if( sd->inventory.u.items_inventory[i].expire_time == 0 )
@@ -15982,8 +15954,7 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
 				}
 				}
 			}
 			}
 			break;
 			break;
-		case AB_ADORAMUS: // bugreport:7647 mistress card DOES remove requirements for gemstones from Adoramus and Comet -helvetica
-		case WL_COMET:
+		case AB_ADORAMUS: // bugreport:7647 mistress card DOES remove requirements for gemstones from Adoramus -helvetica
 			if( skill_check_pc_partner(sd,skill_id,&skill_lv,1,0) <= 0 && require.itemid[0]
 			if( skill_check_pc_partner(sd,skill_id,&skill_lv,1,0) <= 0 && require.itemid[0]
 				&& sd->special_state.no_gemstone == 0
 				&& sd->special_state.no_gemstone == 0
 				&& ((i = pc_search_inventory(sd,require.itemid[0])) < 0 || sd->inventory.u.items_inventory[i].amount < require.amount[0]) ) {
 				&& ((i = pc_search_inventory(sd,require.itemid[0])) < 0 || sd->inventory.u.items_inventory[i].amount < require.amount[0]) ) {
@@ -15995,32 +15966,35 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
 		case WL_SUMMONBL:
 		case WL_SUMMONBL:
 		case WL_SUMMONWB:
 		case WL_SUMMONWB:
 		case WL_SUMMONSTONE:
 		case WL_SUMMONSTONE:
-			if( sc ) {
-				ARR_FIND(SC_SPHERE_1,SC_SPHERE_5+1,i,!sc->data[i]);
-				if( i == SC_SPHERE_5+1 ) { // No more free slots
-					clif_skill_fail(sd,skill_id,USESKILL_FAIL_SUMMON,0);
+			if (skill_lv == 1 && sc) { // Failure only happens on level 1
+				ARR_FIND(SC_SPHERE_1, SC_SPHERE_5 + 1, i, !sc->data[i]);
+
+				if (i == SC_SPHERE_5 + 1) { // No more free slots
+					clif_skill_fail(sd, skill_id, USESKILL_FAIL_SUMMON, 0);
 					return false;
 					return false;
 				}
 				}
 			}
 			}
 			break;
 			break;
 		case WL_TETRAVORTEX: // bugreport:7598 moved sphere check to precast to avoid triggering cooldown per official behavior -helvetica
 		case WL_TETRAVORTEX: // bugreport:7598 moved sphere check to precast to avoid triggering cooldown per official behavior -helvetica
-			if( sc ) {
-				int j = 0;
+		case WL_RELEASE: {
+				int active_spheres = 0, req_spheres = 0;
 
 
-				for( i = SC_SPHERE_1; i <= SC_SPHERE_5; i++ )
-					if( sc->data[i] ) {
-						j++;
-					}
+				for (i = SC_SPHERE_1; i <= SC_SPHERE_5; i++) {
+					if (sc && sc->data[i])
+						active_spheres++;
+				}
 
 
-				if( j < 4 ) { // Need 4 spheres minimum
-					clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
+				// Cast requirement
+				if (skill_id == WL_TETRAVORTEX)
+					req_spheres = 4;
+				else if (skill_id == WL_RELEASE && skill_lv == 2) // Only level 2 uses Spheres
+					req_spheres = 1;
+
+				if (active_spheres < req_spheres) { // Need minimum amount of spheres
+					clif_skill_fail(sd, skill_id, (skill_id == WL_RELEASE) ? USESKILL_FAIL_SUMMON_NONE : USESKILL_FAIL_LEVEL, 0);
 					return false;
 					return false;
 				}
 				}
 			}
 			}
-			else { // no status at all? no spheres present
-				clif_skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
-				return false;
-			}
 			break;
 			break;
 		case GC_HALLUCINATIONWALK:
 		case GC_HALLUCINATIONWALK:
 			if( sc && (sc->data[SC_HALLUCINATIONWALK] || sc->data[SC_HALLUCINATIONWALK_POSTDELAY]) ) {
 			if( sc && (sc->data[SC_HALLUCINATIONWALK] || sc->data[SC_HALLUCINATIONWALK_POSTDELAY]) ) {
@@ -16370,7 +16344,7 @@ bool skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_i
 		size_t count = require.eqItem.size();
 		size_t count = require.eqItem.size();
 
 
 		for (const auto &it : require.eqItem) {
 		for (const auto &it : require.eqItem) {
-			int32 reqeqit = it;
+			t_itemid reqeqit = it;
 
 
 			if (!reqeqit)
 			if (!reqeqit)
 				break; // Skill has no required item(s); get out of here
 				break; // Skill has no required item(s); get out of here
@@ -16978,10 +16952,6 @@ struct s_skill_condition skill_get_requirement(struct map_session_data* sd, uint
 							if( itemdb_group_item_exists(IG_GEMSTONE, skill->require.itemid[i]) && (sd->special_state.no_gemstone == 2 || skill_check_pc_partner(sd,skill_id,&skill_lv, 1, 2)) )
 							if( itemdb_group_item_exists(IG_GEMSTONE, skill->require.itemid[i]) && (sd->special_state.no_gemstone == 2 || skill_check_pc_partner(sd,skill_id,&skill_lv, 1, 2)) )
 								continue;
 								continue;
 							break;
 							break;
-						case WL_COMET:
-							if( itemdb_group_item_exists(IG_GEMSTONE, skill->require.itemid[i]) && (sd->special_state.no_gemstone == 2 || skill_check_pc_partner(sd,skill_id,&skill_lv, 1, 0)) )
-								continue;
-							break;
 					}
 					}
 
 
 					req.itemid[i] = skill->require.itemid[i];
 					req.itemid[i] = skill->require.itemid[i];
@@ -17527,7 +17497,7 @@ int skill_delayfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv)
  * Weapon Repair [Celest/DracoRPG]
  * Weapon Repair [Celest/DracoRPG]
  *------------------------------------------*/
  *------------------------------------------*/
 void skill_repairweapon(struct map_session_data *sd, int idx) {
 void skill_repairweapon(struct map_session_data *sd, int idx) {
-	unsigned short material, materials[4] = { ITEMID_IRON_ORE, ITEMID_IRON, ITEMID_STEEL, ITEMID_ORIDECON_STONE };
+	t_itemid material, materials[4] = { ITEMID_IRON_ORE, ITEMID_IRON, ITEMID_STEEL, ITEMID_ORIDECON_STONE };
 	struct item *item;
 	struct item *item;
 	struct map_session_data *target_sd;
 	struct map_session_data *target_sd;
 
 
@@ -17611,7 +17581,7 @@ void skill_weaponrefine(struct map_session_data *sd, int idx)
 
 
 		if(item->nameid > 0 && ditem->type == IT_WEAPON) {
 		if(item->nameid > 0 && ditem->type == IT_WEAPON) {
 			int i = 0, per;
 			int i = 0, per;
-			unsigned short material[5] = { 0, ITEMID_PHRACON, ITEMID_EMVERETARCON, ITEMID_ORIDECON, ITEMID_ORIDECON };
+			t_itemid material[5] = { 0, ITEMID_PHRACON, ITEMID_EMVERETARCON, ITEMID_ORIDECON, ITEMID_ORIDECON };
 			if( ditem->flag.no_refine ) { 	// if the item isn't refinable
 			if( ditem->flag.no_refine ) { 	// if the item isn't refinable
 				clif_skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0);
 				clif_skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0);
 				return;
 				return;
@@ -19751,7 +19721,7 @@ void skill_unit_move_unit_group(struct skill_unit_group *group, int16 m, int16 d
  * @param qty Amount of item will be created
  * @param qty Amount of item will be created
  * @return 0 If failed or Index+1 of item found on skill_produce_db[]
  * @return 0 If failed or Index+1 of item found on skill_produce_db[]
  */
  */
-short skill_can_produce_mix(struct map_session_data *sd, unsigned short nameid, int trigger, int qty)
+short skill_can_produce_mix(struct map_session_data *sd, t_itemid nameid, int trigger, int qty)
 {
 {
 	short i, j;
 	short i, j;
 
 
@@ -19794,7 +19764,7 @@ short skill_can_produce_mix(struct map_session_data *sd, unsigned short nameid,
 
 
 	// Check on player's inventory
 	// Check on player's inventory
 	for (j = 0; j < MAX_PRODUCE_RESOURCE; j++) {
 	for (j = 0; j < MAX_PRODUCE_RESOURCE; j++) {
-		unsigned short nameid_produce;
+		t_itemid nameid_produce;
 
 
 		if (!(nameid_produce = skill_produce_db[i].mat_id[j]))
 		if (!(nameid_produce = skill_produce_db[i].mat_id[j]))
 			continue;
 			continue;
@@ -19826,7 +19796,7 @@ short skill_can_produce_mix(struct map_session_data *sd, unsigned short nameid,
  * @param produce_idx Index of produce entry in skill_produce_db[]. (Optional. Assumed the requirements are complete, checked somewhere)
  * @param produce_idx Index of produce entry in skill_produce_db[]. (Optional. Assumed the requirements are complete, checked somewhere)
  * @return True is success, False if failed
  * @return True is success, False if failed
  */
  */
-bool skill_produce_mix(struct map_session_data *sd, uint16 skill_id, unsigned short nameid, int slot1, int slot2, int slot3, int qty, short produce_idx)
+bool skill_produce_mix(struct map_session_data *sd, uint16 skill_id, t_itemid nameid, int slot1, int slot2, int slot3, int qty, short produce_idx)
 {
 {
 	int slot[3];
 	int slot[3];
 	int i, sc, ele, idx, equip, wlv, make_per = 0, flag = 0, skill_lv = 0;
 	int i, sc, ele, idx, equip, wlv, make_per = 0, flag = 0, skill_lv = 0;
@@ -19881,7 +19851,8 @@ bool skill_produce_mix(struct map_session_data *sd, uint16 skill_id, unsigned sh
 	}
 	}
 
 
 	for (i = 0; i < MAX_PRODUCE_RESOURCE; i++) {
 	for (i = 0; i < MAX_PRODUCE_RESOURCE; i++) {
-		short id, x, j;
+		short x, j;
+		t_itemid id;
 
 
 		if (!(id = skill_produce_db[idx].mat_id[i]) || !itemdb_exists(id))
 		if (!(id = skill_produce_db[idx].mat_id[i]) || !itemdb_exists(id))
 			continue;
 			continue;
@@ -20394,7 +20365,7 @@ bool skill_produce_mix(struct map_session_data *sd, uint16 skill_id, unsigned sh
 			case GN_MIX_COOKING:
 			case GN_MIX_COOKING:
 				if (qty == 0) {
 				if (qty == 0) {
 					item tmp_item;
 					item tmp_item;
-					const int compensation[5] = { ITEMID_BLACK_LUMP, ITEMID_BLACK_HARD_LUMP, ITEMID_VERY_HARD_LUMP, ITEMID_BLACK_MASS, ITEMID_MYSTERIOUS_POWDER };
+					const t_itemid compensation[5] = { ITEMID_BLACK_LUMP, ITEMID_BLACK_HARD_LUMP, ITEMID_VERY_HARD_LUMP, ITEMID_BLACK_MASS, ITEMID_MYSTERIOUS_POWDER };
 					int rate = rnd() % 1000 + 1;
 					int rate = rnd() % 1000 + 1;
 
 
 					memset(&tmp_item, 0, sizeof(tmp_item));
 					memset(&tmp_item, 0, sizeof(tmp_item));
@@ -20449,7 +20420,7 @@ bool skill_produce_mix(struct map_session_data *sd, uint16 skill_id, unsigned sh
  * @param nameid Item ID of material
  * @param nameid Item ID of material
  * @return True if created, False is failed
  * @return True if created, False is failed
  */
  */
-bool skill_arrow_create(struct map_session_data *sd, unsigned short nameid)
+bool skill_arrow_create(struct map_session_data *sd, t_itemid nameid)
 {
 {
 	short i, j, idx = -1;
 	short i, j, idx = -1;
 	struct item tmp_item;
 	struct item tmp_item;
@@ -20498,7 +20469,7 @@ bool skill_arrow_create(struct map_session_data *sd, unsigned short nameid)
  * @param sd Player
  * @param sd Player
  * @nameid Item ID of poison type
  * @nameid Item ID of poison type
  */
  */
-int skill_poisoningweapon(struct map_session_data *sd, unsigned short nameid)
+int skill_poisoningweapon(struct map_session_data *sd, t_itemid nameid)
 {
 {
 	nullpo_ret(sd);
 	nullpo_ret(sd);
 
 
@@ -20567,7 +20538,7 @@ void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id)
 }
 }
 
 
 
 
-int skill_magicdecoy(struct map_session_data *sd, unsigned short nameid) {
+int skill_magicdecoy(struct map_session_data *sd, t_itemid nameid) {
 	int x, y, i, class_, skill;
 	int x, y, i, class_, skill;
 	struct mob_data *md;
 	struct mob_data *md;
 	nullpo_ret(sd);
 	nullpo_ret(sd);
@@ -20615,31 +20586,26 @@ int skill_magicdecoy(struct map_session_data *sd, unsigned short nameid) {
 	return 0;
 	return 0;
 }
 }
 
 
-// Warlock Spellbooks. [LimitLine/3CeAM]
-void skill_spellbook(struct map_session_data *sd, unsigned short nameid) {
+/**
+ * Process Warlock Spellbooks
+ * @param sd: Player data
+ * @param nameid: Spellbook item used
+ */
+void skill_spellbook(struct map_session_data *sd, t_itemid nameid) {
 	nullpo_retv(sd);
 	nullpo_retv(sd);
 
 
 	if (reading_spellbook_db.empty())
 	if (reading_spellbook_db.empty())
 		return;
 		return;
 
 
-	int i;
 	struct status_change *sc = status_get_sc(&sd->bl);
 	struct status_change *sc = status_get_sc(&sd->bl);
 
 
-	status_change_end(&sd->bl, SC_STOP, INVALID_TIMER);
-
-	for (i = SC_SPELLBOOK1; i <= SC_MAXSPELLBOOK; i++) {
-		// No further checks needed
-		if( !sc ){
+	for (int i = SC_SPELLBOOK1; i <= SC_MAXSPELLBOOK; i++) {
+		if (sc == nullptr || sc->data[i] == nullptr)
 			break;
 			break;
+		if (i == SC_MAXSPELLBOOK) {
+			clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_READING, 0);
+			return;
 		}
 		}
-
-		if( !sc->data[i] )
-			break;
-	}
-
-	if( i > SC_MAXSPELLBOOK ) {
-		clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_READING, 0);
-		return;
 	}
 	}
 
 
 	std::shared_ptr<s_skill_spellbook_db> spell = reading_spellbook_db.findBook(nameid);
 	std::shared_ptr<s_skill_spellbook_db> spell = reading_spellbook_db.findBook(nameid);
@@ -20649,7 +20615,7 @@ void skill_spellbook(struct map_session_data *sd, unsigned short nameid) {
 
 
 	uint16 skill_id = spell->skill_id, skill_lv = pc_checkskill(sd, skill_id);
 	uint16 skill_id = spell->skill_id, skill_lv = pc_checkskill(sd, skill_id);
 
 
-	if (!skill_lv) { // Caster hasn't learned the skill
+	if (skill_lv == 0) { // Caster hasn't learned the skill
 		sc_start(&sd->bl,&sd->bl, SC_SLEEP, 100, 1, skill_get_time(WL_READING_SB, pc_checkskill(sd, WL_READING_SB)));
 		sc_start(&sd->bl,&sd->bl, SC_SLEEP, 100, 1, skill_get_time(WL_READING_SB, pc_checkskill(sd, WL_READING_SB)));
 		clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_DIFFICULT_SLEEP, 0);
 		clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_DIFFICULT_SLEEP, 0);
 		return;
 		return;
@@ -20662,7 +20628,7 @@ void skill_spellbook(struct map_session_data *sd, unsigned short nameid) {
 			clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_PRESERVATION_POINT, 0);
 			clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_PRESERVATION_POINT, 0);
 			return;
 			return;
 		}
 		}
-		for (i = SC_MAXSPELLBOOK; i >= SC_SPELLBOOK1; i--) { // This is how official saves spellbook. [malufett]
+		for (int i = SC_MAXSPELLBOOK; i >= SC_SPELLBOOK1; i--) { // This is how official saves spellbook. [malufett]
 			if (!sc->data[i]) {
 			if (!sc->data[i]) {
 				sc->data[SC_FREEZE_SP]->val2 += points; // increase points
 				sc->data[SC_FREEZE_SP]->val2 += points; // increase points
 				sc_start4(&sd->bl,&sd->bl, (sc_type)i, 100, skill_id, skill_lv, points, 0, INFINITE_TICK);
 				sc_start4(&sd->bl,&sd->bl, (sc_type)i, 100, skill_id, skill_lv, points, 0, INFINITE_TICK);
@@ -20713,8 +20679,8 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv,
 		return 1;
 		return 1;
 
 
 	for( i = 0; i < n; i++ ) {
 	for( i = 0; i < n; i++ ) {
-		unsigned short nameid;
-		int add_amount, del_amount, idx, product;
+		t_itemid nameid, product;
+		int add_amount, del_amount, idx;
 		struct item tmp_item;
 		struct item tmp_item;
 
 
 		idx = item_list[i*2+0]-2;
 		idx = item_list[i*2+0]-2;
@@ -20780,7 +20746,7 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv,
 
 
 int skill_changematerial(struct map_session_data *sd, int n, unsigned short *item_list) {
 int skill_changematerial(struct map_session_data *sd, int n, unsigned short *item_list) {
 	int i, j, k, c, p = 0, amount;
 	int i, j, k, c, p = 0, amount;
-	unsigned short nameid;
+	t_itemid nameid;
 
 
 	nullpo_ret(sd);
 	nullpo_ret(sd);
 	nullpo_ret(item_list);
 	nullpo_ret(item_list);
@@ -22720,8 +22686,8 @@ uint64 ReadingSpellbookDatabase::parseBodyNode(const YAML::Node &node) {
  * @param nameid: Book Item ID
  * @param nameid: Book Item ID
  * @return Spell data or nullptr otherwise
  * @return Spell data or nullptr otherwise
  */
  */
-std::shared_ptr<s_skill_spellbook_db> ReadingSpellbookDatabase::findBook(int32 nameid) {
-	if (nameid < 1 || !itemdb_exists(nameid) || reading_spellbook_db.size() == 0)
+std::shared_ptr<s_skill_spellbook_db> ReadingSpellbookDatabase::findBook(t_itemid nameid) {
+	if (nameid == 0 || !itemdb_exists(nameid) || reading_spellbook_db.size() == 0)
 		return nullptr;
 		return nullptr;
 
 
 	for (const auto &spell : reading_spellbook_db) {
 	for (const auto &spell : reading_spellbook_db) {
@@ -22794,7 +22760,7 @@ static bool skill_parse_row_producedb(char* split[], int columns, int current)
 {
 {
 	unsigned short x, y;
 	unsigned short x, y;
 	unsigned short id = atoi(split[0]);
 	unsigned short id = atoi(split[0]);
-	unsigned short nameid = 0;
+	t_itemid nameid = 0;
 	bool found = false;
 	bool found = false;
 
 
 	if (id >= ARRAYLENGTH(skill_produce_db)) {
 	if (id >= ARRAYLENGTH(skill_produce_db)) {
@@ -22805,13 +22771,13 @@ static bool skill_parse_row_producedb(char* split[], int columns, int current)
 	// Clear previous data, for importing support
 	// Clear previous data, for importing support
 	memset(&skill_produce_db[id], 0, sizeof(skill_produce_db[id]));
 	memset(&skill_produce_db[id], 0, sizeof(skill_produce_db[id]));
 	// Import just for clearing/disabling from original data
 	// Import just for clearing/disabling from original data
-	if (!(nameid = atoi(split[1]))) {
+	if (!(nameid = strtoul(split[1], nullptr, 10))) {
 		//ShowInfo("skill_parse_row_producedb: Product list with ID %d removed from list.\n", id);
 		//ShowInfo("skill_parse_row_producedb: Product list with ID %d removed from list.\n", id);
 		return true;
 		return true;
 	}
 	}
 
 
 	if (!itemdb_exists(nameid)) {
 	if (!itemdb_exists(nameid)) {
-		ShowError("skill_parse_row_producedb: Invalid item %d.\n", nameid);
+		ShowError("skill_parse_row_producedb: Invalid item %u.\n", nameid);
 		return false;
 		return false;
 	}
 	}
 
 
@@ -22821,7 +22787,7 @@ static bool skill_parse_row_producedb(char* split[], int columns, int current)
 	skill_produce_db[id].req_skill_lv = atoi(split[4]);
 	skill_produce_db[id].req_skill_lv = atoi(split[4]);
 
 
 	for (x = 5, y = 0; x+1 < columns && split[x] && split[x+1] && y < MAX_PRODUCE_RESOURCE; x += 2, y++) {
 	for (x = 5, y = 0; x+1 < columns && split[x] && split[x+1] && y < MAX_PRODUCE_RESOURCE; x += 2, y++) {
-		skill_produce_db[id].mat_id[y] = atoi(split[x]);
+		skill_produce_db[id].mat_id[y] = strtoul(split[x], nullptr, 10);
 		skill_produce_db[id].mat_amount[y] = atoi(split[x+1]);
 		skill_produce_db[id].mat_amount[y] = atoi(split[x+1]);
 	}
 	}
 
 
@@ -22836,10 +22802,11 @@ static bool skill_parse_row_producedb(char* split[], int columns, int current)
  */
  */
 static bool skill_parse_row_createarrowdb(char* split[], int columns, int current)
 static bool skill_parse_row_createarrowdb(char* split[], int columns, int current)
 {
 {
-	unsigned short x, y, i, material_id = atoi(split[0]);
+	unsigned short x, y, i;
+	t_itemid material_id = strtoul(split[0], nullptr, 10);
 
 
 	if (!(itemdb_exists(material_id))) {
 	if (!(itemdb_exists(material_id))) {
-		ShowError("skill_parse_row_createarrowdb: Invalid item %d.\n", material_id);
+		ShowError("skill_parse_row_createarrowdb: Invalid item %u.\n", material_id);
 		return false;
 		return false;
 	}
 	}
 
 
@@ -22851,15 +22818,15 @@ static bool skill_parse_row_createarrowdb(char* split[], int columns, int curren
 	}
 	}
 
 
 	// Import just for clearing/disabling from original data
 	// Import just for clearing/disabling from original data
-	if (atoi(split[1]) == 0) {
+	if (strtoul(split[1], nullptr, 10) == 0) {
 		memset(&skill_arrow_db[i], 0, sizeof(skill_arrow_db[i]));
 		memset(&skill_arrow_db[i], 0, sizeof(skill_arrow_db[i]));
-		//ShowInfo("skill_parse_row_createarrowdb: Arrow creation with Material ID %d removed from list.\n", material_id);
+		//ShowInfo("skill_parse_row_createarrowdb: Arrow creation with Material ID %u removed from list.\n", material_id);
 		return true;
 		return true;
 	}
 	}
 
 
 	skill_arrow_db[i].nameid = material_id;
 	skill_arrow_db[i].nameid = material_id;
 	for (x = 1, y = 0; x+1 < columns && split[x] && split[x+1] && y < MAX_ARROW_RESULT; x += 2, y++) {
 	for (x = 1, y = 0; x+1 < columns && split[x] && split[x+1] && y < MAX_ARROW_RESULT; x += 2, y++) {
-		skill_arrow_db[i].cre_id[y] = atoi(split[x]);
+		skill_arrow_db[i].cre_id[y] = strtoul(split[x], nullptr, 10);
 		skill_arrow_db[i].cre_amount[y] = atoi(split[x+1]);
 		skill_arrow_db[i].cre_amount[y] = atoi(split[x+1]);
 	}
 	}
 	if (i == skill_arrow_count)
 	if (i == skill_arrow_count)
@@ -22948,7 +22915,8 @@ uint64 AbraDatabase::parseBodyNode(const YAML::Node &node) {
  */
  */
 static bool skill_parse_row_changematerialdb(char* split[], int columns, int current)
 static bool skill_parse_row_changematerialdb(char* split[], int columns, int current)
 {
 {
-	uint16 id = atoi(split[0]), nameid = atoi(split[1]);
+	uint16 id = atoi(split[0]);
+	t_itemid nameid = strtoul(split[1], nullptr, 10);
 	short rate = atoi(split[2]);
 	short rate = atoi(split[2]);
 	bool found = false;
 	bool found = false;
 	int x, y;
 	int x, y;
@@ -22980,7 +22948,7 @@ static bool skill_parse_row_changematerialdb(char* split[], int columns, int cur
 	}
 	}
 
 
 	if (x >= MAX_SKILL_PRODUCE_DB) {
 	if (x >= MAX_SKILL_PRODUCE_DB) {
-		ShowError("skill_parse_row_changematerialdb: Not supported item ID (%d) for Change Material. \n", nameid);
+		ShowError("skill_parse_row_changematerialdb: Not supported item ID (%u) for Change Material. \n", nameid);
 		return false;
 		return false;
 	}
 	}
 
 

+ 27 - 21
src/map/skill.hpp

@@ -37,6 +37,9 @@ struct status_change_entry;
 #define SKILL_NAME_LENGTH 31 /// Max Skill Name length
 #define SKILL_NAME_LENGTH 31 /// Max Skill Name length
 #define SKILL_DESC_LENGTH 31 /// Max Skill Desc length
 #define SKILL_DESC_LENGTH 31 /// Max Skill Desc length
 
 
+/// Used with tracking the hitcount of Earthquake for skills that can avoid the first attack
+#define NPC_EARTHQUAKE_FLAG 0x800
+
 /// Constants to identify a skill's nk value (damage properties)
 /// Constants to identify a skill's nk value (damage properties)
 /// The NK value applies only to non INF_GROUND_SKILL skills
 /// The NK value applies only to non INF_GROUND_SKILL skills
 /// when determining skill castend function to invoke.
 /// when determining skill castend function to invoke.
@@ -204,9 +207,9 @@ struct s_skill_condition {
 	int32 ammo_qty;							/// Amount of ammo
 	int32 ammo_qty;							/// Amount of ammo
 	int32 state;							/// State/condition. @see enum e_require_state
 	int32 state;							/// State/condition. @see enum e_require_state
 	int32 spiritball;						/// Spiritball cost
 	int32 spiritball;						/// Spiritball cost
-	int32 itemid[MAX_SKILL_ITEM_REQUIRE];	/// Required item
+	t_itemid itemid[MAX_SKILL_ITEM_REQUIRE];	/// Required item
 	int32 amount[MAX_SKILL_ITEM_REQUIRE];	/// Amount of item
 	int32 amount[MAX_SKILL_ITEM_REQUIRE];	/// Amount of item
-	std::vector<int32> eqItem;				/// List of equipped item
+	std::vector<t_itemid> eqItem;				/// List of equipped item
 	std::vector<sc_type> status;			/// List of Status required (SC)
 	std::vector<sc_type> status;			/// List of Status required (SC)
 };
 };
 
 
@@ -223,9 +226,9 @@ struct s_skill_require {
 	int32 ammo_qty[MAX_SKILL_LEVEL];		/// Amount of ammo
 	int32 ammo_qty[MAX_SKILL_LEVEL];		/// Amount of ammo
 	int32 state;							/// State/condition. @see enum e_require_state
 	int32 state;							/// State/condition. @see enum e_require_state
 	int32 spiritball[MAX_SKILL_LEVEL];		/// Spiritball cost
 	int32 spiritball[MAX_SKILL_LEVEL];		/// Spiritball cost
-	int32 itemid[MAX_SKILL_ITEM_REQUIRE];	/// Required item
+	t_itemid itemid[MAX_SKILL_ITEM_REQUIRE];	/// Required item
 	int32 amount[MAX_SKILL_ITEM_REQUIRE];	/// Amount of item
 	int32 amount[MAX_SKILL_ITEM_REQUIRE];	/// Amount of item
-	std::vector<int32> eqItem;				/// List of equipped item
+	std::vector<t_itemid> eqItem;				/// List of equipped item
 	std::vector<sc_type> status;			/// List of Status required (SC)
 	std::vector<sc_type> status;			/// List of Status required (SC)
 };
 };
 
 
@@ -361,7 +364,7 @@ struct skill_unit_group {
 	int link_group_id; /// Linked group that should be deleted if this one is deleted
 	int link_group_id; /// Linked group that should be deleted if this one is deleted
 	int unit_count, /// Number of unit at this group
 	int unit_count, /// Number of unit at this group
 		alive_count; /// Number of alive unit
 		alive_count; /// Number of alive unit
-	int item_id; /// Store item used.
+	t_itemid item_id; /// Store item used.
 	struct skill_unit *unit; /// Skill Unit
 	struct skill_unit *unit; /// Skill Unit
 	struct {
 	struct {
 		unsigned ammo_consume : 1; // Need to consume ammo
 		unsigned ammo_consume : 1; // Need to consume ammo
@@ -417,20 +420,20 @@ enum e_skill_blown	{
 
 
 /// Create Database item
 /// Create Database item
 struct s_skill_produce_db {
 struct s_skill_produce_db {
-	unsigned short nameid; /// Product ID
+	t_itemid nameid; /// Product ID
 	unsigned short req_skill; /// Required Skill
 	unsigned short req_skill; /// Required Skill
 	unsigned char req_skill_lv, /// Required Skill Level
 	unsigned char req_skill_lv, /// Required Skill Level
 		itemlv; /// Item Level
 		itemlv; /// Item Level
-	unsigned short mat_id[MAX_PRODUCE_RESOURCE], /// Materials needed
-		mat_amount[MAX_PRODUCE_RESOURCE]; /// Amount of each materials
+	t_itemid mat_id[MAX_PRODUCE_RESOURCE]; /// Materials needed
+	unsigned short mat_amount[MAX_PRODUCE_RESOURCE]; /// Amount of each materials
 };
 };
 extern struct s_skill_produce_db skill_produce_db[MAX_SKILL_PRODUCE_DB];
 extern struct s_skill_produce_db skill_produce_db[MAX_SKILL_PRODUCE_DB];
 
 
 /// Creating database arrow
 /// Creating database arrow
 struct s_skill_arrow_db {
 struct s_skill_arrow_db {
-	unsigned short nameid, /// Material ID
-		cre_id[MAX_ARROW_RESULT], /// Arrow created
-		cre_amount[MAX_ARROW_RESULT]; /// Amount of each arrow created
+	t_itemid nameid; /// Material ID
+	t_itemid cre_id[MAX_ARROW_RESULT]; /// Arrow created
+	uint16 cre_amount[MAX_ARROW_RESULT]; /// Amount of each arrow created
 };
 };
 extern struct s_skill_arrow_db skill_arrow_db[MAX_SKILL_ARROW_DB];
 extern struct s_skill_arrow_db skill_arrow_db[MAX_SKILL_ARROW_DB];
 
 
@@ -601,10 +604,10 @@ bool skill_isNotOk_mercenary(uint16 skill_id, struct mercenary_data *md);
 bool skill_isNotOk_npcRange(struct block_list *src, uint16 skill_id, uint16 skill_lv, int pos_x, int pos_y);
 bool skill_isNotOk_npcRange(struct block_list *src, uint16 skill_id, uint16 skill_lv, int pos_x, int pos_y);
 
 
 // Item creation
 // Item creation
-short skill_can_produce_mix( struct map_session_data *sd, unsigned short nameid, int trigger, int qty);
-bool skill_produce_mix( struct map_session_data *sd, uint16 skill_id, unsigned short nameid, int slot1, int slot2, int slot3, int qty, short produce_idx );
+short skill_can_produce_mix( struct map_session_data *sd, t_itemid nameid, int trigger, int qty);
+bool skill_produce_mix( struct map_session_data *sd, uint16 skill_id, t_itemid nameid, int slot1, int slot2, int slot3, int qty, short produce_idx );
 
 
-bool skill_arrow_create( struct map_session_data *sd, unsigned short nameid);
+bool skill_arrow_create( struct map_session_data *sd, t_itemid nameid);
 
 
 // skills for the mob
 // skills for the mob
 int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,t_tick tick,int flag );
 int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,t_tick tick,int flag );
@@ -1962,6 +1965,7 @@ enum e_skill {
 	NV_BREAKTHROUGH,
 	NV_BREAKTHROUGH,
 	NV_HELPANGEL,
 	NV_HELPANGEL,
 	NV_TRANSCENDENCE,
 	NV_TRANSCENDENCE,
+	WL_READING_SB_READING,
 
 
 	HLIF_HEAL = 8001,
 	HLIF_HEAL = 8001,
 	HLIF_AVOID,
 	HLIF_AVOID,
@@ -2167,7 +2171,7 @@ enum e_skill_unit_id : uint16 {
 	UNT_DEATHWAVE, //TODO
 	UNT_DEATHWAVE, //TODO
 	UNT_WATERATTACK, //TODO
 	UNT_WATERATTACK, //TODO
 	UNT_WINDATTACK, //TODO
 	UNT_WINDATTACK, //TODO
-	UNT_EARTHQUAKE, //TODO
+	UNT_EARTHQUAKE,
 	UNT_EVILLAND,
 	UNT_EVILLAND,
 	UNT_DARK_RUNNER, //TODO
 	UNT_DARK_RUNNER, //TODO
 	UNT_DARK_TRANSFER, //TODO
 	UNT_DARK_TRANSFER, //TODO
@@ -2258,7 +2262,7 @@ void skill_usave_trigger(struct map_session_data *sd);
 /**
 /**
  * Warlock
  * Warlock
  **/
  **/
-enum wl_spheres {
+enum e_wl_spheres {
 	WLS_FIRE = 0x44,
 	WLS_FIRE = 0x44,
 	WLS_WIND,
 	WLS_WIND,
 	WLS_WATER,
 	WLS_WATER,
@@ -2266,7 +2270,8 @@ enum wl_spheres {
 };
 };
 
 
 struct s_skill_spellbook_db {
 struct s_skill_spellbook_db {
-	uint16 skill_id, nameid, points;
+	uint16 skill_id, points;
+	t_itemid nameid;
 };
 };
 
 
 class ReadingSpellbookDatabase : public TypesafeYamlDatabase<uint16, s_skill_spellbook_db> {
 class ReadingSpellbookDatabase : public TypesafeYamlDatabase<uint16, s_skill_spellbook_db> {
@@ -2277,12 +2282,13 @@ public:
 
 
 	const std::string getDefaultLocation();
 	const std::string getDefaultLocation();
 	uint64 parseBodyNode(const YAML::Node& node);
 	uint64 parseBodyNode(const YAML::Node& node);
-	std::shared_ptr<s_skill_spellbook_db> findBook(int32 nameid);
+	std::shared_ptr<s_skill_spellbook_db> findBook(t_itemid nameid);
 };
 };
 
 
 extern ReadingSpellbookDatabase reading_spellbook_db;
 extern ReadingSpellbookDatabase reading_spellbook_db;
 
 
-void skill_spellbook(struct map_session_data *sd, unsigned short nameid);
+void skill_spellbook(struct map_session_data *sd, t_itemid nameid);
+
 int skill_block_check(struct block_list *bl, enum sc_type type, uint16 skill_id);
 int skill_block_check(struct block_list *bl, enum sc_type type, uint16 skill_id);
 
 
 struct s_skill_magicmushroom_db {
 struct s_skill_magicmushroom_db {
@@ -2313,12 +2319,12 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s
 /**
 /**
  * Mechanic
  * Mechanic
  **/
  **/
-int skill_magicdecoy(struct map_session_data *sd, unsigned short nameid);
+int skill_magicdecoy(struct map_session_data *sd, t_itemid nameid);
 
 
 /**
 /**
  * Guiltoine Cross
  * Guiltoine Cross
  **/
  **/
-int skill_poisoningweapon( struct map_session_data *sd, unsigned short nameid);
+int skill_poisoningweapon( struct map_session_data *sd, t_itemid nameid);
 
 
 /**
 /**
  * Auto Shadow Spell (Shadow Chaser)
  * Auto Shadow Spell (Shadow Chaser)

+ 17 - 7
src/map/status.cpp

@@ -847,14 +847,11 @@ void initChangeTables(void)
 	/* Warlock */
 	/* Warlock */
 	add_sc( WL_WHITEIMPRISON	, SC_WHITEIMPRISON	);
 	add_sc( WL_WHITEIMPRISON	, SC_WHITEIMPRISON	);
 	set_sc_with_vfx( WL_FROSTMISTY	, SC_FREEZING		, EFST_FROSTMISTY		, SCB_ASPD|SCB_SPEED|SCB_DEF );
 	set_sc_with_vfx( WL_FROSTMISTY	, SC_FREEZING		, EFST_FROSTMISTY		, SCB_ASPD|SCB_SPEED|SCB_DEF );
-	add_sc( WL_JACKFROST        , SC_FREEZE		  );
 	set_sc( WL_MARSHOFABYSS		, SC_MARSHOFABYSS	, EFST_MARSHOFABYSS	, SCB_AGI|SCB_DEX|SCB_SPEED );
 	set_sc( WL_MARSHOFABYSS		, SC_MARSHOFABYSS	, EFST_MARSHOFABYSS	, SCB_AGI|SCB_DEX|SCB_SPEED );
 	set_sc( WL_RECOGNIZEDSPELL	, SC_RECOGNIZEDSPELL	, EFST_RECOGNIZEDSPELL	, SCB_MATK);
 	set_sc( WL_RECOGNIZEDSPELL	, SC_RECOGNIZEDSPELL	, EFST_RECOGNIZEDSPELL	, SCB_MATK);
 	add_sc( WL_SIENNAEXECRATE   , SC_STONE		  );
 	add_sc( WL_SIENNAEXECRATE   , SC_STONE		  );
 	set_sc( WL_STASIS			, SC_STASIS		, EFST_STASIS		, SCB_NONE );
 	set_sc( WL_STASIS			, SC_STASIS		, EFST_STASIS		, SCB_NONE );
-	add_sc( WL_CRIMSONROCK      , SC_STUN         );
-	set_sc( WL_HELLINFERNO      , SC_BURNING         , EFST_BURNT           , SCB_MDEF );
-	set_sc( WL_COMET            , SC_BURNING         , EFST_BURNT           , SCB_MDEF );
+	set_sc_with_vfx( WL_COMET   , SC_MAGIC_POISON	, EFST_MAGIC_POISON	, SCB_NONE );
 	set_sc( WL_TELEKINESIS_INTENSE	, SC_TELEKINESIS_INTENSE, EFST_TELEKINESIS_INTENSE, SCB_MATK );
 	set_sc( WL_TELEKINESIS_INTENSE	, SC_TELEKINESIS_INTENSE, EFST_TELEKINESIS_INTENSE, SCB_MATK );
 
 
 	/* Ranger */
 	/* Ranger */
@@ -1385,6 +1382,7 @@ void initChangeTables(void)
 	StatusIconChangeTable[SC_ADD_ATK_DAMAGE] = EFST_ADD_ATK_DAMAGE;
 	StatusIconChangeTable[SC_ADD_ATK_DAMAGE] = EFST_ADD_ATK_DAMAGE;
 	StatusIconChangeTable[SC_ADD_MATK_DAMAGE] = EFST_ADD_MATK_DAMAGE;
 	StatusIconChangeTable[SC_ADD_MATK_DAMAGE] = EFST_ADD_MATK_DAMAGE;
 	StatusIconChangeTable[SC_ENSEMBLEFATIGUE] = EFST_ENSEMBLEFATIGUE;
 	StatusIconChangeTable[SC_ENSEMBLEFATIGUE] = EFST_ENSEMBLEFATIGUE;
+	StatusIconChangeTable[SC_MISTY_FROST] = EFST_MISTY_FROST;
 
 
 	// Battleground Queue
 	// Battleground Queue
 	StatusIconChangeTable[SC_ENTRY_QUEUE_APPLY_DELAY] = EFST_ENTRY_QUEUE_APPLY_DELAY;
 	StatusIconChangeTable[SC_ENTRY_QUEUE_APPLY_DELAY] = EFST_ENTRY_QUEUE_APPLY_DELAY;
@@ -1571,6 +1569,7 @@ void initChangeTables(void)
 
 
 	StatusChangeFlagTable[SC_ANCILLA] |= SCB_REGEN;
 	StatusChangeFlagTable[SC_ANCILLA] |= SCB_REGEN;
 	StatusChangeFlagTable[SC_ENSEMBLEFATIGUE] |= SCB_SPEED|SCB_ASPD;
 	StatusChangeFlagTable[SC_ENSEMBLEFATIGUE] |= SCB_SPEED|SCB_ASPD;
+	StatusChangeFlagTable[SC_MISTY_FROST] |= SCB_NONE;
 
 
 #ifdef RENEWAL
 #ifdef RENEWAL
 	// renewal EDP increases your weapon atk
 	// renewal EDP increases your weapon atk
@@ -1619,6 +1618,8 @@ void initChangeTables(void)
 	StatusDisplayType[SC_SPRITEMABLE]     = BL_PC;
 	StatusDisplayType[SC_SPRITEMABLE]     = BL_PC;
 	StatusDisplayType[SC_SV_ROOTTWIST]    = BL_PC;
 	StatusDisplayType[SC_SV_ROOTTWIST]    = BL_PC;
 	StatusDisplayType[SC_HELLS_PLANT]     = BL_PC;
 	StatusDisplayType[SC_HELLS_PLANT]     = BL_PC;
+	StatusDisplayType[SC_MISTY_FROST]     = BL_PC;
+	StatusDisplayType[SC_MAGIC_POISON]    = BL_PC;
 
 
 	// Costumes
 	// Costumes
 	StatusDisplayType[SC_MOONSTAR] = BL_PC;
 	StatusDisplayType[SC_MOONSTAR] = BL_PC;
@@ -10335,7 +10336,11 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 		case SC_MAGICPOWER:
 		case SC_MAGICPOWER:
 			// val1: Skill lv
 			// val1: Skill lv
 			val2 = 1; // Lasts 1 invocation
 			val2 = 1; // Lasts 1 invocation
-			val3 = 5*val1; // Matk% increase
+#ifdef RENEWAL
+			val3 = 10 * val1; // Matk% increase
+#else
+			val3 = 5 * val1; // Matk% increase
+#endif
 			val4 = 0; // 0 = ready to be used, 1 = activated and running
 			val4 = 0; // 0 = ready to be used, 1 = activated and running
 			break;
 			break;
 		case SC_SACRIFICE:
 		case SC_SACRIFICE:
@@ -11925,6 +11930,9 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 			val2 = 10 + val1 * 5; // Def/Mdef
 			val2 = 10 + val1 * 5; // Def/Mdef
 			tick = INFINITE_TICK;
 			tick = INFINITE_TICK;
 			break;
 			break;
+		case SC_MAGIC_POISON:
+			val2 = 50; // Attribute Reduction
+			break;
 
 
 		/* Rebellion */
 		/* Rebellion */
 		case SC_B_TRAP:
 		case SC_B_TRAP:
@@ -12258,6 +12266,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 		case SC_CROSSBOWCLAN:
 		case SC_CROSSBOWCLAN:
 		case SC_JUMPINGCLAN:
 		case SC_JUMPINGCLAN:
 		case SC_DRESSUP:
 		case SC_DRESSUP:
+		case SC_MISTY_FROST:
 			val_flag |= 1;
 			val_flag |= 1;
 			break;
 			break;
 		// Start |1|2 val_flag setting
 		// Start |1|2 val_flag setting
@@ -15596,7 +15605,7 @@ static bool status_yaml_readdb_refine_sub(const YAML::Node &node, int refine_inf
 		int64 idx_tmp = 0;
 		int64 idx_tmp = 0;
 		const YAML::Node &type = costit;
 		const YAML::Node &type = costit;
 		int idx = 0, price;
 		int idx = 0, price;
-		unsigned short material;
+		t_itemid material;
 		const std::string keys[] = { "Type", "Price", "Material" };
 		const std::string keys[] = { "Type", "Price", "Material" };
 
 
 		for (int i = 0; i < ARRAYLENGTH(keys); i++) {
 		for (int i = 0; i < ARRAYLENGTH(keys); i++) {
@@ -15612,7 +15621,8 @@ static bool status_yaml_readdb_refine_sub(const YAML::Node &node, int refine_inf
 			idx = static_cast<int>(idx_tmp);
 			idx = static_cast<int>(idx_tmp);
 		}
 		}
 		price = type["Price"].as<int>();
 		price = type["Price"].as<int>();
-		material = type["Material"].as<uint16>();
+		// TODO: item id verification
+		material = type["Material"].as<t_itemid>();
 
 
 		refine_info[refine_info_index].cost[idx].nameid = material;
 		refine_info[refine_info_index].cost[idx].nameid = material;
 		refine_info[refine_info_index].cost[idx].zeny = price;
 		refine_info[refine_info_index].cost[idx].zeny = price;

+ 4 - 6
src/map/status.hpp

@@ -52,7 +52,7 @@ enum refine_cost_type {
 };
 };
 
 
 struct refine_cost {
 struct refine_cost {
-	unsigned short nameid;
+	t_itemid nameid;
 	int zeny;
 	int zeny;
 };
 };
 
 
@@ -652,11 +652,7 @@ enum sc_type : int16 {
 	SC_SPELLBOOK4,
 	SC_SPELLBOOK4,
 	SC_SPELLBOOK5,
 	SC_SPELLBOOK5,
 	SC_SPELLBOOK6,
 	SC_SPELLBOOK6,
-/**
- * In official server there are only 7 maximum number of spell books that can be memorized
- * To increase the maximum value just add another status type before SC_MAXSPELLBOOK (ex. SC_SPELLBOOK7, SC_SPELLBOOK8 and so on)
- **/
-	SC_MAXSPELLBOOK,
+	SC_MAXSPELLBOOK, // SC_SPELLBOOK7
 	/* Max HP & SP */
 	/* Max HP & SP */
 	SC_INCMHP,
 	SC_INCMHP,
 	SC_INCMSP,
 	SC_INCMSP,
@@ -933,6 +929,8 @@ enum sc_type : int16 {
 	SC_LUXANIMA,
 	SC_LUXANIMA,
 	SC_REUSE_LIMIT_LUXANIMA,
 	SC_REUSE_LIMIT_LUXANIMA,
 	SC_ENSEMBLEFATIGUE,
 	SC_ENSEMBLEFATIGUE,
+	SC_MISTY_FROST,
+	SC_MAGIC_POISON,
 
 
 	SC_BLOCKING_PLAY,
 	SC_BLOCKING_PLAY,
 
 

Some files were not shown because too many files changed in this diff