diff 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
line wrap: on
line diff
--- a/Modules/PaperDoll.lua	Thu Jan 26 20:28:35 2017 -0500
+++ b/Modules/PaperDoll.lua	Sun Jan 29 09:54:14 2017 -0500
@@ -162,12 +162,6 @@
 function VeneerPaperDollMixin:OnEvent(event, arg)
   print(event, arg)
   if event == 'ADDON_LOADED' then
-    if IsLoggedIn() and not self.initialized then
-      self:Setup()
-      self.initialized = true
-    end
-
-
     if arg == 'Blizzard_InspectUI' then
       self:SetupInspectFrame()
     end
@@ -176,24 +170,17 @@
       self:MarkForUpdate()
     end
   elseif event == 'ARTIFACT_UPDATE' then
-
     if artifactSlot then
       print('just udpate artifact slot')
       artifactSlot:Update(true)
     end
-
-
   else
     if (event == 'PLAYER_SPECIALIZATION_CHANGED' or event == 'UNIT_INVENTORY_CHANGED') then
       if arg ~= 'player' then
         return
       end
-    elseif event == 'INSPECT_READY' then
-
     end
-
     self:MarkForUpdate()
-
   end
 end
 
@@ -276,42 +263,47 @@
     for i = 1, numRelics do
       local lockedReason, relicName, relicIcon, relicLink = C_ArtifactUI.GetRelicInfo(i);
       local relicType = C_ArtifactUI.GetRelicSlotType(i);
-      if relicIcon then
+      print(relicType)
+      if relicType then
+        if relicLink then
         tooltip:SetHyperlink(relicLink)
-        print(tooltip:NumLines())
+          print(tooltip:NumLines())
 
-        local line1 = _G['VeneerPaperDollTooltipTextLeft2']
-        local line2 = _G['VeneerPaperDollTooltipTextLeft3']
-        local text1 = line1 and line1:GetText()
-        local text2 = line2 and line2:GetText()
-        if text1 or text2 then
-          self.SocketText[i] = text1:match('Item Level (%d+)') or text2:match('Item Level (%d+)')
+          local line1 = _G['VeneerPaperDollTooltipTextLeft2']
+          local line2 = _G['VeneerPaperDollTooltipTextLeft3']
+          local text1 = line1 and line1:GetText()
+          local text2 = line2 and line2:GetText()
+          if text1 or text2 then
+            self.SocketText[i] = text1:match('Item Level (%d+)') or text2:match('Item Level (%d+)')
+          end
         end
 
-        self.SocketInfo[i] = relicIcon
+        self.SocketInfo[i] = relicIcon or 0
         self.SocketType[i] = relicType
         self.SocketLink[i] = relicLink
         print('storing', i, self.SocketInfo[i], self.SocketText[i], self.SocketType[i], self.SocketLink[i])
       else
 
+
         self.SocketInfo[i] = "Interface\\CharacterFrame\\TempPortraitAlphaMask"
-        self.SocketType[i] = relicType
+        self.SocketType[i] = nil
         self.SocketLink[i] = nil
       end
 
       relicCache[i] = {self.SocketInfo[i], self.SocketText[i], self.SocketType[i], self.SocketLink[i]}
     end
-  end
+  else
 
-  for i = 1, 3 do
-    if relicCache[i] then
-      local relicIcon, relicLevel, relicType, relicLink = unpack(relicCache[i])
+    for i = 1, 3 do
+      if relicCache[i] then
+        local relicIcon, relicText, relicType, relicLink = unpack(relicCache[i])
 
-      print('loading', i, relicIcon, relicLevel, relicType, relicLink)
-      self.SocketInfo[i] = relicIcon
-      self.SocketText[i] = relicLevel
-      self.SocketType[i] = relicType
-      self.SocketLink[i] = relicLink
+        print('loading', i, relicIcon, relicText, relicType, relicLink)
+        self.SocketInfo[i] = relicIcon
+        self.SocketText[i] = relicText
+        self.SocketType[i] = relicType
+        self.SocketLink[i] = relicLink
+      end
     end
   end
 end
@@ -393,7 +385,8 @@
       label:SetFontObject(VeneerNumberFont)
       label:SetText(self.SocketText[index])
 
-      if self.checkRelic then
+      if self.checkRelic and self.SocketType[index] then
+        print(self.SocketType[index])
         local relicAtlasName = ("Relic-%s-Slot"):format(self.SocketType[index]);
         self.Sockets.SocketBg = self.Sockets.SocketBg or {}
         self.Sockets.SocketBg[index] = self.Sockets.SocketBg[index] or self.Sockets:CreateTexture()
@@ -401,6 +394,9 @@
         self.Sockets.SocketBg[index]:SetPoint('TOPRIGHT', icon, 'TOPRIGHT', 12, 12)
         self.Sockets.SocketBg[index]:SetPoint('BOTTOMLEFT', icon, 'BOTTOMLEFT', -12,-12)
         --print('', self.SocketType[index], relicAtlasName)
+        if self.SocketInfo[index] == 0 then
+          icon:SetAtlas("Relic-SlotBG")
+        end
 
         socketsHeight = self.Sockets.SocketBg[index]:GetHeight()
         print(socketsWidth, socketsHeight)