Mercurial > wow > buffalo2
diff Modules/PaperDoll.lua @ 96:bb38bc0e787f
- fix weapon slot anchors for paperdoll
author | Nenue |
---|---|
date | Tue, 03 Jan 2017 14:06:41 -0500 |
parents | caded2668701 |
children | 1e511e9aaca5 |
line wrap: on
line diff
--- a/Modules/PaperDoll.lua Sun Jan 01 19:56:35 2017 -0500 +++ b/Modules/PaperDoll.lua Tue Jan 03 14:06:41 2017 -0500 @@ -4,7 +4,7 @@ -- %file-revision% -- Displays the item level and modifications of character sheet equipment, including artifact power local print = DEVIAN_WORKSPACE and function(...) print('PaperDoll', ...) end or nop - +local artifactSlot local slot_overlays = {} VeneerPaperDollMixin = { anchorFrame = 'CharacterFrame', @@ -75,7 +75,6 @@ self:RegisterEvent('INSPECT_READY') end function VeneerPaperDollMixin:SetupArtifactUI() - self:RegisterEvent('ARTIFACT_UPDATE') end function VeneerPaperDollMixin:Setup() @@ -86,6 +85,7 @@ self:RegisterEvent('UNIT_INVENTORY_CHANGED') self:RegisterEvent('PLAYER_EQUIPMENT_CHANGED') self:RegisterEvent('PLAYER_SPECIALIZATION_CHANGED') + self:RegisterEvent('ARTIFACT_UPDATE') self:MarkForUpdate() end @@ -112,6 +112,7 @@ slot_overlays[panel] = slot_overlays[panel] or {} local overlay = slot_overlays[panel][slot] if not overlay then + print('creating slot overlay', slot) overlay = CreateFrame('Frame', 'VeneerPaperDollSlot' .. unit .. slot, frame, 'VeneerPaperDollSlotInfoTemplate') overlay:SetID(slot) slot_overlays[panel][slot] = overlay @@ -135,6 +136,10 @@ overlay.ItemLevel:SetFontObject(VeneerNumberFontLarge) overlay.ItemLevel:ClearAllPoints() overlay.ItemLevel:SetPoint('BOTTOM', overlay.Sockets, 'TOP', 0, 4) + if unit == 'player' then + artifactSlot = overlay + end + end print(overlay.Sockets:GetPoint(1)) @@ -173,7 +178,13 @@ self:MarkForUpdate() end elseif event == 'ARTIFACT_UPDATE' then - self:MarkForUpdate() + + 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 @@ -264,7 +275,6 @@ self.hasRelicSlots = true if numRelics and isEquipped then print('Relic Query:', itemID, numRelics) - self.checkRelic = nil for i = 1, numRelics do local lockedReason, relicName, relicIcon, relicLink = C_ArtifactUI.GetRelicInfo(i); local relicType = C_ArtifactUI.GetRelicSlotType(i); @@ -308,10 +318,7 @@ end end -local SocketIcon_Update = function(frame) -end - -function VeneerPaperDollSlotMixin:Update() +function VeneerPaperDollSlotMixin:Update(forced) local id = self:GetID() self.SocketInfo = self.SocketInfo or {} @@ -320,7 +327,10 @@ local tooltip = VeneerPaperDollTooltip tooltip:SetOwner(self, 'ANCHOR_NONE') - print('refresh', self.unit, id) + if forced then + print('refresh', self.unit, id) + end + tooltip:SetInventoryItem(self.unit or 'player', id) tooltip:Show() @@ -328,7 +338,7 @@ local numTextures = 0 local itemLevel local itemLevelLine - print('|cFFFFFF00Sockets scan:', numLines) + --print('|cFFFFFF00Sockets scan:', numLines) for i = 1, numLines do local line = _G['VeneerPaperDollTooltipTextLeft'..i] local text = line and line:GetText() @@ -343,7 +353,7 @@ local texture = _G['VeneerPaperDollTooltipTexture'..i] if texture and texture:IsShown() then numTextures = numTextures + 1 - print('picked up socket', numTextures, texture:GetTexture()) + --print('picked up socket', numTextures, texture:GetTexture()) self.SocketInfo[numTextures] = texture:GetTexture() end end @@ -357,7 +367,7 @@ local socketsHeight = 24 for index, icon in ipairs(self.Sockets.SocketIcon) do if self.SocketInfo[index] then - print('|cFF0088FFsocketInfo|r', index, self.SocketInfo[index]) + --print('|cFF0088FFsocketInfo|r', index, self.SocketInfo[index]) icon:ClearAllPoints() icon:SetTexture(self.SocketInfo[index]) @@ -377,6 +387,7 @@ end socketsWidth = socketsWidth + icon:GetWidth() end + print( '|cFFFF4400', icon:GetPoint(1)) local label = self.Sockets.SocketLabel[index] label:ClearAllPoints() @@ -391,9 +402,10 @@ self.Sockets.SocketBg[index]:SetAtlas(relicAtlasName) 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) + --print('', self.SocketType[index], relicAtlasName) socketsHeight = self.Sockets.SocketBg[index]:GetHeight() + print(socketsWidth, socketsHeight) end