comparison Modules/PaperDoll.lua @ 105:3992b41c637e

- Fixed a number of relic data retrieval issues
author Nenue
date Sun, 29 Jan 2017 09:54:14 -0500
parents 1e511e9aaca5
children ddfe19d70a34
comparison
equal deleted inserted replaced
104:8599826a68b7 105:3992b41c637e
160 160
161 161
162 function VeneerPaperDollMixin:OnEvent(event, arg) 162 function VeneerPaperDollMixin:OnEvent(event, arg)
163 print(event, arg) 163 print(event, arg)
164 if event == 'ADDON_LOADED' then 164 if event == 'ADDON_LOADED' then
165 if IsLoggedIn() and not self.initialized then
166 self:Setup()
167 self.initialized = true
168 end
169
170
171 if arg == 'Blizzard_InspectUI' then 165 if arg == 'Blizzard_InspectUI' then
172 self:SetupInspectFrame() 166 self:SetupInspectFrame()
173 end 167 end
174 if arg == 'Blizzard_ArtifactUI' then 168 if arg == 'Blizzard_ArtifactUI' then
175 self:SetupArtifactUI() 169 self:SetupArtifactUI()
176 self:MarkForUpdate() 170 self:MarkForUpdate()
177 end 171 end
178 elseif event == 'ARTIFACT_UPDATE' then 172 elseif event == 'ARTIFACT_UPDATE' then
179
180 if artifactSlot then 173 if artifactSlot then
181 print('just udpate artifact slot') 174 print('just udpate artifact slot')
182 artifactSlot:Update(true) 175 artifactSlot:Update(true)
183 end 176 end
184
185
186 else 177 else
187 if (event == 'PLAYER_SPECIALIZATION_CHANGED' or event == 'UNIT_INVENTORY_CHANGED') then 178 if (event == 'PLAYER_SPECIALIZATION_CHANGED' or event == 'UNIT_INVENTORY_CHANGED') then
188 if arg ~= 'player' then 179 if arg ~= 'player' then
189 return 180 return
190 end 181 end
191 elseif event == 'INSPECT_READY' then 182 end
192
193 end
194
195 self:MarkForUpdate() 183 self:MarkForUpdate()
196
197 end 184 end
198 end 185 end
199 186
200 187
201 VeneerPaperDollSlotMixin = {} 188 VeneerPaperDollSlotMixin = {}
274 if numRelics and isEquipped then 261 if numRelics and isEquipped then
275 print('Relic Query:', itemID, numRelics) 262 print('Relic Query:', itemID, numRelics)
276 for i = 1, numRelics do 263 for i = 1, numRelics do
277 local lockedReason, relicName, relicIcon, relicLink = C_ArtifactUI.GetRelicInfo(i); 264 local lockedReason, relicName, relicIcon, relicLink = C_ArtifactUI.GetRelicInfo(i);
278 local relicType = C_ArtifactUI.GetRelicSlotType(i); 265 local relicType = C_ArtifactUI.GetRelicSlotType(i);
279 if relicIcon then 266 print(relicType)
267 if relicType then
268 if relicLink then
280 tooltip:SetHyperlink(relicLink) 269 tooltip:SetHyperlink(relicLink)
281 print(tooltip:NumLines()) 270 print(tooltip:NumLines())
282 271
283 local line1 = _G['VeneerPaperDollTooltipTextLeft2'] 272 local line1 = _G['VeneerPaperDollTooltipTextLeft2']
284 local line2 = _G['VeneerPaperDollTooltipTextLeft3'] 273 local line2 = _G['VeneerPaperDollTooltipTextLeft3']
285 local text1 = line1 and line1:GetText() 274 local text1 = line1 and line1:GetText()
286 local text2 = line2 and line2:GetText() 275 local text2 = line2 and line2:GetText()
287 if text1 or text2 then 276 if text1 or text2 then
288 self.SocketText[i] = text1:match('Item Level (%d+)') or text2:match('Item Level (%d+)') 277 self.SocketText[i] = text1:match('Item Level (%d+)') or text2:match('Item Level (%d+)')
278 end
289 end 279 end
290 280
291 self.SocketInfo[i] = relicIcon 281 self.SocketInfo[i] = relicIcon or 0
292 self.SocketType[i] = relicType 282 self.SocketType[i] = relicType
293 self.SocketLink[i] = relicLink 283 self.SocketLink[i] = relicLink
294 print('storing', i, self.SocketInfo[i], self.SocketText[i], self.SocketType[i], self.SocketLink[i]) 284 print('storing', i, self.SocketInfo[i], self.SocketText[i], self.SocketType[i], self.SocketLink[i])
295 else 285 else
296 286
287
297 self.SocketInfo[i] = "Interface\\CharacterFrame\\TempPortraitAlphaMask" 288 self.SocketInfo[i] = "Interface\\CharacterFrame\\TempPortraitAlphaMask"
289 self.SocketType[i] = nil
290 self.SocketLink[i] = nil
291 end
292
293 relicCache[i] = {self.SocketInfo[i], self.SocketText[i], self.SocketType[i], self.SocketLink[i]}
294 end
295 else
296
297 for i = 1, 3 do
298 if relicCache[i] then
299 local relicIcon, relicText, relicType, relicLink = unpack(relicCache[i])
300
301 print('loading', i, relicIcon, relicText, relicType, relicLink)
302 self.SocketInfo[i] = relicIcon
303 self.SocketText[i] = relicText
298 self.SocketType[i] = relicType 304 self.SocketType[i] = relicType
299 self.SocketLink[i] = nil 305 self.SocketLink[i] = relicLink
300 end 306 end
301
302 relicCache[i] = {self.SocketInfo[i], self.SocketText[i], self.SocketType[i], self.SocketLink[i]}
303 end
304 end
305
306 for i = 1, 3 do
307 if relicCache[i] then
308 local relicIcon, relicLevel, relicType, relicLink = unpack(relicCache[i])
309
310 print('loading', i, relicIcon, relicLevel, relicType, relicLink)
311 self.SocketInfo[i] = relicIcon
312 self.SocketText[i] = relicLevel
313 self.SocketType[i] = relicType
314 self.SocketLink[i] = relicLink
315 end 307 end
316 end 308 end
317 end 309 end
318 310
319 function VeneerPaperDollSlotMixin:Update(forced) 311 function VeneerPaperDollSlotMixin:Update(forced)
391 label:ClearAllPoints() 383 label:ClearAllPoints()
392 label:SetPoint('BOTTOM', icon, 'TOP',0, 2) 384 label:SetPoint('BOTTOM', icon, 'TOP',0, 2)
393 label:SetFontObject(VeneerNumberFont) 385 label:SetFontObject(VeneerNumberFont)
394 label:SetText(self.SocketText[index]) 386 label:SetText(self.SocketText[index])
395 387
396 if self.checkRelic then 388 if self.checkRelic and self.SocketType[index] then
389 print(self.SocketType[index])
397 local relicAtlasName = ("Relic-%s-Slot"):format(self.SocketType[index]); 390 local relicAtlasName = ("Relic-%s-Slot"):format(self.SocketType[index]);
398 self.Sockets.SocketBg = self.Sockets.SocketBg or {} 391 self.Sockets.SocketBg = self.Sockets.SocketBg or {}
399 self.Sockets.SocketBg[index] = self.Sockets.SocketBg[index] or self.Sockets:CreateTexture() 392 self.Sockets.SocketBg[index] = self.Sockets.SocketBg[index] or self.Sockets:CreateTexture()
400 self.Sockets.SocketBg[index]:SetAtlas(relicAtlasName) 393 self.Sockets.SocketBg[index]:SetAtlas(relicAtlasName)
401 self.Sockets.SocketBg[index]:SetPoint('TOPRIGHT', icon, 'TOPRIGHT', 12, 12) 394 self.Sockets.SocketBg[index]:SetPoint('TOPRIGHT', icon, 'TOPRIGHT', 12, 12)
402 self.Sockets.SocketBg[index]:SetPoint('BOTTOMLEFT', icon, 'BOTTOMLEFT', -12,-12) 395 self.Sockets.SocketBg[index]:SetPoint('BOTTOMLEFT', icon, 'BOTTOMLEFT', -12,-12)
403 --print('', self.SocketType[index], relicAtlasName) 396 --print('', self.SocketType[index], relicAtlasName)
397 if self.SocketInfo[index] == 0 then
398 icon:SetAtlas("Relic-SlotBG")
399 end
404 400
405 socketsHeight = self.Sockets.SocketBg[index]:GetHeight() 401 socketsHeight = self.Sockets.SocketBg[index]:GetHeight()
406 print(socketsWidth, socketsHeight) 402 print(socketsWidth, socketsHeight)
407 end 403 end
408 404