Quantcast
AlertFrame reverse grow order - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-09-15, 02:37 PM   #1
evilbib
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 30
AlertFrame reverse grow order

This is my try. Original code is from ElvUI.
But /testalerts doesnt show anything, like they are offscreen or just gone. There are also no errors.
Any suggestions?
Lua Code:
  1. local AlertFrameHolder = CreateFrame("Frame", "AlertFrameHolder", UIParent)
  2. AlertFrameHolder:SetWidth(180)
  3. AlertFrameHolder:SetHeight(20)
  4. AlertFrameHolder:SetPoint("TOP", UIParent, "TOP", 0, -18)
  5.  
  6. local POSITION, ANCHOR_POINT, YOFFSET = "TOP", "BOTTOM", -10
  7. local FORCE_POSITION = false;
  8.  
  9. function PostAlertMove(screenQuadrant)
  10.     AlertFrame:ClearAllPoints()
  11.     AlertFrame:SetAllPoints(AlertFrameHolder)
  12.     if screenQuadrant then
  13.         FORCE_POSITION = true
  14.         AlertFrame_FixAnchors()
  15.         FORCE_POSITION = false
  16.     end
  17. end
  18.  
  19. function AlertFrame_SetLootAnchors(alertAnchor)
  20.     --This is a bit of reverse logic to get it to work properly because blizzard was a bit lazy..
  21.     if ( MissingLootFrame:IsShown() ) then
  22.         MissingLootFrame:ClearAllPoints()
  23.         MissingLootFrame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT)
  24.         if ( GroupLootContainer:IsShown() ) then
  25.             GroupLootContainer:ClearAllPoints()
  26.             GroupLootContainer:SetPoint(POSITION, MissingLootFrame, ANCHOR_POINT, 0, YOFFSET)
  27.         end
  28.     elseif ( GroupLootContainer:IsShown() or FORCE_POSITION) then
  29.         GroupLootContainer:ClearAllPoints()
  30.         GroupLootContainer:SetPoint(POSITION, alertAnchor, ANCHOR_POINT)
  31.     end
  32. end
  33.  
  34. function AlertFrame_SetLootWonAnchors(alertAnchor)
  35.     for i=1, #LOOT_WON_ALERT_FRAMES do
  36.         local frame = LOOT_WON_ALERT_FRAMES[i];
  37.         if ( frame:IsShown() ) then
  38.             frame:ClearAllPoints()
  39.             frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  40.             alertAnchor = frame
  41.         end
  42.     end
  43. end
  44.  
  45. function AlertFrame_SetLootUpgradeFrameAnchors(alertAnchor)
  46.     for i=1, #LOOT_UPGRADE_ALERT_FRAMES do
  47.         local frame = LOOT_UPGRADE_ALERT_FRAMES[i];
  48.         if ( frame:IsShown() ) then
  49.             frame:ClearAllPoints()
  50.             frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  51.             alertAnchor = frame;
  52.         end
  53.     end
  54. end
  55.  
  56. function AlertFrame_SetMoneyWonAnchors(alertAnchor)
  57.     for i=1, #MONEY_WON_ALERT_FRAMES do
  58.         local frame = MONEY_WON_ALERT_FRAMES[i];
  59.         if ( frame:IsShown() ) then
  60.             frame:ClearAllPoints()
  61.             frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  62.             alertAnchor = frame
  63.         end
  64.     end
  65. end
  66.  
  67. function AlertFrame_SetAchievementAnchors(alertAnchor)
  68.     if ( AchievementAlertFrame1 ) then
  69.         for i = 1, MAX_ACHIEVEMENT_ALERTS do
  70.             local frame = _G["AchievementAlertFrame"..i];
  71.             if ( frame and frame:IsShown() ) then
  72.                 frame:ClearAllPoints()
  73.                 frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  74.                 alertAnchor = frame
  75.             end
  76.         end
  77.     end
  78. end
  79.  
  80. function AlertFrame_SetCriteriaAnchors(alertAnchor)
  81.     if ( CriteriaAlertFrame1 ) then
  82.         for i = 1, MAX_ACHIEVEMENT_ALERTS do
  83.             local frame = _G["CriteriaAlertFrame"..i];
  84.             if ( frame and frame:IsShown() ) then
  85.                 frame:ClearAllPoints()
  86.                 frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  87.                 alertAnchor = frame
  88.             end
  89.         end
  90.     end
  91. end
  92.  
  93. function AlertFrame_SetChallengeModeAnchors(alertAnchor)
  94.     local frame = ChallengeModeAlertFrame1;
  95.     if ( frame:IsShown() ) then
  96.         frame:ClearAllPoints()
  97.         frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  98.     end
  99. end
  100.  
  101. function AlertFrame_SetDungeonCompletionAnchors(alertAnchor)
  102.     local frame = DungeonCompletionAlertFrame1;
  103.     if ( frame:IsShown() ) then
  104.         frame:ClearAllPoints()
  105.         frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  106.     end
  107. end
  108.  
  109. function AlertFrame_SetStorePurchaseAnchors(alertAnchor)
  110.     local frame = StorePurchaseAlertFrame;
  111.     if ( frame:IsShown() ) then
  112.         frame:ClearAllPoints();
  113.         frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  114.     end
  115. end
  116.  
  117. function AlertFrame_SetScenarioAnchors(alertAnchor)
  118.     local frame = ScenarioAlertFrame1;
  119.     if ( frame:IsShown() ) then
  120.         frame:ClearAllPoints()
  121.         frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  122.     end
  123. end
  124.  
  125. function AlertFrame_SetGuildChallengeAnchors(alertAnchor)
  126.     local frame = GuildChallengeAlertFrame;
  127.     if ( frame:IsShown() ) then
  128.         frame:ClearAllPoints()
  129.         frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  130.     end
  131. end
  132.  
  133. function AlertFrame_SetDigsiteCompleteToastFrameAnchors(alertAnchor)
  134.     if ( DigsiteCompleteToastFrame and DigsiteCompleteToastFrame:IsShown() ) then
  135.         DigsiteCompleteToastFrame:ClearAllPoints()
  136.         DigsiteCompleteToastFrame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  137.         alertAnchor = DigsiteCompleteToastFrame;
  138.     end
  139. end
  140.  
  141. function AlertFrame_SetGarrisonBuildingAlertFrameAnchors(alertAnchor)
  142.     if ( GarrisonBuildingAlertFrame and GarrisonBuildingAlertFrame:IsShown() ) then
  143.         GarrisonBuildingAlertFrame:ClearAllPoints()
  144.         GarrisonBuildingAlertFrame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  145.         alertAnchor = GarrisonBuildingAlertFrame;
  146.     end
  147. end
  148.  
  149. function AlertFrame_SetGarrisonMissionAlertFrameAnchors(alertAnchor)
  150.     if ( GarrisonMissionAlertFrame and GarrisonMissionAlertFrame:IsShown() ) then
  151.         GarrisonMissionAlertFrame:ClearAllPoints()
  152.         GarrisonMissionAlertFrame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  153.         alertAnchor = GarrisonMissionAlertFrame;
  154.     end
  155. end
  156.  
  157. function AlertFrame_SetGarrisonFollowerAlertFrameAnchors(alertAnchor)
  158.     if ( GarrisonFollowerAlertFrame and GarrisonFollowerAlertFrame:IsShown() ) then
  159.         GarrisonFollowerAlertFrame:ClearAllPoints()
  160.         GarrisonFollowerAlertFrame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
  161.         alertAnchor = GarrisonFollowerAlertFrame;
  162.     end
  163. end
  164.  
  165. function AlertMovers()
  166.     UIPARENT_MANAGED_FRAME_POSITIONS["GroupLootContainer"] = nil
  167.     hooksecurefunc('AlertFrame_FixAnchors', PostAlertMove)
  168.     hooksecurefunc('AlertFrame_SetLootAnchors', AlertFrame_SetLootAnchors)
  169.     hooksecurefunc('AlertFrame_SetStorePurchaseAnchors', AlertFrame_SetStorePurchaseAnchors)
  170.     hooksecurefunc('AlertFrame_SetLootWonAnchors', AlertFrame_SetLootWonAnchors)
  171.     hooksecurefunc('AlertFrame_SetLootUpgradeFrameAnchors', AlertFrame_SetLootUpgradeFrameAnchors)
  172.     hooksecurefunc('AlertFrame_SetMoneyWonAnchors', AlertFrame_SetMoneyWonAnchors)
  173.     hooksecurefunc('AlertFrame_SetAchievementAnchors', AlertFrame_SetAchievementAnchors)
  174.     hooksecurefunc('AlertFrame_SetCriteriaAnchors', AlertFrame_SetCriteriaAnchors)
  175.     hooksecurefunc('AlertFrame_SetChallengeModeAnchors', AlertFrame_SetChallengeModeAnchors)
  176.     hooksecurefunc('AlertFrame_SetDungeonCompletionAnchors', AlertFrame_SetDungeonCompletionAnchors)
  177.     hooksecurefunc('AlertFrame_SetScenarioAnchors', AlertFrame_SetScenarioAnchors)
  178.     hooksecurefunc('AlertFrame_SetGuildChallengeAnchors', AlertFrame_SetGuildChallengeAnchors)
  179.     hooksecurefunc('AlertFrame_SetDigsiteCompleteToastFrameAnchors', AlertFrame_SetDigsiteCompleteToastFrameAnchors)
  180.     hooksecurefunc('AlertFrame_SetGarrisonBuildingAlertFrameAnchors', AlertFrame_SetGarrisonBuildingAlertFrameAnchors)
  181.     hooksecurefunc('AlertFrame_SetGarrisonMissionAlertFrameAnchors', AlertFrame_SetGarrisonMissionAlertFrameAnchors)
  182.     hooksecurefunc('AlertFrame_SetGarrisonFollowerAlertFrameAnchors', AlertFrame_SetGarrisonFollowerAlertFrameAnchors)
  183. end
  184.  
  185. local f = CreateFrame("Frame")
  186. f:RegisterEvent("PLAYER_LOGIN")
  187. f:SetScript("OnEvent", AlertMovers)
  188.  
  189. SlashCmdList.TEST_ACHIEVEMENT = function()
  190.     PlaySound("LFG_Rewards")
  191.     AchievementFrame_LoadUI()
  192.     AchievementAlertFrame_ShowAlert(5780)
  193.     AchievementAlertFrame_ShowAlert(5000)
  194.     GuildChallengeAlertFrame_ShowAlert(3, 2, 5)
  195.     ChallengeModeAlertFrame_ShowAlert()
  196.     CriteriaAlertFrame_GetAlertFrame()
  197.     GarrisonBuildingAlertFrame_ShowAlert(GARRISON_TOWN_HALL_ALLIANCE)
  198.     GarrisonMissionAlertFrame_ShowAlert(C_Garrison.GetAvailableMissions()[1].missionID)
  199.     GarrisonRandomMissionAlertFrame_ShowAlert(C_Garrison.GetAvailableMissions()[1].missionID)
  200.     --GarrisonFollowerAlertFrame_ShowAlert(followerID)
  201.     AlertFrame_AnimateIn(CriteriaAlertFrame1)
  202.     AlertFrame_AnimateIn(DungeonCompletionAlertFrame1)
  203.     AlertFrame_AnimateIn(ScenarioAlertFrame1)
  204.     AlertFrame_FixAnchors()
  205. end
  206. SLASH_TEST_ACHIEVEMENT1 = "/testalerts"

Last edited by evilbib : 03-09-15 at 02:39 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » AlertFrame reverse grow order

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