diff Modules/PaperDoll.lua @ 71:6f8661094643

- obtains veneer objects through a common function and track them as a unified table.
author Nenue
date Tue, 23 Aug 2016 06:35:08 -0400
parents 6ccacc927ef6
children d80db9a9b7e4
line wrap: on
line diff
--- a/Modules/PaperDoll.lua	Mon Aug 22 20:38:43 2016 -0400
+++ b/Modules/PaperDoll.lua	Tue Aug 23 06:35:08 2016 -0400
@@ -54,27 +54,62 @@
 local pendingSlots = {}
 
 
-
+local jewel = {}
 local UpdateVeneer = function(itemslot, frame)
   local slot = itemslot:GetID()
   if itemslot.hasItem then
     frame.link = GetInventoryItemLink('player', slot)
-    --print(frame.link)
+
     local name, link, something, ilevel = GetItemInfo(frame.link)
     frame.label:SetText(ilevel)
     -- todo: test GetExtendedItemInfo()
 
-    GameTooltip:SetOwner(plugin)
-    GameTooltip:SetInventoryItem('player', slot)
-    GameTooltip:Hide()
+    local item = {strsplit(":", link)}
+    local _, itemId, enchantId, jewelId1, jewelId2, jewelId3, jewelId4, suffixId,
+    uniqueId, linkLevel, specializationID, instanceDifficultyId, numBonusIds, bonusId1, bonusId2, upgradeValue
 
-    for i = 1, 3 do
-      local gname = 'gem'..i
-      if frame[gname] then
-        frame.gemslot[i] = frame.gemslot[i] or frame:CreateTexture(nil, 'ARTWORK')
-        print(frame[gname])
+    specializationID, instanceDifficultyId, numBonusIds = item[11], item[12], item[13]
+    jewel[1], jewel[2], jewel[3], jewel[4] = item[4], item[5], item[6], item[7]
+    --vn:print(jewelId1, jewelId2, jewelId3, jewelId4)
+    for i = 1, 4 do
+      local gemslot = frame.gemslot[i]
+      if tonumber(jewel[i]) ~= nil then
+        if not gemslot then
+          gemslot = frame:CreateTexture(itemslot:GetName()..'Gem'..i, 'ARTWORK')
+          gemslot:SetSize(16,16)
+          local posx = 3 + (i-1)*16
+          if slot_anchors[slot]:match('RIGHT') then
+            posx = posx * -1
+          end
+          gemslot:SetPoint(slot_anchors[slot], frame.label, slot_relative[slot], posx, 0)
+          frame.gemslot[i] = gemslot
+        end
+        gemslot:SetTexture(GetItemIcon(jewel[i]))
+        gemslot:Show()
+      else
+        if gemslot then
+          gemslot:Hide()
+        end
+
       end
     end
+--[[
+    print(link)
+    local difftag = '?'
+    if tonumber(numBonusIds) ~= nil then
+      local name, groupType, isHeroic, isChallengeMode, displayHeroic, displayMythic, toggleDifficultyID = GetDifficultyInfo(numBonusIds)
+      difftag = (name or '??') .. (isHeroic and ' (Heroic)' or '')
+    end
+
+    print(instanceDifficultyId, '|cFF00FFFF',  difftag, numBonusIds)
+    --if tonumber(numBonusIds) ~= nil then
+      for i = 8, #item do
+        print(i..'-', item[i])
+      end
+    --end
+
+--]]
+
     frame:Show()
   else
     frame:Hide()
@@ -105,6 +140,7 @@
 
 end
 
+
 -- PaperDollFrame is separate from InspectUI handlers
 local PaperDollItemSlotButton_Update = function(self)
   local name = self:GetName()
@@ -132,7 +168,7 @@
       y = 4
     end
 
-
+    frame.gemslot = {}
     frame:SetPoint(anchor, self, relative, x, y)
     frame:SetSize(200,24)
     frame.label:ClearAllPoints()
@@ -175,21 +211,3 @@
 
 
 hooksecurefunc("PaperDollItemSlotButton_Update", PaperDollItemSlotButton_Update)
-
-hooksecurefunc(GameTooltip, "SetInventoryItem", function(self, unit, slot)
-  if self:GetOwner() == plugin then
-  if unit == 'player' and vnslot[slot] then
-
-    local text
-    for i = 1, 3 do
-      text = _G['GameTooltipTextLeft'..i]:GetText()
-      text = text:match('Item Level (%d+)')
-      if text then
-        break
-      end
-    end
-    vnslot[slot].label:SetText(text or '???')
-  end
-  end
-end)
-