View Single Post
06-02-16, 01:19 AM   #1
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
Hook fires for every element except the first one

Hello. Currently i am working on redesigning the challengemode frame. I noticed something i cant quite get the grip on.

On the challengemodekeystoneframe, you can add a keystone which will trigger this function:

Lua Code:
  1. function ChallengesKeystoneFrameMixin:SetUp(affixInfo)
  2.     if (type(affixInfo) == "table") then
  3.         local info = affixInfo;
  4.  
  5.         SetPortraitToTexture(self.Portrait, CHALLENGE_MODE_EXTRA_AFFIX_INFO[info.key].texture);
  6.        
  7.         if (info.pct > 999) then
  8.             self.Percent:SetFontObject("SystemFont_Shadow_Med1_Outline");
  9.         else
  10.             self.Percent:SetFontObject("SystemFont_Shadow_Large_Outline");
  11.         end
  12.                
  13.         self.Percent:SetText(("+%d%%"):format(info.pct));
  14.         self.Percent:Show();
  15.  
  16.         self.info = info;
  17.     else
  18.         local affixID = affixInfo;
  19.  
  20.         local _, _, filedataid = C_ChallengeMode.GetAffixInfo(affixID);
  21.  
  22.         SetPortraitToTexture(self.Portrait, filedataid);
  23.  
  24.         self.Percent:Hide();
  25.  
  26.         self.affixID = affixID;
  27.     end
  28.  
  29.     self:Show();
  30. end

Now since i want to change the look of the icons, i tried to hook into that function like this:

Lua Code:
  1. hooksecurefunc(ChallengesKeystoneFrameAffixMixin,"SetUp",function(self,affixInfo)
  2.         print("shot fired")
  3.         self.Border:Hide()
  4.         self.Portrait:SetTexCoord(0.15, 0.85, 0.15, 0.85)
  5.         --m_fontify(self.Percent,"white",miirgui.medium)   
  6.     end)

THis worked out just fine, except for the very first element it should work for. It just seems to always ignore the first element, no matter how many elements there are I meanwhile found a workaround by hooking ChallengesKeystoneFrameMixin:OnKeystoneSlotted() by shouldnt hooking the setup function work too?

Blizzard ChallengesUI
Attached Thumbnails
Click image for larger version

Name:	2elements.png
Views:	210
Size:	215.4 KB
ID:	8739  Click image for larger version

Name:	3elements.png
Views:	203
Size:	217.1 KB
ID:	8740  
__________________
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘

Last edited by Miiru : 06-02-16 at 01:26 AM.