Mercurial > wow > buffalo2
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 70:1b0d7bcd252e | 71:6f8661094643 |
|---|---|
| 52 local ticker | 52 local ticker |
| 53 local vnslot = {} | 53 local vnslot = {} |
| 54 local pendingSlots = {} | 54 local pendingSlots = {} |
| 55 | 55 |
| 56 | 56 |
| 57 | 57 local jewel = {} |
| 58 local UpdateVeneer = function(itemslot, frame) | 58 local UpdateVeneer = function(itemslot, frame) |
| 59 local slot = itemslot:GetID() | 59 local slot = itemslot:GetID() |
| 60 if itemslot.hasItem then | 60 if itemslot.hasItem then |
| 61 frame.link = GetInventoryItemLink('player', slot) | 61 frame.link = GetInventoryItemLink('player', slot) |
| 62 --print(frame.link) | 62 |
| 63 local name, link, something, ilevel = GetItemInfo(frame.link) | 63 local name, link, something, ilevel = GetItemInfo(frame.link) |
| 64 frame.label:SetText(ilevel) | 64 frame.label:SetText(ilevel) |
| 65 -- todo: test GetExtendedItemInfo() | 65 -- todo: test GetExtendedItemInfo() |
| 66 | 66 |
| 67 GameTooltip:SetOwner(plugin) | 67 local item = {strsplit(":", link)} |
| 68 GameTooltip:SetInventoryItem('player', slot) | 68 local _, itemId, enchantId, jewelId1, jewelId2, jewelId3, jewelId4, suffixId, |
| 69 GameTooltip:Hide() | 69 uniqueId, linkLevel, specializationID, instanceDifficultyId, numBonusIds, bonusId1, bonusId2, upgradeValue |
| 70 | 70 |
| 71 for i = 1, 3 do | 71 specializationID, instanceDifficultyId, numBonusIds = item[11], item[12], item[13] |
| 72 local gname = 'gem'..i | 72 jewel[1], jewel[2], jewel[3], jewel[4] = item[4], item[5], item[6], item[7] |
| 73 if frame[gname] then | 73 --vn:print(jewelId1, jewelId2, jewelId3, jewelId4) |
| 74 frame.gemslot[i] = frame.gemslot[i] or frame:CreateTexture(nil, 'ARTWORK') | 74 for i = 1, 4 do |
| 75 print(frame[gname]) | 75 local gemslot = frame.gemslot[i] |
| 76 if tonumber(jewel[i]) ~= nil then | |
| 77 if not gemslot then | |
| 78 gemslot = frame:CreateTexture(itemslot:GetName()..'Gem'..i, 'ARTWORK') | |
| 79 gemslot:SetSize(16,16) | |
| 80 local posx = 3 + (i-1)*16 | |
| 81 if slot_anchors[slot]:match('RIGHT') then | |
| 82 posx = posx * -1 | |
| 83 end | |
| 84 gemslot:SetPoint(slot_anchors[slot], frame.label, slot_relative[slot], posx, 0) | |
| 85 frame.gemslot[i] = gemslot | |
| 86 end | |
| 87 gemslot:SetTexture(GetItemIcon(jewel[i])) | |
| 88 gemslot:Show() | |
| 89 else | |
| 90 if gemslot then | |
| 91 gemslot:Hide() | |
| 92 end | |
| 93 | |
| 76 end | 94 end |
| 77 end | 95 end |
| 96 --[[ | |
| 97 print(link) | |
| 98 local difftag = '?' | |
| 99 if tonumber(numBonusIds) ~= nil then | |
| 100 local name, groupType, isHeroic, isChallengeMode, displayHeroic, displayMythic, toggleDifficultyID = GetDifficultyInfo(numBonusIds) | |
| 101 difftag = (name or '??') .. (isHeroic and ' (Heroic)' or '') | |
| 102 end | |
| 103 | |
| 104 print(instanceDifficultyId, '|cFF00FFFF', difftag, numBonusIds) | |
| 105 --if tonumber(numBonusIds) ~= nil then | |
| 106 for i = 8, #item do | |
| 107 print(i..'-', item[i]) | |
| 108 end | |
| 109 --end | |
| 110 | |
| 111 --]] | |
| 112 | |
| 78 frame:Show() | 113 frame:Show() |
| 79 else | 114 else |
| 80 frame:Hide() | 115 frame:Hide() |
| 81 end | 116 end |
| 82 end | 117 end |
| 102 ticker:Cancel() | 137 ticker:Cancel() |
| 103 ticker = nil | 138 ticker = nil |
| 104 end | 139 end |
| 105 | 140 |
| 106 end | 141 end |
| 142 | |
| 107 | 143 |
| 108 -- PaperDollFrame is separate from InspectUI handlers | 144 -- PaperDollFrame is separate from InspectUI handlers |
| 109 local PaperDollItemSlotButton_Update = function(self) | 145 local PaperDollItemSlotButton_Update = function(self) |
| 110 local name = self:GetName() | 146 local name = self:GetName() |
| 111 local slot = self:GetID() | 147 local slot = self:GetID() |
| 130 end | 166 end |
| 131 if anchor:match('BOTTOM') then | 167 if anchor:match('BOTTOM') then |
| 132 y = 4 | 168 y = 4 |
| 133 end | 169 end |
| 134 | 170 |
| 135 | 171 frame.gemslot = {} |
| 136 frame:SetPoint(anchor, self, relative, x, y) | 172 frame:SetPoint(anchor, self, relative, x, y) |
| 137 frame:SetSize(200,24) | 173 frame:SetSize(200,24) |
| 138 frame.label:ClearAllPoints() | 174 frame.label:ClearAllPoints() |
| 139 frame.label:SetPoint(slot_anchors[slot], frame, slot_anchors[slot]) | 175 frame.label:SetPoint(slot_anchors[slot], frame, slot_anchors[slot]) |
| 140 | 176 |
| 173 plugin:RegisterEvent('PLAYER_EQUIPMENT_CHANGED') | 209 plugin:RegisterEvent('PLAYER_EQUIPMENT_CHANGED') |
| 174 plugin:RegisterEvent('PLAYER_ENTERING_WORLD') | 210 plugin:RegisterEvent('PLAYER_ENTERING_WORLD') |
| 175 | 211 |
| 176 | 212 |
| 177 hooksecurefunc("PaperDollItemSlotButton_Update", PaperDollItemSlotButton_Update) | 213 hooksecurefunc("PaperDollItemSlotButton_Update", PaperDollItemSlotButton_Update) |
| 178 | |
| 179 hooksecurefunc(GameTooltip, "SetInventoryItem", function(self, unit, slot) | |
| 180 if self:GetOwner() == plugin then | |
| 181 if unit == 'player' and vnslot[slot] then | |
| 182 | |
| 183 local text | |
| 184 for i = 1, 3 do | |
| 185 text = _G['GameTooltipTextLeft'..i]:GetText() | |
| 186 text = text:match('Item Level (%d+)') | |
| 187 if text then | |
| 188 break | |
| 189 end | |
| 190 end | |
| 191 vnslot[slot].label:SetText(text or '???') | |
| 192 end | |
| 193 end | |
| 194 end) | |
| 195 |
