comparison Constants.lua @ 81:0515882856f1 v38

updated for 7.0
author yellowfive
date Tue, 19 Jul 2016 10:05:32 -0700
parents 69db1c3025ac
children 6bbe64d587b4
comparison
equal deleted inserted replaced
80:8f235b016212 81:0515882856f1
1 local Amr = LibStub("AceAddon-3.0"):GetAddon("AskMrRobot") 1 local Amr = LibStub("AceAddon-3.0"):GetAddon("AskMrRobot")
2 local L = LibStub("AceLocale-3.0"):GetLocale("AskMrRobot", true) 2 local L = LibStub("AceLocale-3.0"):GetLocale("AskMrRobot", true)
3 3
4 -- min import version that we will read from the website 4 -- min import version that we will read from the website
5 Amr.MIN_IMPORT_VERSION = 21 5 Amr.MIN_IMPORT_VERSION = 36
6 6
7 -- min addon version that we will support for inter-addon communication for e.g. the team optimizer 7 -- min addon version that we will support for inter-addon communication for e.g. the team optimizer
8 -- last update to version 24 when item link format changed 8 -- last update to version 36 for Legion pre-patch
9 Amr.MIN_ADDON_VERSION = 24 9 Amr.MIN_ADDON_VERSION = 36
10 10
11 -- import some constants from the serializer for convenience 11 -- import some constants from the serializer for convenience
12 Amr.ChatPrefix = Amr.Serializer.ChatPrefix 12 Amr.ChatPrefix = Amr.Serializer.ChatPrefix
13 Amr.RegionNames = Amr.Serializer.RegionNames 13 Amr.RegionNames = Amr.Serializer.RegionNames
14 Amr.SlotIds = Amr.Serializer.SlotIds 14 Amr.SlotIds = Amr.Serializer.SlotIds
21 Amr.SupportedInstanceIds = Amr.Serializer.SupportedInstanceIds 21 Amr.SupportedInstanceIds = Amr.Serializer.SupportedInstanceIds
22 Amr.ParseItemLink = Amr.Serializer.ParseItemLink 22 Amr.ParseItemLink = Amr.Serializer.ParseItemLink
23 Amr.IsSupportedInstanceId = Amr.Serializer.IsSupportedInstanceId 23 Amr.IsSupportedInstanceId = Amr.Serializer.IsSupportedInstanceId
24 Amr.IsSupportedInstance = Amr.Serializer.IsSupportedInstance 24 Amr.IsSupportedInstance = Amr.Serializer.IsSupportedInstance
25 Amr.SetTokenIds = Amr.Serializer.SetTokenIds 25 Amr.SetTokenIds = Amr.Serializer.SetTokenIds
26 Amr.GetItemTooltip = Amr.Serializer.GetItemTooltip
27 Amr.GetItemLevel = Amr.Serializer.GetItemLevel
28 Amr.GetItemUniqueId = Amr.Serializer.GetItemUniqueId
26 29
27 -- map of slot ID to display text 30 -- map of slot ID to display text
28 Amr.SlotDisplayText = { 31 Amr.SlotDisplayText = {
29 [1] = _G["HEADSLOT"], 32 [1] = _G["HEADSLOT"],
30 [2] = _G["NECKSLOT"], 33 [2] = _G["NECKSLOT"],
65 68
66 Amr.SpecIcons = { 69 Amr.SpecIcons = {
67 [1] = "spell_deathknight_bloodpresence", -- DeathKnightBlood 70 [1] = "spell_deathknight_bloodpresence", -- DeathKnightBlood
68 [2] = "spell_deathknight_frostpresence", -- DeathKnightFrost 71 [2] = "spell_deathknight_frostpresence", -- DeathKnightFrost
69 [3] = "spell_deathknight_unholypresence", -- DeathKnightUnholy 72 [3] = "spell_deathknight_unholypresence", -- DeathKnightUnholy
70 [4] = "spell_nature_starfall", -- DruidBalance 73 [4] = "ability_demonhunter_specdps", -- DemonHunterHavoc
71 [5] = "ability_druid_catform", -- DruidFeral 74 [5] = "ability_demonhunter_spectank", -- DemonHunterVengeance
72 [6] = "ability_racial_bearform", -- DruidGuardian 75 [6] = "spell_nature_starfall", -- DruidBalance
73 [7] = "spell_nature_healingtouch", -- DruidRestoration 76 [7] = "ability_druid_catform", -- DruidFeral
74 [8] = "ability_hunter_bestialdiscipline", -- HunterBeastMastery 77 [8] = "ability_racial_bearform", -- DruidGuardian
75 [9] = "ability_hunter_focusedaim", -- HunterMarksmanship 78 [9] = "spell_nature_healingtouch", -- DruidRestoration
76 [10] = "ability_hunter_camouflage", -- HunterSurvival 79 [10] = "ability_hunter_bestialdiscipline", -- HunterBeastMastery
77 [11] = "spell_holy_magicalsentry", -- MageArcane 80 [11] = "ability_hunter_focusedaim", -- HunterMarksmanship
78 [12] = "spell_fire_firebolt02", -- MageFire 81 [12] = "ability_hunter_camouflage", -- HunterSurvival
79 [13] = "spell_frost_frostbolt02", -- MageFrost 82 [13] = "spell_holy_magicalsentry", -- MageArcane
80 [14] = "spell_monk_brewmaster_spec", -- MonkBrewmaster 83 [14] = "spell_fire_firebolt02", -- MageFire
81 [15] = "spell_monk_mistweaver_spec", -- MonkMistweaver 84 [15] = "spell_frost_frostbolt02", -- MageFrost
82 [16] = "spell_monk_windwalker_spec", -- MonkWindwalker 85 [16] = "spell_monk_brewmaster_spec", -- MonkBrewmaster
83 [17] = "spell_holy_holybolt", -- PaladinHoly 86 [17] = "spell_monk_mistweaver_spec", -- MonkMistweaver
84 [18] = "ability_paladin_shieldofthetemplar", -- PaladinProtection 87 [18] = "spell_monk_windwalker_spec", -- MonkWindwalker
85 [19] = "spell_holy_auraoflight", -- PaladinRetribution 88 [19] = "spell_holy_holybolt", -- PaladinHoly
86 [20] = "spell_holy_powerwordshield", -- PriestDiscipline 89 [20] = "ability_paladin_shieldofthetemplar", -- PaladinProtection
87 [21] = "spell_holy_guardianspirit", -- PriestHoly 90 [21] = "spell_holy_auraoflight", -- PaladinRetribution
88 [22] = "spell_shadow_shadowwordpain", -- PriestShadow 91 [22] = "spell_holy_powerwordshield", -- PriestDiscipline
89 [23] = "ability_rogue_eviscerate", -- RogueAssassination 92 [23] = "spell_holy_guardianspirit", -- PriestHoly
90 [24] = "ability_backstab", -- RogueCombat 93 [24] = "spell_shadow_shadowwordpain", -- PriestShadow
91 [25] = "ability_stealth", -- RogueSubtlety 94 [25] = "ability_rogue_eviscerate", -- RogueAssassination
92 [26] = "spell_nature_lightning", -- ShamanElemental 95 [26] = "inv_sword_30", -- RogueOutlaw
93 [27] = "spell_nature_lightningshield", -- ShamanEnhancement 96 [27] = "ability_stealth", -- RogueSubtlety
94 [28] = "spell_nature_magicimmunity", -- ShamanRestoration 97 [28] = "spell_nature_lightning", -- ShamanElemental
95 [29] = "spell_shadow_deathcoil", -- WarlockAffliction 98 [29] = "spell_nature_lightningshield", -- ShamanEnhancement
96 [30] = "spell_shadow_metamorphosis", -- WarlockDemonology 99 [30] = "spell_nature_magicimmunity", -- ShamanRestoration
97 [31] = "spell_shadow_rainoffire", -- WarlockDestruction 100 [31] = "spell_shadow_deathcoil", -- WarlockAffliction
98 [32] = "ability_warrior_savageblow", -- WarriorArms 101 [32] = "spell_shadow_metamorphosis", -- WarlockDemonology
99 [33] = "ability_warrior_innerrage", -- WarriorFury 102 [33] = "spell_shadow_rainoffire", -- WarlockDestruction
100 [34] = "ability_warrior_defensivestance", -- WarriorProtection 103 [34] = "ability_warrior_savageblow", -- WarriorArms
101 [38] = "ability_warrior_defensivestance", -- WarriorProtection, used for special subspec handling 104 [35] = "ability_warrior_innerrage", -- WarriorFury
102 [39] = "spell_warrior_gladiatorstance" -- WarriorProtectionGlad, used for special subspec handling 105 [36] = "ability_warrior_defensivestance", -- WarriorProtection
103 } 106 }
104 107
105 -- instance IDs ordered in preferred display order 108 -- instance IDs ordered in preferred display order
106 Amr.InstanceIdsOrdered = { 1448, 1205, 1228 } 109 Amr.InstanceIdsOrdered = { 1448, 1205, 1228 }
107 110
146 table.insert(parts, -math.abs(itemObj.suffixId)) 149 table.insert(parts, -math.abs(itemObj.suffixId))
147 end 150 end
148 151
149 table.insert(parts, 0) -- some unique id, doesn't seem to matter 152 table.insert(parts, 0) -- some unique id, doesn't seem to matter
150 table.insert(parts, UnitLevel("player")) 153 table.insert(parts, UnitLevel("player"))
151 table.insert(parts, 0) -- unknown 154
152 table.insert(parts, 0) -- unknown 155 local specId = GetSpecializationInfo(GetSpecialization())
156 table.insert(parts, specId)
157
158 -- this indicates what kind of modifier appears after the bonus IDs
159 if itemObj.upgradeId and itemObj.upgradeId ~= 0 then
160 table.insert(parts, 4)
161 elseif itemObj.level and itemObj.level ~= 0 then
162 table.insert(parts, 512)
163 else
164 table.insert(parts, 0)
165 end
166
153 table.insert(parts, 0) -- difficulty id, doesn't matter 167 table.insert(parts, 0) -- difficulty id, doesn't matter
154 168
155 if itemObj.bonusIds then 169 if itemObj.bonusIds then
156 table.insert(parts, #itemObj.bonusIds) 170 table.insert(parts, #itemObj.bonusIds)
157 for i,v in ipairs(itemObj.bonusIds) do 171 for i,v in ipairs(itemObj.bonusIds) do
159 end 173 end
160 else 174 else
161 table.insert(parts, 0) -- no bonus ids 175 table.insert(parts, 0) -- no bonus ids
162 end 176 end
163 177
164 -- upgrade id is tacked onto the end now it seems 178 -- upgrade id or level comes after bonuses
165 if (not itemObj.bonusIds or #itemObj.bonusIds == 0) and itemObj.upgradeId and itemObj.upgradeId ~= 0 then 179 if itemObj.upgradeId and itemObj.upgradeId ~= 0 then
166 table.insert(parts, itemObj.upgradeId) 180 table.insert(parts, itemObj.upgradeId)
167 end 181 elseif itemObj.level and itemObj.level ~= 0 then
182 table.insert(parts, itemObj.level)
183 else
184 table.insert(parts, 0)
185 end
186
187 -- technically relic stuff comes after this... but we ignore it for now, too much of a pain
188 table.insert(parts, 0)
189 table.insert(parts, 0)
190 table.insert(parts, 0)
168 191
169 return table.concat(parts, ":") 192 return table.concat(parts, ":")
170 end 193 end
171 194
172 -- a unique ID useful for determining if a player has an item equipped or not
173 function Amr.GetItemUniqueId(item, noUpgrade)
174 if item == nil then return "" end
175 local ret = item.id .. ""
176 if item.bonusIds then
177 for i = 1, #item.bonusIds do
178 ret = ret .. "b" .. item.bonusIds[i]
179 end
180 end
181 if item.suffixId ~= 0 then
182 ret = ret .. "s" .. item.suffixId
183 end
184 if not noUpgrade and item.upgradeId ~= 0 then
185 ret = ret .. "u" .. item.upgradeId
186 end
187 return ret
188 end
189 195
190 -- the server event for getting item info does not specify which item it just fetched... have to track manually 196 -- the server event for getting item info does not specify which item it just fetched... have to track manually
191 local _pendingItemIds = {} 197 local _pendingItemIds = {}
192 198
193 -- helper for getting item information, which is not always guaranteed to be loaded into memory 199 -- helper for getting item information, which is not always guaranteed to be loaded into memory