changeset 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 f80ee484ac8a
files Modules/PaperDoll.lua
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Modules/PaperDoll.lua	Wed Aug 17 18:01:42 2016 -0400
+++ b/Modules/PaperDoll.lua	Fri Aug 19 09:28:38 2016 -0400
@@ -140,6 +140,8 @@
 
     tinsert(pendingSlots, frame)
   end
+
+  plugin.ticker()
 end
 
 
@@ -160,26 +162,31 @@
       plugin.ticker()
     end
 
+  elseif event == 'PLAYER_ENTERING_WORLD' then
+    UpdateAll()
+
   end
 
 end
+
 plugin:SetScript('OnEvent', plugin.event)
 plugin:RegisterEvent('PLAYER_EQUIPMENT_CHANGED')
+plugin:RegisterEvent('PLAYER_ENTERING_WORLD')
 
-hooksecurefunc("ToggleCharacter", function()
-  if PaperDollFrame:IsVisible() then
-    UpdateAll()
-  end
-end)
+
 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 = GameTooltipTextLeft3:GetText():match('Item Level (%d+)')
-    if not text then
-      text = GameTooltipTextLeft2:GetText():match('Item Level (%d+)')
+    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