Advertisement
Guest User

Untitled

a guest
May 19th, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.42 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
  3. * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18.  
  19. #ifndef _ITEMPROTOTYPE_H
  20. #define _ITEMPROTOTYPE_H
  21.  
  22. #include "Common.h"
  23. #include "SharedDefines.h"
  24.  
  25. enum ItemModType
  26. {
  27. ITEM_MOD_MANA = 0,
  28. ITEM_MOD_HEALTH = 1,
  29. ITEM_MOD_AGILITY = 3,
  30. ITEM_MOD_STRENGTH = 4,
  31. ITEM_MOD_INTELLECT = 5,
  32. ITEM_MOD_SPIRIT = 6,
  33. ITEM_MOD_STAMINA = 7,
  34. ITEM_MOD_DEFENSE_SKILL_RATING = 12,
  35. ITEM_MOD_DODGE_RATING = 13,
  36. ITEM_MOD_PARRY_RATING = 14,
  37. ITEM_MOD_BLOCK_RATING = 15,
  38. ITEM_MOD_HIT_MELEE_RATING = 16,
  39. ITEM_MOD_HIT_RANGED_RATING = 17,
  40. ITEM_MOD_HIT_SPELL_RATING = 18,
  41. ITEM_MOD_CRIT_MELEE_RATING = 19,
  42. ITEM_MOD_CRIT_RANGED_RATING = 20,
  43. ITEM_MOD_CRIT_SPELL_RATING = 21,
  44. ITEM_MOD_HIT_TAKEN_MELEE_RATING = 22,
  45. ITEM_MOD_HIT_TAKEN_RANGED_RATING = 23,
  46. ITEM_MOD_HIT_TAKEN_SPELL_RATING = 24,
  47. ITEM_MOD_CRIT_TAKEN_MELEE_RATING = 25,
  48. ITEM_MOD_CRIT_TAKEN_RANGED_RATING = 26,
  49. ITEM_MOD_CRIT_TAKEN_SPELL_RATING = 27,
  50. ITEM_MOD_HASTE_MELEE_RATING = 28,
  51. ITEM_MOD_HASTE_RANGED_RATING = 29,
  52. ITEM_MOD_HASTE_SPELL_RATING = 30,
  53. ITEM_MOD_HIT_RATING = 31,
  54. ITEM_MOD_CRIT_RATING = 32,
  55. ITEM_MOD_HIT_TAKEN_RATING = 33,
  56. ITEM_MOD_CRIT_TAKEN_RATING = 34,
  57. ITEM_MOD_RESILIENCE_RATING = 35,
  58. ITEM_MOD_HASTE_RATING = 36,
  59. ITEM_MOD_EXPERTISE_RATING = 37,
  60. ITEM_MOD_ATTACK_POWER = 38,
  61. ITEM_MOD_RANGED_ATTACK_POWER = 39,
  62. //ITEM_MOD_FERAL_ATTACK_POWER = 40, not in 3.3
  63. ITEM_MOD_SPELL_HEALING_DONE = 41, // deprecated
  64. ITEM_MOD_SPELL_DAMAGE_DONE = 42, // deprecated
  65. ITEM_MOD_MANA_REGENERATION = 43,
  66. ITEM_MOD_ARMOR_PENETRATION_RATING = 44,
  67. ITEM_MOD_SPELL_POWER = 45,
  68. ITEM_MOD_HEALTH_REGEN = 46,
  69. ITEM_MOD_SPELL_PENETRATION = 47,
  70. ITEM_MOD_BLOCK_VALUE = 48
  71. };
  72.  
  73. #define MAX_ITEM_MOD 49
  74.  
  75. enum ItemSpelltriggerType
  76. {
  77. ITEM_SPELLTRIGGER_ON_USE = 0, // use after equip cooldown
  78. ITEM_SPELLTRIGGER_ON_EQUIP = 1,
  79. ITEM_SPELLTRIGGER_CHANCE_ON_HIT = 2,
  80. ITEM_SPELLTRIGGER_SOULSTONE = 4,
  81. /*
  82. * ItemSpelltriggerType 5 might have changed on 2.4.3/3.0.3: Such auras
  83. * will be applied on item pickup and removed on item loss - maybe on the
  84. * other hand the item is destroyed if the aura is removed ("removed on
  85. * death" of spell 57348 makes me think so)
  86. */
  87. ITEM_SPELLTRIGGER_ON_NO_DELAY_USE = 5, // no equip cooldown
  88. ITEM_SPELLTRIGGER_LEARN_SPELL_ID = 6 // used in item_template.spell_2 with spell_id with SPELL_GENERIC_LEARN in spell_1
  89. };
  90.  
  91. #define MAX_ITEM_SPELLTRIGGER 7
  92.  
  93. enum ItemBondingType
  94. {
  95. NO_BIND = 0,
  96. BIND_WHEN_PICKED_UP = 1,
  97. BIND_WHEN_EQUIPED = 2,
  98. BIND_WHEN_USE = 3,
  99. BIND_QUEST_ITEM = 4,
  100. BIND_QUEST_ITEM1 = 5 // not used in game
  101. };
  102.  
  103. #define MAX_BIND_TYPE 6
  104.  
  105. /* /// @todo: Requiring actual cases in which using (an) item isn't allowed while shapeshifted. Else, this flag would need an implementation.
  106. ITEM_PROTO_FLAG_USABLE_WHEN_SHAPESHIFTED = 0x00800000, // Item can be used in shapeshift forms */
  107.  
  108. enum ItemProtoFlags
  109. {
  110. ITEM_PROTO_FLAG_UNK1 = 0x00000001, // ?
  111. ITEM_PROTO_FLAG_CONJURED = 0x00000002, // Conjured item
  112. ITEM_PROTO_FLAG_OPENABLE = 0x00000004, // Item can be right clicked to open for loot
  113. ITEM_PROTO_FLAG_HEROIC = 0x00000008, // Makes green "Heroic" text appear on item
  114. ITEM_PROTO_FLAG_DEPRECATED = 0x00000010, // Cannot equip or use
  115. ITEM_PROTO_FLAG_INDESTRUCTIBLE = 0x00000020, // Item can not be destroyed, except by using spell (item can be reagent for spell)
  116. ITEM_PROTO_FLAG_UNK2 = 0x00000040, // ?
  117. ITEM_PROTO_FLAG_NO_EQUIP_COOLDOWN = 0x00000080, // No default 30 seconds cooldown when equipped
  118. ITEM_PROTO_FLAG_UNK3 = 0x00000100, // ?
  119. ITEM_PROTO_FLAG_WRAPPER = 0x00000200, // Item can wrap other items
  120. ITEM_PROTO_FLAG_UNK4 = 0x00000400, // ?
  121. ITEM_PROTO_FLAG_PARTY_LOOT = 0x00000800, // Looting this item does not remove it from available loot
  122. ITEM_PROTO_FLAG_REFUNDABLE = 0x00001000, // Item can be returned to vendor for its original cost (extended cost)
  123. ITEM_PROTO_FLAG_CHARTER = 0x00002000, // Item is guild or arena charter
  124. ITEM_PROTO_FLAG_UNK5 = 0x00004000, // Only readable items have this (but not all)
  125. ITEM_PROTO_FLAG_UNK6 = 0x00008000, // ?
  126. ITEM_PROTO_FLAG_UNK7 = 0x00010000, // ?
  127. ITEM_PROTO_FLAG_UNK8 = 0x00020000, // ?
  128. ITEM_PROTO_FLAG_PROSPECTABLE = 0x00040000, // Item can be prospected
  129. ITEM_PROTO_FLAG_UNIQUE_EQUIPPED = 0x00080000, // You can only equip one of these
  130. ITEM_PROTO_FLAG_UNK9 = 0x00100000, // ?
  131. ITEM_PROTO_FLAG_USEABLE_IN_ARENA = 0x00200000, // Item can be used during arena match
  132. ITEM_PROTO_FLAG_THROWABLE = 0x00400000, // Some Thrown weapons have it (and only Thrown) but not all
  133. ITEM_PROTO_FLAG_USABLE_WHEN_SHAPESHIFTED = 0x00800000, // Item can be used in shapeshift forms
  134. ITEM_PROTO_FLAG_UNK10 = 0x01000000, // ?
  135. ITEM_PROTO_FLAG_SMART_LOOT = 0x02000000, // Profession recipes: can only be looted if you meet requirements and don't already know it
  136. ITEM_PROTO_FLAG_NOT_USEABLE_IN_ARENA = 0x04000000, // Item cannot be used in arena
  137. ITEM_PROTO_FLAG_BIND_TO_ACCOUNT = 0x08000000, // Item binds to account and can be sent only to your own characters
  138. ITEM_PROTO_FLAG_TRIGGERED_CAST = 0x10000000, // Spell is cast with triggered flag
  139. ITEM_PROTO_FLAG_MILLABLE = 0x20000000, // Item can be milled
  140. ITEM_PROTO_FLAG_UNK11 = 0x40000000, // ?
  141. ITEM_PROTO_FLAG_UNK12 = 0x80000000 // ?
  142. };
  143.  
  144. enum ItemFieldFlags
  145. {
  146. ITEM_FLAG_SOULBOUND = 0x00000001, // Item is soulbound and cannot be traded <<--
  147. ITEM_FLAG_UNK1 = 0x00000002, // ?
  148. ITEM_FLAG_UNLOCKED = 0x00000004, // Item had lock but can be opened now
  149. ITEM_FLAG_WRAPPED = 0x00000008, // Item is wrapped and contains another item
  150. ITEM_FLAG_UNK2 = 0x00000010, // ?
  151. ITEM_FLAG_UNK3 = 0x00000020, // ?
  152. ITEM_FLAG_UNK4 = 0x00000040, // ?
  153. ITEM_FLAG_UNK5 = 0x00000080, // ?
  154. ITEM_FLAG_BOP_TRADEABLE = 0x00000100, // Allows trading soulbound items
  155. ITEM_FLAG_READABLE = 0x00000200, // Opens text page when right clicked
  156. ITEM_FLAG_UNK6 = 0x00000400, // ?
  157. ITEM_FLAG_UNK7 = 0x00000800, // ?
  158. ITEM_FLAG_REFUNDABLE = 0x00001000, // Item can be returned to vendor for its original cost (extended cost)
  159. ITEM_FLAG_UNK8 = 0x00002000, // ?
  160. ITEM_FLAG_UNK9 = 0x00004000, // ?
  161. ITEM_FLAG_UNK10 = 0x00008000, // ?
  162. ITEM_FLAG_UNK11 = 0x00010000, // ?
  163. ITEM_FLAG_UNK12 = 0x00020000, // ?
  164. ITEM_FLAG_UNK13 = 0x00040000, // ?
  165. ITEM_FLAG_UNK14 = 0x00080000, // ?
  166. ITEM_FLAG_UNK15 = 0x00100000, // ?
  167. ITEM_FLAG_UNK16 = 0x00200000, // ?
  168. ITEM_FLAG_UNK17 = 0x00400000, // ?
  169. ITEM_FLAG_UNK18 = 0x00800000, // ?
  170. ITEM_FLAG_UNK19 = 0x01000000, // ?
  171. ITEM_FLAG_UNK20 = 0x02000000, // ?
  172. ITEM_FLAG_UNK21 = 0x04000000, // ?
  173. ITEM_FLAG_UNK22 = 0x08000000, // ?
  174. ITEM_FLAG_UNK23 = 0x10000000, // ?
  175. ITEM_FLAG_UNK24 = 0x20000000, // ?
  176. ITEM_FLAG_UNK25 = 0x40000000, // ?
  177. ITEM_FLAG_UNK26 = 0x80000000, // ?
  178.  
  179. ITEM_FLAG_MAIL_TEXT_MASK = ITEM_FLAG_READABLE | ITEM_FLAG_UNK13 | ITEM_FLAG_UNK14
  180. };
  181.  
  182. enum ItemFlagsExtra
  183. {
  184. ITEM_FLAGS_EXTRA_HORDE_ONLY = 0x00000001,
  185. ITEM_FLAGS_EXTRA_ALLIANCE_ONLY = 0x00000002,
  186. ITEM_FLAGS_EXTRA_EXT_COST_REQUIRES_GOLD = 0x00000004, // when item uses extended cost, gold is also required
  187. ITEM_FLAGS_EXTRA_NEED_ROLL_DISABLED = 0x00000100
  188. };
  189.  
  190. enum ItemFlagsCustom
  191. {
  192. ITEM_FLAGS_CU_DURATION_REAL_TIME = 0x0001, // Item duration will tick even if player is offline
  193. ITEM_FLAGS_CU_IGNORE_QUEST_STATUS = 0x0002, // No quest status will be checked when this item drops
  194. ITEM_FLAGS_CU_FOLLOW_LOOT_RULES = 0x0004 // Item will always follow group/master/need before greed looting rules
  195. };
  196.  
  197. enum BAG_FAMILY_MASK
  198. {
  199. BAG_FAMILY_MASK_NONE = 0x00000000,
  200. BAG_FAMILY_MASK_ARROWS = 0x00000001,
  201. BAG_FAMILY_MASK_BULLETS = 0x00000002,
  202. BAG_FAMILY_MASK_SOUL_SHARDS = 0x00000004,
  203. BAG_FAMILY_MASK_LEATHERWORKING_SUPP = 0x00000008,
  204. BAG_FAMILY_MASK_INSCRIPTION_SUPP = 0x00000010,
  205. BAG_FAMILY_MASK_HERBS = 0x00000020,
  206. BAG_FAMILY_MASK_ENCHANTING_SUPP = 0x00000040,
  207. BAG_FAMILY_MASK_ENGINEERING_SUPP = 0x00000080,
  208. BAG_FAMILY_MASK_KEYS = 0x00000100,
  209. BAG_FAMILY_MASK_GEMS = 0x00000200,
  210. BAG_FAMILY_MASK_MINING_SUPP = 0x00000400,
  211. BAG_FAMILY_MASK_SOULBOUND_EQUIPMENT = 0x00000800,
  212. BAG_FAMILY_MASK_VANITY_PETS = 0x00001000,
  213. BAG_FAMILY_MASK_CURRENCY_TOKENS = 0x00002000,
  214. BAG_FAMILY_MASK_QUEST_ITEMS = 0x00004000
  215. };
  216.  
  217. enum SocketColor
  218. {
  219. SOCKET_COLOR_META = 1,
  220. SOCKET_COLOR_RED = 2,
  221. SOCKET_COLOR_YELLOW = 4,
  222. SOCKET_COLOR_BLUE = 8
  223. };
  224.  
  225. #define SOCKET_COLOR_ALL (SOCKET_COLOR_META | SOCKET_COLOR_RED | SOCKET_COLOR_YELLOW | SOCKET_COLOR_BLUE)
  226.  
  227. enum InventoryType
  228. {
  229. INVTYPE_NON_EQUIP = 0,
  230. INVTYPE_HEAD = 1,
  231. INVTYPE_NECK = 2,
  232. INVTYPE_SHOULDERS = 3,
  233. INVTYPE_BODY = 4,
  234. INVTYPE_CHEST = 5,
  235. INVTYPE_WAIST = 6,
  236. INVTYPE_LEGS = 7,
  237. INVTYPE_FEET = 8,
  238. INVTYPE_WRISTS = 9,
  239. INVTYPE_HANDS = 10,
  240. INVTYPE_FINGER = 11,
  241. INVTYPE_TRINKET = 12,
  242. INVTYPE_WEAPON = 13,
  243. INVTYPE_SHIELD = 14,
  244. INVTYPE_RANGED = 15,
  245. INVTYPE_CLOAK = 16,
  246. INVTYPE_2HWEAPON = 17,
  247. INVTYPE_BAG = 18,
  248. INVTYPE_TABARD = 19,
  249. INVTYPE_ROBE = 20,
  250. INVTYPE_WEAPONMAINHAND = 21,
  251. INVTYPE_WEAPONOFFHAND = 22,
  252. INVTYPE_HOLDABLE = 23,
  253. INVTYPE_AMMO = 24,
  254. INVTYPE_THROWN = 25,
  255. INVTYPE_RANGEDRIGHT = 26,
  256. INVTYPE_QUIVER = 27,
  257. INVTYPE_RELIC = 28
  258. };
  259.  
  260. #define MAX_INVTYPE 29
  261.  
  262. enum ItemClass
  263. {
  264. ITEM_CLASS_CONSUMABLE = 0,
  265. ITEM_CLASS_CONTAINER = 1,
  266. ITEM_CLASS_WEAPON = 2,
  267. ITEM_CLASS_GEM = 3,
  268. ITEM_CLASS_ARMOR = 4,
  269. ITEM_CLASS_REAGENT = 5,
  270. ITEM_CLASS_PROJECTILE = 6,
  271. ITEM_CLASS_TRADE_GOODS = 7,
  272. ITEM_CLASS_GENERIC = 8,
  273. ITEM_CLASS_RECIPE = 9,
  274. ITEM_CLASS_MONEY = 10,
  275. ITEM_CLASS_QUIVER = 11,
  276. ITEM_CLASS_QUEST = 12,
  277. ITEM_CLASS_KEY = 13,
  278. ITEM_CLASS_PERMANENT = 14,
  279. ITEM_CLASS_MISC = 15,
  280. ITEM_CLASS_GLYPH = 16
  281. };
  282.  
  283. #define MAX_ITEM_CLASS 17
  284.  
  285. enum ItemSubclassConsumable
  286. {
  287. ITEM_SUBCLASS_CONSUMABLE = 0,
  288. ITEM_SUBCLASS_POTION = 1,
  289. ITEM_SUBCLASS_ELIXIR = 2,
  290. ITEM_SUBCLASS_FLASK = 3,
  291. ITEM_SUBCLASS_SCROLL = 4,
  292. ITEM_SUBCLASS_FOOD = 5,
  293. ITEM_SUBCLASS_ITEM_ENHANCEMENT = 6,
  294. ITEM_SUBCLASS_BANDAGE = 7,
  295. ITEM_SUBCLASS_CONSUMABLE_OTHER = 8
  296. };
  297.  
  298. #define MAX_ITEM_SUBCLASS_CONSUMABLE 9
  299.  
  300. enum ItemSubclassContainer
  301. {
  302. ITEM_SUBCLASS_CONTAINER = 0,
  303. ITEM_SUBCLASS_SOUL_CONTAINER = 1,
  304. ITEM_SUBCLASS_HERB_CONTAINER = 2,
  305. ITEM_SUBCLASS_ENCHANTING_CONTAINER = 3,
  306. ITEM_SUBCLASS_ENGINEERING_CONTAINER = 4,
  307. ITEM_SUBCLASS_GEM_CONTAINER = 5,
  308. ITEM_SUBCLASS_MINING_CONTAINER = 6,
  309. ITEM_SUBCLASS_LEATHERWORKING_CONTAINER = 7,
  310. ITEM_SUBCLASS_INSCRIPTION_CONTAINER = 8
  311. };
  312.  
  313. #define MAX_ITEM_SUBCLASS_CONTAINER 9
  314.  
  315. enum ItemSubclassWeapon
  316. {
  317. ITEM_SUBCLASS_WEAPON_AXE = 0,
  318. ITEM_SUBCLASS_WEAPON_AXE2 = 1,
  319. ITEM_SUBCLASS_WEAPON_BOW = 2,
  320. ITEM_SUBCLASS_WEAPON_GUN = 3,
  321. ITEM_SUBCLASS_WEAPON_MACE = 4,
  322. ITEM_SUBCLASS_WEAPON_MACE2 = 5,
  323. ITEM_SUBCLASS_WEAPON_POLEARM = 6,
  324. ITEM_SUBCLASS_WEAPON_SWORD = 7,
  325. ITEM_SUBCLASS_WEAPON_SWORD2 = 8,
  326. ITEM_SUBCLASS_WEAPON_obsolete = 9,
  327. ITEM_SUBCLASS_WEAPON_STAFF = 10,
  328. ITEM_SUBCLASS_WEAPON_EXOTIC = 11,
  329. ITEM_SUBCLASS_WEAPON_EXOTIC2 = 12,
  330. ITEM_SUBCLASS_WEAPON_FIST = 13,
  331. ITEM_SUBCLASS_WEAPON_MISC = 14,
  332. ITEM_SUBCLASS_WEAPON_DAGGER = 15,
  333. ITEM_SUBCLASS_WEAPON_THROWN = 16,
  334. ITEM_SUBCLASS_WEAPON_SPEAR = 17,
  335. ITEM_SUBCLASS_WEAPON_CROSSBOW = 18,
  336. ITEM_SUBCLASS_WEAPON_WAND = 19,
  337. ITEM_SUBCLASS_WEAPON_FISHING_POLE = 20
  338. };
  339.  
  340. #define ITEM_SUBCLASS_MASK_WEAPON_RANGED (\
  341. (1 << ITEM_SUBCLASS_WEAPON_BOW) | (1 << ITEM_SUBCLASS_WEAPON_GUN) |\
  342. (1 << ITEM_SUBCLASS_WEAPON_CROSSBOW) | (1 << ITEM_SUBCLASS_WEAPON_THROWN))
  343.  
  344. #define MAX_ITEM_SUBCLASS_WEAPON 21
  345.  
  346. enum ItemSubclassGem
  347. {
  348. ITEM_SUBCLASS_GEM_RED = 0,
  349. ITEM_SUBCLASS_GEM_BLUE = 1,
  350. ITEM_SUBCLASS_GEM_YELLOW = 2,
  351. ITEM_SUBCLASS_GEM_PURPLE = 3,
  352. ITEM_SUBCLASS_GEM_GREEN = 4,
  353. ITEM_SUBCLASS_GEM_ORANGE = 5,
  354. ITEM_SUBCLASS_GEM_META = 6,
  355. ITEM_SUBCLASS_GEM_SIMPLE = 7,
  356. ITEM_SUBCLASS_GEM_PRISMATIC = 8
  357. };
  358.  
  359. #define MAX_ITEM_SUBCLASS_GEM 9
  360.  
  361. enum ItemSubclassArmor
  362. {
  363. ITEM_SUBCLASS_ARMOR_MISC = 0,
  364. ITEM_SUBCLASS_ARMOR_CLOTH = 1,
  365. ITEM_SUBCLASS_ARMOR_LEATHER = 2,
  366. ITEM_SUBCLASS_ARMOR_MAIL = 3,
  367. ITEM_SUBCLASS_ARMOR_PLATE = 4,
  368. ITEM_SUBCLASS_ARMOR_BUCKLER = 5,
  369. ITEM_SUBCLASS_ARMOR_SHIELD = 6,
  370. ITEM_SUBCLASS_ARMOR_LIBRAM = 7,
  371. ITEM_SUBCLASS_ARMOR_IDOL = 8,
  372. ITEM_SUBCLASS_ARMOR_TOTEM = 9,
  373. ITEM_SUBCLASS_ARMOR_SIGIL = 10
  374. };
  375.  
  376. #define MAX_ITEM_SUBCLASS_ARMOR 11
  377.  
  378. enum ItemSubclassReagent
  379. {
  380. ITEM_SUBCLASS_REAGENT = 0
  381. };
  382.  
  383. #define MAX_ITEM_SUBCLASS_REAGENT 1
  384.  
  385. enum ItemSubclassProjectile
  386. {
  387. ITEM_SUBCLASS_WAND = 0, // ABS
  388. ITEM_SUBCLASS_BOLT = 1, // ABS
  389. ITEM_SUBCLASS_ARROW = 2,
  390. ITEM_SUBCLASS_BULLET = 3,
  391. ITEM_SUBCLASS_THROWN = 4 // ABS
  392. };
  393.  
  394. #define MAX_ITEM_SUBCLASS_PROJECTILE 5
  395.  
  396. enum ItemSubclassTradeGoods
  397. {
  398. ITEM_SUBCLASS_TRADE_GOODS = 0,
  399. ITEM_SUBCLASS_PARTS = 1,
  400. ITEM_SUBCLASS_EXPLOSIVES = 2,
  401. ITEM_SUBCLASS_DEVICES = 3,
  402. ITEM_SUBCLASS_JEWELCRAFTING = 4,
  403. ITEM_SUBCLASS_CLOTH = 5,
  404. ITEM_SUBCLASS_LEATHER = 6,
  405. ITEM_SUBCLASS_METAL_STONE = 7,
  406. ITEM_SUBCLASS_MEAT = 8,
  407. ITEM_SUBCLASS_HERB = 9,
  408. ITEM_SUBCLASS_ELEMENTAL = 10,
  409. ITEM_SUBCLASS_TRADE_GOODS_OTHER = 11,
  410. ITEM_SUBCLASS_ENCHANTING = 12,
  411. ITEM_SUBCLASS_MATERIAL = 13,
  412. ITEM_SUBCLASS_ARMOR_ENCHANTMENT = 14,
  413. ITEM_SUBCLASS_WEAPON_ENCHANTMENT = 15
  414. };
  415.  
  416. #define MAX_ITEM_SUBCLASS_TRADE_GOODS 16
  417.  
  418. enum ItemSubclassGeneric
  419. {
  420. ITEM_SUBCLASS_GENERIC = 0
  421. };
  422.  
  423. #define MAX_ITEM_SUBCLASS_GENERIC 1
  424.  
  425. enum ItemSubclassRecipe
  426. {
  427. ITEM_SUBCLASS_BOOK = 0,
  428. ITEM_SUBCLASS_LEATHERWORKING_PATTERN = 1,
  429. ITEM_SUBCLASS_TAILORING_PATTERN = 2,
  430. ITEM_SUBCLASS_ENGINEERING_SCHEMATIC = 3,
  431. ITEM_SUBCLASS_BLACKSMITHING = 4,
  432. ITEM_SUBCLASS_COOKING_RECIPE = 5,
  433. ITEM_SUBCLASS_ALCHEMY_RECIPE = 6,
  434. ITEM_SUBCLASS_FIRST_AID_MANUAL = 7,
  435. ITEM_SUBCLASS_ENCHANTING_FORMULA = 8,
  436. ITEM_SUBCLASS_FISHING_MANUAL = 9,
  437. ITEM_SUBCLASS_JEWELCRAFTING_RECIPE = 10
  438. };
  439.  
  440. #define MAX_ITEM_SUBCLASS_RECIPE 11
  441.  
  442. enum ItemSubclassMoney
  443. {
  444. ITEM_SUBCLASS_MONEY = 0
  445. };
  446.  
  447. #define MAX_ITEM_SUBCLASS_MONEY 1
  448.  
  449. enum ItemSubclassQuiver
  450. {
  451. ITEM_SUBCLASS_QUIVER0 = 0, // ABS
  452. ITEM_SUBCLASS_QUIVER1 = 1, // ABS
  453. ITEM_SUBCLASS_QUIVER = 2,
  454. ITEM_SUBCLASS_AMMO_POUCH = 3
  455. };
  456.  
  457. #define MAX_ITEM_SUBCLASS_QUIVER 4
  458.  
  459. enum ItemSubclassQuest
  460. {
  461. ITEM_SUBCLASS_QUEST = 0
  462. };
  463.  
  464. #define MAX_ITEM_SUBCLASS_QUEST 1
  465.  
  466. enum ItemSubclassKey
  467. {
  468. ITEM_SUBCLASS_KEY = 0,
  469. ITEM_SUBCLASS_LOCKPICK = 1
  470. };
  471.  
  472. #define MAX_ITEM_SUBCLASS_KEY 2
  473.  
  474. enum ItemSubclassPermanent
  475. {
  476. ITEM_SUBCLASS_PERMANENT = 0
  477. };
  478.  
  479. #define MAX_ITEM_SUBCLASS_PERMANENT 1
  480.  
  481. enum ItemSubclassJunk
  482. {
  483. ITEM_SUBCLASS_JUNK = 0,
  484. ITEM_SUBCLASS_JUNK_REAGENT = 1,
  485. ITEM_SUBCLASS_JUNK_PET = 2,
  486. ITEM_SUBCLASS_JUNK_HOLIDAY = 3,
  487. ITEM_SUBCLASS_JUNK_OTHER = 4,
  488. ITEM_SUBCLASS_JUNK_MOUNT = 5
  489. };
  490.  
  491. #define MAX_ITEM_SUBCLASS_JUNK 6
  492.  
  493. enum ItemSubclassGlyph
  494. {
  495. ITEM_SUBCLASS_GLYPH_WARRIOR = 1,
  496. ITEM_SUBCLASS_GLYPH_PALADIN = 2,
  497. ITEM_SUBCLASS_GLYPH_HUNTER = 3,
  498. ITEM_SUBCLASS_GLYPH_ROGUE = 4,
  499. ITEM_SUBCLASS_GLYPH_PRIEST = 5,
  500. ITEM_SUBCLASS_GLYPH_DEATH_KNIGHT = 6,
  501. ITEM_SUBCLASS_GLYPH_SHAMAN = 7,
  502. ITEM_SUBCLASS_GLYPH_MAGE = 8,
  503. ITEM_SUBCLASS_GLYPH_WARLOCK = 9,
  504. ITEM_SUBCLASS_GLYPH_DRUID = 11
  505. };
  506.  
  507. #define MAX_ITEM_SUBCLASS_GLYPH 12
  508.  
  509. const uint32 MaxItemSubclassValues[MAX_ITEM_CLASS] =
  510. {
  511. MAX_ITEM_SUBCLASS_CONSUMABLE,
  512. MAX_ITEM_SUBCLASS_CONTAINER,
  513. MAX_ITEM_SUBCLASS_WEAPON,
  514. MAX_ITEM_SUBCLASS_GEM,
  515. MAX_ITEM_SUBCLASS_ARMOR,
  516. MAX_ITEM_SUBCLASS_REAGENT,
  517. MAX_ITEM_SUBCLASS_PROJECTILE,
  518. MAX_ITEM_SUBCLASS_TRADE_GOODS,
  519. MAX_ITEM_SUBCLASS_GENERIC,
  520. MAX_ITEM_SUBCLASS_RECIPE,
  521. MAX_ITEM_SUBCLASS_MONEY,
  522. MAX_ITEM_SUBCLASS_QUIVER,
  523. MAX_ITEM_SUBCLASS_QUEST,
  524. MAX_ITEM_SUBCLASS_KEY,
  525. MAX_ITEM_SUBCLASS_PERMANENT,
  526. MAX_ITEM_SUBCLASS_JUNK,
  527. MAX_ITEM_SUBCLASS_GLYPH
  528. };
  529.  
  530. inline uint8 ItemSubClassToDurabilityMultiplierId(uint32 ItemClass, uint32 ItemSubClass)
  531. {
  532. switch (ItemClass)
  533. {
  534. case ITEM_CLASS_WEAPON: return ItemSubClass;
  535. case ITEM_CLASS_ARMOR: return ItemSubClass + 21;
  536. }
  537. return 0;
  538. }
  539.  
  540. // GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some platform
  541. #if defined(__GNUC__)
  542. #pragma pack(1)
  543. #else
  544. #pragma pack(push, 1)
  545. #endif
  546.  
  547. struct _Damage
  548. {
  549. float DamageMin;
  550. float DamageMax;
  551. uint32 DamageType; // id from Resistances.dbc
  552. };
  553.  
  554. struct _ItemStat
  555. {
  556. uint32 ItemStatType;
  557. int32 ItemStatValue;
  558. };
  559. struct _Spell
  560. {
  561. int32 SpellId; // id from Spell.dbc
  562. uint32 SpellTrigger;
  563. int32 SpellCharges;
  564. float SpellPPMRate;
  565. int32 SpellCooldown;
  566. uint32 SpellCategory; // id from SpellCategory.dbc
  567. int32 SpellCategoryCooldown;
  568. };
  569.  
  570. struct _Socket
  571. {
  572. uint32 Color;
  573. uint32 Content;
  574. };
  575.  
  576. // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
  577. #if defined(__GNUC__)
  578. #pragma pack()
  579. #else
  580. #pragma pack(pop)
  581. #endif
  582.  
  583. #define MAX_ITEM_PROTO_DAMAGES 2 // changed in 3.1.0
  584. #define MAX_ITEM_PROTO_SOCKETS 3
  585. #define MAX_ITEM_PROTO_SPELLS 5
  586. #define MAX_ITEM_PROTO_STATS 10
  587.  
  588. struct ItemTemplate
  589. {
  590. uint32 ItemId;
  591. uint32 Class; // id from ItemClass.dbc
  592. uint32 SubClass; // id from ItemSubClass.dbc
  593. int32 SoundOverrideSubclass; // < 0: id from ItemSubClass.dbc, used to override weapon sound from actual SubClass
  594. std::string Name1;
  595. uint32 DisplayInfoID; // id from ItemDisplayInfo.dbc
  596. uint32 Quality;
  597. uint32 Flags;
  598. uint32 Flags2;
  599. uint32 BuyCount;
  600. int32 BuyPrice;
  601. uint32 SellPrice;
  602. uint32 InventoryType;
  603. uint32 AllowableClass;
  604. uint32 AllowableRace;
  605. uint32 ItemLevel;
  606. uint32 RequiredLevel;
  607. uint32 RequiredSkill; // id from SkillLine.dbc
  608. uint32 RequiredSkillRank;
  609. uint32 RequiredSpell; // id from Spell.dbc
  610. uint32 RequiredHonorRank;
  611. uint32 RequiredCityRank;
  612. uint32 RequiredReputationFaction; // id from Faction.dbc
  613. uint32 RequiredReputationRank;
  614. int32 MaxCount; // <= 0: no limit
  615. int32 Stackable; // 0: not allowed, -1: put in player coin info tab and don't limit stacking (so 1 slot)
  616. uint32 ContainerSlots;
  617. uint32 StatsCount;
  618. _ItemStat ItemStat[MAX_ITEM_PROTO_STATS];
  619. uint32 ScalingStatDistribution; // id from ScalingStatDistribution.dbc
  620. uint32 ScalingStatValue; // mask for selecting column in ScalingStatValues.dbc
  621. _Damage Damage[MAX_ITEM_PROTO_DAMAGES];
  622. uint32 Armor;
  623. uint32 HolyRes;
  624. uint32 FireRes;
  625. uint32 NatureRes;
  626. uint32 FrostRes;
  627. uint32 ShadowRes;
  628. uint32 ArcaneRes;
  629. uint32 Delay;
  630. uint32 AmmoType;
  631. float RangedModRange;
  632. _Spell Spells[MAX_ITEM_PROTO_SPELLS];
  633. uint32 Bonding;
  634. std::string Description;
  635. uint32 PageText;
  636. uint32 LanguageID;
  637. uint32 PageMaterial;
  638. uint32 StartQuest; // id from QuestCache.wdb
  639. uint32 LockID;
  640. int32 Material; // id from Material.dbc
  641. uint32 Sheath;
  642. int32 RandomProperty; // id from ItemRandomProperties.dbc
  643. int32 RandomSuffix; // id from ItemRandomSuffix.dbc
  644. uint32 Block;
  645. uint32 ItemSet; // id from ItemSet.dbc
  646. uint32 MaxDurability;
  647. uint32 Area; // id from AreaTable.dbc
  648. uint32 Map; // id from Map.dbc
  649. uint32 BagFamily; // bit mask (1 << id from ItemBagFamily.dbc)
  650. uint32 TotemCategory; // id from TotemCategory.dbc
  651. _Socket Socket[MAX_ITEM_PROTO_SOCKETS];
  652. uint32 socketBonus; // id from SpellItemEnchantment.dbc
  653. uint32 GemProperties; // id from GemProperties.dbc
  654. uint32 RequiredDisenchantSkill;
  655. float ArmorDamageModifier;
  656. uint32 Duration;
  657. uint32 ItemLimitCategory; // id from ItemLimitCategory.dbc
  658. uint32 HolidayId; // id from Holidays.dbc
  659. uint32 ScriptId;
  660. uint32 DisenchantID;
  661. uint32 FoodType;
  662. uint32 MinMoneyLoot;
  663. uint32 MaxMoneyLoot;
  664. uint32 FlagsCu;
  665.  
  666. // helpers
  667. bool CanChangeEquipStateInCombat() const
  668. {
  669. switch (InventoryType)
  670. {
  671. case INVTYPE_RELIC:
  672. case INVTYPE_SHIELD:
  673. case INVTYPE_HOLDABLE:
  674. return true;
  675. }
  676.  
  677. switch (Class)
  678. {
  679. case ITEM_CLASS_WEAPON:
  680. case ITEM_CLASS_PROJECTILE:
  681. return true;
  682. }
  683.  
  684. return false;
  685. }
  686.  
  687. bool IsCurrencyToken() const { return BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS; }
  688.  
  689. uint32 GetMaxStackSize() const
  690. {
  691. return (Stackable == 2147483647 || Stackable <= 0) ? uint32(0x7FFFFFFF-1) : uint32(Stackable);
  692. }
  693.  
  694. float getDPS() const
  695. {
  696. if (Delay == 0)
  697. return 0;
  698. float temp = 0;
  699. for (int i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
  700. temp+=Damage[i].DamageMin + Damage[i].DamageMax;
  701. return temp*500/Delay;
  702. }
  703.  
  704. int32 getFeralBonus(int32 extraDPS = 0) const
  705. {
  706. // 0x02A5F3 - is mask for Melee weapon from ItemSubClassMask.dbc
  707. if (Class == ITEM_CLASS_WEAPON && (1<<SubClass)&0x02A5F3)
  708. {
  709. int32 bonus = int32((extraDPS + getDPS())*14.0f) - 767;
  710. if (bonus < 0)
  711. return 0;
  712. return bonus;
  713. }
  714. return 0;
  715. }
  716.  
  717. float GetItemLevelIncludingQuality() const
  718. {
  719. float itemLevel = (float)ItemLevel;
  720. switch (Quality)
  721. {
  722. case ITEM_QUALITY_POOR:
  723. case ITEM_QUALITY_NORMAL:
  724. case ITEM_QUALITY_UNCOMMON:
  725. case ITEM_QUALITY_ARTIFACT:
  726. case ITEM_QUALITY_HEIRLOOM:
  727. itemLevel -= 13; // leaving this as a separate statement since we do not know the real behavior in this case
  728. break;
  729. case ITEM_QUALITY_RARE:
  730. itemLevel -= 13;
  731. break;
  732. case ITEM_QUALITY_EPIC:
  733. case ITEM_QUALITY_LEGENDARY:
  734. default:
  735. break;
  736. }
  737. return itemLevel;
  738. }
  739.  
  740. bool IsPotion() const { return Class == ITEM_CLASS_CONSUMABLE && SubClass == ITEM_SUBCLASS_POTION; }
  741. bool IsWeaponVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT; }
  742. bool IsArmorVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT; }
  743. bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_PROTO_FLAG_CONJURED); }
  744. };
  745.  
  746. // Benchmarked: Faster than std::map (insert/find)
  747. typedef std::unordered_map <uint32, std::map;> <uint32, int32> > ItemFakeStatContainer; // custom
  748.  
  749. struct ItemLocale
  750. {
  751. StringVector Name;
  752. StringVector Description;
  753. };
  754.  
  755. struct ItemSetNameEntry
  756. {
  757. std::string name;
  758. uint32 InventoryType;
  759. };
  760.  
  761. struct ItemSetNameLocale
  762. {
  763. StringVector Name;
  764. };
  765.  
  766. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement