local AlertFrameHolder = CreateFrame("Frame", "AlertFrameHolder", UIParent)
AlertFrameHolder:SetWidth(180)
AlertFrameHolder:SetHeight(20)
AlertFrameHolder:SetPoint("TOP", UIParent, "TOP", 0, -18)
local POSITION, ANCHOR_POINT, YOFFSET = "TOP", "BOTTOM", -10
local FORCE_POSITION = false;
function PostAlertMove(screenQuadrant)
AlertFrame:ClearAllPoints()
AlertFrame:SetAllPoints(AlertFrameHolder)
if screenQuadrant then
FORCE_POSITION = true
AlertFrame_FixAnchors()
FORCE_POSITION = false
end
end
function AlertFrame_SetLootAnchors(alertAnchor)
--This is a bit of reverse logic to get it to work properly because blizzard was a bit lazy..
if ( MissingLootFrame:IsShown() ) then
MissingLootFrame:ClearAllPoints()
MissingLootFrame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT)
if ( GroupLootContainer:IsShown() ) then
GroupLootContainer:ClearAllPoints()
GroupLootContainer:SetPoint(POSITION, MissingLootFrame, ANCHOR_POINT, 0, YOFFSET)
end
elseif ( GroupLootContainer:IsShown() or FORCE_POSITION) then
GroupLootContainer:ClearAllPoints()
GroupLootContainer:SetPoint(POSITION, alertAnchor, ANCHOR_POINT)
end
end
function AlertFrame_SetLootWonAnchors(alertAnchor)
for i=1, #LOOT_WON_ALERT_FRAMES do
local frame = LOOT_WON_ALERT_FRAMES[i];
if ( frame:IsShown() ) then
frame:ClearAllPoints()
frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
alertAnchor = frame
end
end
end
function AlertFrame_SetLootUpgradeFrameAnchors(alertAnchor)
for i=1, #LOOT_UPGRADE_ALERT_FRAMES do
local frame = LOOT_UPGRADE_ALERT_FRAMES[i];
if ( frame:IsShown() ) then
frame:ClearAllPoints()
frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
alertAnchor = frame;
end
end
end
function AlertFrame_SetMoneyWonAnchors(alertAnchor)
for i=1, #MONEY_WON_ALERT_FRAMES do
local frame = MONEY_WON_ALERT_FRAMES[i];
if ( frame:IsShown() ) then
frame:ClearAllPoints()
frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
alertAnchor = frame
end
end
end
function AlertFrame_SetAchievementAnchors(alertAnchor)
if ( AchievementAlertFrame1 ) then
for i = 1, MAX_ACHIEVEMENT_ALERTS do
local frame = _G["AchievementAlertFrame"..i];
if ( frame and frame:IsShown() ) then
frame:ClearAllPoints()
frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
alertAnchor = frame
end
end
end
end
function AlertFrame_SetCriteriaAnchors(alertAnchor)
if ( CriteriaAlertFrame1 ) then
for i = 1, MAX_ACHIEVEMENT_ALERTS do
local frame = _G["CriteriaAlertFrame"..i];
if ( frame and frame:IsShown() ) then
frame:ClearAllPoints()
frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
alertAnchor = frame
end
end
end
end
function AlertFrame_SetChallengeModeAnchors(alertAnchor)
local frame = ChallengeModeAlertFrame1;
if ( frame:IsShown() ) then
frame:ClearAllPoints()
frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
end
end
function AlertFrame_SetDungeonCompletionAnchors(alertAnchor)
local frame = DungeonCompletionAlertFrame1;
if ( frame:IsShown() ) then
frame:ClearAllPoints()
frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
end
end
function AlertFrame_SetStorePurchaseAnchors(alertAnchor)
local frame = StorePurchaseAlertFrame;
if ( frame:IsShown() ) then
frame:ClearAllPoints();
frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
end
end
function AlertFrame_SetScenarioAnchors(alertAnchor)
local frame = ScenarioAlertFrame1;
if ( frame:IsShown() ) then
frame:ClearAllPoints()
frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
end
end
function AlertFrame_SetGuildChallengeAnchors(alertAnchor)
local frame = GuildChallengeAlertFrame;
if ( frame:IsShown() ) then
frame:ClearAllPoints()
frame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
end
end
function AlertFrame_SetDigsiteCompleteToastFrameAnchors(alertAnchor)
if ( DigsiteCompleteToastFrame and DigsiteCompleteToastFrame:IsShown() ) then
DigsiteCompleteToastFrame:ClearAllPoints()
DigsiteCompleteToastFrame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
alertAnchor = DigsiteCompleteToastFrame;
end
end
function AlertFrame_SetGarrisonBuildingAlertFrameAnchors(alertAnchor)
if ( GarrisonBuildingAlertFrame and GarrisonBuildingAlertFrame:IsShown() ) then
GarrisonBuildingAlertFrame:ClearAllPoints()
GarrisonBuildingAlertFrame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
alertAnchor = GarrisonBuildingAlertFrame;
end
end
function AlertFrame_SetGarrisonMissionAlertFrameAnchors(alertAnchor)
if ( GarrisonMissionAlertFrame and GarrisonMissionAlertFrame:IsShown() ) then
GarrisonMissionAlertFrame:ClearAllPoints()
GarrisonMissionAlertFrame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
alertAnchor = GarrisonMissionAlertFrame;
end
end
function AlertFrame_SetGarrisonFollowerAlertFrameAnchors(alertAnchor)
if ( GarrisonFollowerAlertFrame and GarrisonFollowerAlertFrame:IsShown() ) then
GarrisonFollowerAlertFrame:ClearAllPoints()
GarrisonFollowerAlertFrame:SetPoint(POSITION, alertAnchor, ANCHOR_POINT, 0, YOFFSET);
alertAnchor = GarrisonFollowerAlertFrame;
end
end
function AlertMovers()
UIPARENT_MANAGED_FRAME_POSITIONS["GroupLootContainer"] = nil
hooksecurefunc('AlertFrame_FixAnchors', PostAlertMove)
hooksecurefunc('AlertFrame_SetLootAnchors', AlertFrame_SetLootAnchors)
hooksecurefunc('AlertFrame_SetStorePurchaseAnchors', AlertFrame_SetStorePurchaseAnchors)
hooksecurefunc('AlertFrame_SetLootWonAnchors', AlertFrame_SetLootWonAnchors)
hooksecurefunc('AlertFrame_SetLootUpgradeFrameAnchors', AlertFrame_SetLootUpgradeFrameAnchors)
hooksecurefunc('AlertFrame_SetMoneyWonAnchors', AlertFrame_SetMoneyWonAnchors)
hooksecurefunc('AlertFrame_SetAchievementAnchors', AlertFrame_SetAchievementAnchors)
hooksecurefunc('AlertFrame_SetCriteriaAnchors', AlertFrame_SetCriteriaAnchors)
hooksecurefunc('AlertFrame_SetChallengeModeAnchors', AlertFrame_SetChallengeModeAnchors)
hooksecurefunc('AlertFrame_SetDungeonCompletionAnchors', AlertFrame_SetDungeonCompletionAnchors)
hooksecurefunc('AlertFrame_SetScenarioAnchors', AlertFrame_SetScenarioAnchors)
hooksecurefunc('AlertFrame_SetGuildChallengeAnchors', AlertFrame_SetGuildChallengeAnchors)
hooksecurefunc('AlertFrame_SetDigsiteCompleteToastFrameAnchors', AlertFrame_SetDigsiteCompleteToastFrameAnchors)
hooksecurefunc('AlertFrame_SetGarrisonBuildingAlertFrameAnchors', AlertFrame_SetGarrisonBuildingAlertFrameAnchors)
hooksecurefunc('AlertFrame_SetGarrisonMissionAlertFrameAnchors', AlertFrame_SetGarrisonMissionAlertFrameAnchors)
hooksecurefunc('AlertFrame_SetGarrisonFollowerAlertFrameAnchors', AlertFrame_SetGarrisonFollowerAlertFrameAnchors)
end
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", AlertMovers)
SlashCmdList.TEST_ACHIEVEMENT = function()
PlaySound("LFG_Rewards")
AchievementFrame_LoadUI()
AchievementAlertFrame_ShowAlert(5780)
AchievementAlertFrame_ShowAlert(5000)
GuildChallengeAlertFrame_ShowAlert(3, 2, 5)
ChallengeModeAlertFrame_ShowAlert()
CriteriaAlertFrame_GetAlertFrame()
GarrisonBuildingAlertFrame_ShowAlert(GARRISON_TOWN_HALL_ALLIANCE)
GarrisonMissionAlertFrame_ShowAlert(C_Garrison.GetAvailableMissions()[1].missionID)
GarrisonRandomMissionAlertFrame_ShowAlert(C_Garrison.GetAvailableMissions()[1].missionID)
--GarrisonFollowerAlertFrame_ShowAlert(followerID)
AlertFrame_AnimateIn(CriteriaAlertFrame1)
AlertFrame_AnimateIn(DungeonCompletionAlertFrame1)
AlertFrame_AnimateIn(ScenarioAlertFrame1)
AlertFrame_FixAnchors()
end
SLASH_TEST_ACHIEVEMENT1 = "/testalerts"