Advertisement
Guest User

Untitled

a guest
Dec 16th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.96 KB | None | 0 0
  1. --azerite traits
  2. function(event)
  3. if (aura_env.config["mode"] == 3 or aura_env.config["mode"] == 5)
  4. and aura_env.config["showMaxTiers"] ~= 1
  5. and (event == "PLAYER_EQUIPMENT_CHANGED" or event == "AZERITE_EMPOWERED_ITEM_SELECTION_UPDATED")
  6. then
  7. local data = {}
  8. local header = "trait"
  9. local count = aura_env.config["mode"] == 5 and 1 or 80
  10. local specID = GetSpecializationInfo(GetSpecialization())
  11. for _, slot in next, {1,3,5} do
  12. local item = Item:CreateFromEquipmentSlot(slot)
  13. if (not item:IsItemEmpty()) then
  14. local itemLocation = item:GetItemLocation()
  15. if (C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItem(itemLocation)) then
  16. local itemID = GetInventoryItemLink("player", slot)
  17. local name, _, quality, ilvl = GetItemInfo(itemID)
  18. name = name or ""
  19.  
  20. local circle = 1
  21. local tierInfo = C_AzeriteEmpoweredItem.GetAllTierInfo(itemLocation)
  22. for tier, info in next, tierInfo do
  23. if aura_env.config["showMaxTiers"] == 2 or tier <= aura_env.config["showMaxTiers"]-2 then
  24. for _, powerID in next, info.azeritePowerIDs do
  25. local powerInfo = C_AzeriteEmpoweredItem.GetPowerInfo(powerID)
  26. local id = name..powerInfo.spellID
  27. local spellName, _, spellIcon = GetSpellInfo(powerInfo.spellID)
  28. local description = GetSpellDescription(powerInfo.spellID)
  29. local canSelect = C_AzeriteEmpoweredItem.CanSelectPower(itemLocation, powerID)
  30. if powerInfo.spellID == 263978 then
  31. spellIcon = aura_env.config["upgradeTexture"]
  32. end
  33. if powerID and specID then
  34. if powerInfo.spellID ~= 263978 and C_AzeriteEmpoweredItem.IsPowerSelected(itemLocation, powerID) then
  35. if not data[powerInfo.spellID] then
  36. data[powerInfo.spellID] = {
  37. header = header,
  38. name = spellName,
  39. icon = spellIcon,
  40. spellid = powerInfo.spellID,
  41. count = count,
  42. totalTraits = 1,
  43. description = description,
  44. notWorking = not C_AzeriteEmpoweredItem.IsPowerAvailableForSpec(powerID, specID),
  45. ilvl = "|cFFbbbbbb1|r",
  46. canSelect = false,
  47. relativeTo = itemSlot,
  48. changed = true,
  49. show = true,
  50. }
  51. count = count + 1
  52. elseif data[powerInfo.spellID] then
  53. data[powerInfo.spellID].totalTraits = data[powerInfo.spellID].totalTraits + 1
  54. data[powerInfo.spellID].ilvl = "|cFFbbbbbb"..data[powerInfo.spellID].totalTraits.."|r"
  55. end
  56. elseif canSelect then
  57. data[id] = {
  58. header = header,
  59. name = spellName,
  60. icon = spellIcon,
  61. spellid = powerInfo.spellID,
  62. count = count,
  63. description = description,
  64. notWorking = not C_AzeriteEmpoweredItem.IsPowerAvailableForSpec(powerID, specID),
  65. ilvl = "|cFFbbbbbbT"..circle.."|r",
  66. canSelect = true,
  67. relativeTo = itemSlot,
  68. changed = true,
  69. show = true,
  70. }
  71. count = count + 1
  72. end
  73. end
  74. end
  75. end
  76. circle = circle + 1
  77. end
  78. end
  79. end
  80. end
  81. WeakAuras.ScanEvents("WA_TALENT_SETUP", header, data)
  82. elseif (aura_env.config["mode"] == 1 or aura_env.config["mode"] == 2 or aura_env.config["mode"] == 4)
  83. and aura_env.config["showAzeriteEmpoweredItems"]
  84. and (event == "PLAYER_EQUIPMENT_CHANGED" or event == "AZERITE_EMPOWERED_ITEM_SELECTION_UPDATED")
  85. then
  86. local data = {}
  87. local header = "trait"
  88. local count = aura_env.config["mode"] == 4 and 15 or 80
  89. local specID = GetSpecializationInfo(GetSpecialization())
  90. for _, slot in next, {1,3,5} do
  91. local item = Item:CreateFromEquipmentSlot(slot)
  92. if (not item:IsItemEmpty()) then
  93. local itemLocation = item:GetItemLocation()
  94. if (C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItem(itemLocation)) then
  95. local itemID = GetInventoryItemLink("player", slot)
  96. local name, _, quality, ilvl = GetItemInfo(itemID)
  97. name = name or ""
  98. ilvl = ilvl or 1
  99. quality = quality or 2
  100. local icon = GetItemIcon(itemID)
  101. local itemSlot = slot == 1 and "HEAD" or slot == 3 and "SHOULDERS" or slot == 5 and "CHEST"
  102. data[count] = {
  103. header = header,
  104. name = aura_env.config["hideItems"] and "" or ITEM_QUALITY_COLORS[quality].hex..name.."|r",
  105. icon = icon,
  106. count = count,
  107. link = itemID,
  108. description = "",
  109. hideMe = aura_env.config["hideItems"],
  110. ilvl = aura_env.config["hideItems"] and "" or ITEM_QUALITY_COLORS[quality].hex..ilvl.."|r",
  111. itemSlot = itemSlot,
  112. changed = true,
  113. show = true,
  114. }
  115. count = count + 1
  116. if aura_env.config["showMaxTiers"] ~= 1 then
  117. local circle = 1
  118. local tierInfo = C_AzeriteEmpoweredItem.GetAllTierInfo(itemLocation)
  119. for tier, info in next, tierInfo do
  120. if aura_env.config["showMaxTiers"] == 2 or tier <= aura_env.config["showMaxTiers"]-2 then
  121. for _, powerID in next, info.azeritePowerIDs do
  122. local powerInfo = C_AzeriteEmpoweredItem.GetPowerInfo(powerID)
  123. local id = name..powerInfo.spellID
  124. local spellName, _, spellIcon = GetSpellInfo(powerInfo.spellID)
  125. if powerInfo.spellID == 263978 then
  126. spellIcon = aura_env.config["upgradeTexture"]
  127. end
  128. local description = GetSpellDescription(powerInfo.spellID)
  129. local canSelect = C_AzeriteEmpoweredItem.CanSelectPower(itemLocation, powerID)
  130. if powerID and specID and (C_AzeriteEmpoweredItem.IsPowerSelected(itemLocation, powerID) or canSelect) then
  131. if powerInfo.spellID == 263978 and not canSelect then
  132. if aura_env.config["showUpgrade"] and aura_env.config["showMaxTiers"] == 2 then
  133. data[id] = {
  134. header = header,
  135. name = spellName,
  136. icon = spellIcon,
  137. spellid = powerInfo.spellID,
  138. count = count,
  139. description = description,
  140. notWorking = not C_AzeriteEmpoweredItem.IsPowerAvailableForSpec(powerID, specID),
  141. ilvl = "|cFFbbbbbbT"..circle.."|r",
  142. canSelect = canSelect,
  143. relativeTo = itemSlot,
  144. changed = true,
  145. show = true,
  146. }
  147. end
  148. else
  149. data[id] = {
  150. header = header,
  151. name = spellName,
  152. icon = spellIcon,
  153. spellid = powerInfo.spellID,
  154. count = count,
  155. description = description,
  156. notWorking = not C_AzeriteEmpoweredItem.IsPowerAvailableForSpec(powerID, specID),
  157. ilvl = "|cFFbbbbbbT"..circle.."|r",
  158. canSelect = canSelect,
  159. relativeTo = itemSlot,
  160. changed = true,
  161. show = true,
  162. }
  163. count = count + 1
  164. end
  165. end
  166. end
  167. end
  168. circle = circle + 1
  169. end
  170. end
  171. end
  172. end
  173. end
  174. WeakAuras.ScanEvents("WA_TALENT_SETUP", header, data)
  175. end
  176. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement