View Single Post
09-19-14, 09:23 AM   #18
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Lombra View Post
I don't understand. You can't update the texture until the server has made the change and sent the event to the client; the API returns won't be up to date until then. The default UI calls SetTexture in response to this event.
If you hook both function/event then you can see that the SetTexture runs before the equip change:

Lua Code:
  1. hooksecurefunc(CharacterBackSlotIconTexture, "SetTexture", function(self, texture)
  2.     print(self:GetTexture())
  3. end)
  4.  
  5. CharacterBackSlot:HookScript("OnEvent", function(self, event, slot, hasItem)
  6.     if event == "PLAYER_EQUIPMENT_CHANGED" then
  7.         print(event)
  8.     end
  9. end)

And it should because when the equip change event triggers, you should be able to access the newly equipped item's texture properly. Between this 2 events the game still sets the original background texture, and in some cases it could be visible.
  Reply With Quote