Quantcast
Modifying Alertframes - WoWInterface
 
Thread Tools Display Modes
05-15-16, 06:41 AM   #1
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
Modifying Alertframes

It seems like Alertframes (for example achievement) no longer have names but are children of UiParent?

AchievementAlertSystem:AddAlert(...) calls the alert frame (/run AchievementAlertSystem:AddAlert(112) to test). How can i now easily access them without having to scan for children of UiParent?

(It's the same for all alerts, all names are gone )
__________________
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘
 
05-15-16, 01:30 PM   #2
lucro
A Murloc Raider
Join Date: May 2016
Posts: 5
If you look at the source you'll see that the achievement alerts are created using a queued subsystem with
Code:
AchievementAlertSystem = AlertFrame:AddQueuedAlertFrameSubSystem("AchievementAlertFrameTemplate", AchievementAlertFrame_SetUp, 2, 6);
If you look at the source of the queued subsystem definition you'll see the important part is in OnLoad
Code:
function AlertFrameQueueMixin:OnLoad(alertFrameTemplate, setUpFunction, maxAlerts, maxQueue)
	self.alertFramePool = CreateFramePool("BUTTON", UIParent, alertFrameTemplate, OnPooledAlertFrameQueueReset);
-- .. more code ...
end
Primarily the CreateFramePool call returns an instance of a frame pool that now handles the creation and recycling of the alert frames.

The frame pool has some functions that may be relevant to you. Primarily EnumerateActive() that you can use in an a loop to go through all the alerts that are being displayed currently.

For example:
Code:
local achievementAlertPool = AchievementAlertSystem.alertFramePool
for alertFrame in achievementAlertPool:EnumerateActive() do
    --modify the alertFrame however
end

Last edited by lucro : 05-15-16 at 01:57 PM.
 
05-15-16, 02:02 PM   #3
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
Thank you for your response, I will try to work through this tomorrow, I cant make much sense of it as of right now
__________________
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘
 
05-15-16, 02:12 PM   #4
lucro
A Murloc Raider
Join Date: May 2016
Posts: 5
The frames won't be created until they're needed, so it may be sufficient to just hook the setup function AchievementAlertFrame_SetUp and adjust it there.
 
05-15-16, 02:38 PM   #5
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
Originally Posted by lucro View Post
The frames won't be created until they're needed, so it may be sufficient to just hook the setup function AchievementAlertFrame_SetUp and adjust it there.
I got it working like this:

Lua Code:
  1. hooksecurefunc(AchievementAlertSystem,"ShowAlert",function()
  2.             local achievementAlertPool = AchievementAlertSystem.alertFramePool
  3.                 for alertFrame in achievementAlertPool:EnumerateActive() do
  4.                     alertFrame.Icon:Hide()
  5.                     alertFrame.Background:ClearAllPoints()
  6.                     alertFrame.Background:SetSize(512,64)
  7.                     alertFrame.Background:SetTexCoord(0,1,1,0)
  8.                     alertFrame.Background:SetParent(alertFrame)
  9.                     alertFrame.Background:SetPoint("Center",29,1)
  10.                     alertFrame.Background:SetTexture("Interface\\Achievementframe\\miirgui_ach.tga")
  11.  
  12.                     alertFrame.Unlocked:SetTextColor(unpack(miirgui.Color))
  13.                     alertFrame.Unlocked:SetFont(unpack(miirgui.small))
  14.                     alertFrame.Unlocked:SetShadowColor(0,0,0,0)
  15.  
  16.                     alertFrame.Name:SetTextColor(1,1,1,1)
  17.                     alertFrame.Name:SetFont(unpack(miirgui.medium))
  18.                     alertFrame.Name:SetShadowColor(0,0,0,0)
  19.                 end
  20.         end)

I do not know if it's the best method, but it works just fine . I tried hooking the setup function, but the hook did not seem to fire.
__________________
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘
 
05-18-16, 01:07 PM   #6
Miiru
A Flamescale Wyrmkin
 
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
I am done with the alertframe now. It was pretty stright forward after your help

Here are some /run commands to test most alertframes incase somebody needs them.

Lua Code:
  1. /run LootAlertSystem:AddAlert("|cff9d9d9d|Hitem:7073:0:0:0:0:0:0:0:80:0:0:0:0|h[Broken Fang]|h|r", 1, specID, 3, 1, 3, Awesome);
  2.  
  3. /run MoneyWonAlertSystem:AddAlert(815)
  4.  
  5. /run AchievementAlertSystem:AddAlert(5192)
  6.  
  7. /run CriteriaAlertSystem:ShowAlert(80,1)
  8.  
  9. /run GuildChallengeAlertSystem:AddAlert(3, 2, 5)
  10.  
  11. /run InvasionAlertSystem:AddAlert(1,20)
  12.  
  13. /run DigsiteCompleteAlertSystem:AddAlert(1)
  14.  
  15.  /run LootUpgradeAlertSystem:AddAlert("|cff9d9d9d|Hitem:7073:0:0:0:0:0:0:0:80:0:0:0:0|h[Broken Fang]|h|r", 1, specID, 3, "Cesaor", 3, Awesome);
  16.  
  17.  /run GarrisonFollowerAlertSystem:AddAlert(112, "Cool Guy", "100", 3, 1)
  18.  
  19.  /run GarrisonShipFollowerAlertSystem:AddAlert(592, "Test", "Transport", "GarrBuilding_Barracks_1_H", 3, 2, 1)
  20.  
  21.  /run GarrisonBuildingAlertSystem:AddAlert("miau")
  22.  
  23.  /run WorldQuestCompleteAlertSystem:AddAlert(112)
__________________
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » Modifying Alertframes

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off