comparison Modules/PaperDoll.lua @ 66:6ccacc927ef6

- paperdoll scan timing changed to PLAYER_ENTERING_WORLD and PLAYER_EQUIPMENT_CHANGED
author Nenue
date Fri, 19 Aug 2016 09:28:38 -0400
parents 4fe16cb3f5d6
children 6f8661094643
comparison
equal deleted inserted replaced
65:4fe16cb3f5d6 66:6ccacc927ef6
138 frame.label:ClearAllPoints() 138 frame.label:ClearAllPoints()
139 frame.label:SetPoint(slot_anchors[slot], frame, slot_anchors[slot]) 139 frame.label:SetPoint(slot_anchors[slot], frame, slot_anchors[slot])
140 140
141 tinsert(pendingSlots, frame) 141 tinsert(pendingSlots, frame)
142 end 142 end
143
144 plugin.ticker()
143 end 145 end
144 146
145 147
146 plugin.ticker = function() 148 plugin.ticker = function()
147 if (not ticker) and #pendingSlots >= 1 then 149 if (not ticker) and #pendingSlots >= 1 then
158 if vnslot[slot] then 160 if vnslot[slot] then
159 UpdateVeneer(vnslot[slot]:GetParent(), vnslot[slot]) 161 UpdateVeneer(vnslot[slot]:GetParent(), vnslot[slot])
160 plugin.ticker() 162 plugin.ticker()
161 end 163 end
162 164
165 elseif event == 'PLAYER_ENTERING_WORLD' then
166 UpdateAll()
167
163 end 168 end
164 169
165 end 170 end
171
166 plugin:SetScript('OnEvent', plugin.event) 172 plugin:SetScript('OnEvent', plugin.event)
167 plugin:RegisterEvent('PLAYER_EQUIPMENT_CHANGED') 173 plugin:RegisterEvent('PLAYER_EQUIPMENT_CHANGED')
174 plugin:RegisterEvent('PLAYER_ENTERING_WORLD')
168 175
169 hooksecurefunc("ToggleCharacter", function() 176
170 if PaperDollFrame:IsVisible() then
171 UpdateAll()
172 end
173 end)
174 hooksecurefunc("PaperDollItemSlotButton_Update", PaperDollItemSlotButton_Update) 177 hooksecurefunc("PaperDollItemSlotButton_Update", PaperDollItemSlotButton_Update)
175 178
176 hooksecurefunc(GameTooltip, "SetInventoryItem", function(self, unit, slot) 179 hooksecurefunc(GameTooltip, "SetInventoryItem", function(self, unit, slot)
177 if self:GetOwner() == plugin then 180 if self:GetOwner() == plugin then
178 if unit == 'player' and vnslot[slot] then 181 if unit == 'player' and vnslot[slot] then
179 182
180 local text = GameTooltipTextLeft3:GetText():match('Item Level (%d+)') 183 local text
181 if not text then 184 for i = 1, 3 do
182 text = GameTooltipTextLeft2:GetText():match('Item Level (%d+)') 185 text = _G['GameTooltipTextLeft'..i]:GetText()
186 text = text:match('Item Level (%d+)')
187 if text then
188 break
189 end
183 end 190 end
184 vnslot[slot].label:SetText(text or '???') 191 vnslot[slot].label:SetText(text or '???')
185 end 192 end
186 end 193 end
187 end) 194 end)