comparison Constants.lua @ 124:e31b02b24488

Updated for 8.0 pre-patch and BfA.
author yellowfive
date Tue, 17 Jul 2018 09:57:39 -0700
parents 5cb881417bbf
children d9a059484b22
comparison
equal deleted inserted replaced
123:7a6364917f86 124:e31b02b24488
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 = 36 5 Amr.MIN_IMPORT_VERSION = 58
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
8 -- last update to version 36 for Legion pre-patch 8 Amr.MIN_ADDON_VERSION = 58
9 Amr.MIN_ADDON_VERSION = 44
10 9
11 -- import some constants from the serializer for convenience 10 -- import some constants from the serializer for convenience
12 Amr.ChatPrefix = Amr.Serializer.ChatPrefix 11 Amr.ChatPrefix = Amr.Serializer.ChatPrefix
13 Amr.RegionNames = Amr.Serializer.RegionNames 12 Amr.RegionNames = Amr.Serializer.RegionNames
14 Amr.SlotIds = Amr.Serializer.SlotIds 13 Amr.SlotIds = Amr.Serializer.SlotIds
20 Amr.InstanceIds = Amr.Serializer.InstanceIds 19 Amr.InstanceIds = Amr.Serializer.InstanceIds
21 Amr.SupportedInstanceIds = Amr.Serializer.SupportedInstanceIds 20 Amr.SupportedInstanceIds = Amr.Serializer.SupportedInstanceIds
22 Amr.ParseItemLink = Amr.Serializer.ParseItemLink 21 Amr.ParseItemLink = Amr.Serializer.ParseItemLink
23 Amr.IsSupportedInstanceId = Amr.Serializer.IsSupportedInstanceId 22 Amr.IsSupportedInstanceId = Amr.Serializer.IsSupportedInstanceId
24 Amr.IsSupportedInstance = Amr.Serializer.IsSupportedInstance 23 Amr.IsSupportedInstance = Amr.Serializer.IsSupportedInstance
25 Amr.SetTokenIds = Amr.Serializer.SetTokenIds
26 Amr.GetItemTooltip = Amr.Serializer.GetItemTooltip 24 Amr.GetItemTooltip = Amr.Serializer.GetItemTooltip
27 Amr.GetItemLevel = Amr.Serializer.GetItemLevel 25 Amr.GetItemLevel = Amr.Serializer.GetItemLevel
28 Amr.GetItemUniqueId = Amr.Serializer.GetItemUniqueId 26 Amr.GetItemUniqueId = Amr.Serializer.GetItemUniqueId
29 Amr.ArtifactIdToSpecNumber = Amr.Serializer.ArtifactIdToSpecNumber
30 27
31 -- map of slot ID to display text 28 -- map of slot ID to display text
32 Amr.SlotDisplayText = { 29 Amr.SlotDisplayText = {
33 [1] = _G["HEADSLOT"], 30 [1] = _G["HEADSLOT"],
34 [2] = _G["NECKSLOT"], 31 [2] = _G["NECKSLOT"],
127 124
128 ------------------------------------------------------------------------------------------ 125 ------------------------------------------------------------------------------------------
129 -- Item Methods 126 -- Item Methods
130 ------------------------------------------------------------------------------------------ 127 ------------------------------------------------------------------------------------------
131 128
132 -- item link format: |cffa335ee|Hitem:itemID:enchant:gem1:gem2:gem3:gem4:suffixID:uniqueID:level:upgradeId:instanceDifficultyID:numBonusIDs:bonusID1:bonusID2...|h[item name]|h|r 129 -- 1 2 3 4 5 6 7 8 9 10 11 12
133 130 -- itemId:ench:gem1 :gem2 :gem3 :gem4:suf:uid:lvl:spec:flags :instdiffid:numbonusIDs:bonusIDs1...n :varies:?:relic bonus ids
131 --|cffe6cc80|Hitem:128866: :152046:147100:152025: : : :110:66 :16777472:9 :4 :736:1494:1490:1495:709 :1:3:3610:1472:3528:3:3562:1483:3528:3:3610:1477:3336|h[Truthguard]|h|r
132 --
134 function Amr.CreateItemLink(itemObj) 133 function Amr.CreateItemLink(itemObj)
135 134
136 if itemObj == nil or itemObj.id == nil or itemObj.id == 0 then return nil end 135 if itemObj == nil or itemObj.id == nil or itemObj.id == 0 then return nil end
137 136
138 local parts = {} 137 local parts = {}
159 -- this indicates what kind of modifier appears after the bonus IDs 158 -- this indicates what kind of modifier appears after the bonus IDs
160 if itemObj.upgradeId and itemObj.upgradeId ~= 0 then 159 if itemObj.upgradeId and itemObj.upgradeId ~= 0 then
161 table.insert(parts, 4) 160 table.insert(parts, 4)
162 elseif itemObj.level and itemObj.level ~= 0 then 161 elseif itemObj.level and itemObj.level ~= 0 then
163 table.insert(parts, 512) 162 table.insert(parts, 512)
164 elseif itemObj.relicBonusIds then
165 table.insert(parts, 256)
166 else 163 else
167 table.insert(parts, 0) 164 table.insert(parts, 0)
168 end 165 end
169 166
170 table.insert(parts, 0) -- difficulty id, doesn't matter 167 table.insert(parts, 0) -- difficulty id, doesn't matter
184 elseif itemObj.level and itemObj.level ~= 0 then 181 elseif itemObj.level and itemObj.level ~= 0 then
185 table.insert(parts, itemObj.level) 182 table.insert(parts, itemObj.level)
186 else 183 else
187 table.insert(parts, 0) 184 table.insert(parts, 0)
188 end 185 end
189 186
190 -- sometimes we provide relic bonus IDs 187 -- we don't bother with relic bonus ids anymore when generating links
191 if itemObj.relicBonusIds then 188 table.insert(parts, 0)
192 for i = 1,3 do 189 table.insert(parts, 0)
193 local bonusList = itemObj.relicBonusIds[i] 190 table.insert(parts, 0)
194 if bonusList and #bonusList > 0 then
195 table.insert(parts, #bonusList)
196 for bi, bv in ipairs(bonusList) do
197 table.insert(parts, bv)
198 end
199 else
200 table.insert(parts, 0)
201 end
202 end
203 else
204 table.insert(parts, 0)
205 table.insert(parts, 0)
206 table.insert(parts, 0)
207 end
208 191
209 return table.concat(parts, ":") 192 return table.concat(parts, ":")
210 end 193 end
211 194
212 195