/FrameXML/UIParent.lua
Lua | 4154 lines | 3357 code | 457 blank | 340 comment | 780 complexity | 8b04045c69f56a874f0429384d39f43e MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- TOOLTIP_UPDATE_TIME = 0.2;
- ROTATIONS_PER_SECOND = .5;
- BOSS_FRAME_CASTBAR_HEIGHT = 16;
- -- Alpha animation stuff
- FADEFRAMES = {};
- FLASHFRAMES = {};
- -- Pulsing stuff
- PULSEBUTTONS = {};
- -- Shine animation
- SHINES_TO_ANIMATE = {};
- -- Per panel settings
- UIPanelWindows = {};
- --Center Menu Frames
- UIPanelWindows["GameMenuFrame"] = { area = "center", pushable = 0, whileDead = 1 };
- UIPanelWindows["VideoOptionsFrame"] = { area = "center", pushable = 0, whileDead = 1 };
- UIPanelWindows["AudioOptionsFrame"] = { area = "center", pushable = 0, whileDead = 1 };
- UIPanelWindows["InterfaceOptionsFrame"] = { area = "center", pushable = 0, whileDead = 1 };
- UIPanelWindows["HelpFrame"] = { area = "center", pushable = 0, whileDead = 1 };
- -- Frames using the new Templates
- UIPanelWindows["CharacterFrame"] = { area = "left", pushable = 3, whileDead = 1};
- UIPanelWindows["SpellBookFrame"] = { area = "left", pushable = 1, whileDead = 1, width = 575, height = 545 };
- UIPanelWindows["TaxiFrame"] = { area = "left", pushable = 0, width = 605, height = 580 };
- UIPanelWindows["PVPUIFrame"] = { area = "left", pushable = 0, whileDead = 1, width = 563};
- UIPanelWindows["PVPBannerFrame"] = { area = "left", pushable = 1};
- UIPanelWindows["PetStableFrame"] = { area = "left", pushable = 0};
- UIPanelWindows["PVEFrame"] = { area = "left", pushable = 0, whileDead = 1, width = 563};
- UIPanelWindows["EncounterJournal"] = { area = "left", pushable = 0, whileDead = 1, width = 830};
- UIPanelWindows["PetJournalParent"] = { area = "left", pushable = 0, whileDead = 1, width = 830};
- UIPanelWindows["TradeFrame"] = { area = "left", pushable = 1};
- UIPanelWindows["LootFrame"] = { area = "left", pushable = 7};
- UIPanelWindows["MerchantFrame"] = { area = "left", pushable = 0};
- UIPanelWindows["TabardFrame"] = { area = "left", pushable = 0};
- UIPanelWindows["PVPBannerFrame"] = { area = "left", pushable = 1};
- UIPanelWindows["MailFrame"] = { area = "left", pushable = 0};
- UIPanelWindows["BankFrame"] = { area = "left", pushable = 6, width = 425 };
- UIPanelWindows["QuestLogFrame"] = { area = "doublewide", pushable = 0, whileDead = 1 };
- UIPanelWindows["QuestLogDetailFrame"] = { area = "left", pushable = 1, whileDead = 1 };
- UIPanelWindows["QuestFrame"] = { area = "left", pushable = 0};
- UIPanelWindows["GuildRegistrarFrame"] = { area = "left", pushable = 0};
- UIPanelWindows["GossipFrame"] = { area = "left", pushable = 0};
- UIPanelWindows["DressUpFrame"] = { area = "left", pushable = 2};
- UIPanelWindows["PetitionFrame"] = { area = "left", pushable = 0};
- UIPanelWindows["ItemTextFrame"] = { area = "left", pushable = 0};
- UIPanelWindows["FriendsFrame"] = { area = "left", pushable = 0, whileDead = 1, extraWidth = 32};
- UIPanelWindows["RaidParentFrame"] = { area = "left", pushable = 1, whileDead = 1 };
- UIPanelWindows["RaidBrowserFrame"] = { area = "left", pushable = 1, };
- -- Frames NOT using the new Templates
- UIPanelWindows["WorldMapFrame"] = { area = "full", pushable = 0, xoffset = -16, yoffset = 12, whileDead = 1 };
- UIPanelWindows["CinematicFrame"] = { area = "full", pushable = 0, xoffset = -16, yoffset = 12, whileDead = 1 };
- UIPanelWindows["ChatConfigFrame"] = { area = "center", pushable = 0, xoffset = -16, yoffset = 12, whileDead = 1 };
- UIPanelWindows["WorldStateScoreFrame"] = { area = "center", pushable = 0, xoffset = -16, yoffset = 12, whileDead = 1 };
- UIPanelWindows["QuestChoiceFrame"] = { area = "center", pushable = 0, xoffset = -16, yoffset = 12, whileDead = 0, allowOtherPanels = 1 };
- local function GetUIPanelWindowInfo(frame, name)
- if ( not frame:GetAttribute("UIPanelLayout-defined") ) then
- local info = UIPanelWindows[frame:GetName()];
- if ( not info ) then
- return;
- end
- frame:SetAttribute("UIPanelLayout-defined", true);
- for name,value in pairs(info) do
- frame:SetAttribute("UIPanelLayout-"..name, value);
- end
- end
- return frame:GetAttribute("UIPanelLayout-"..name);
- end
- function SetUIPanelAttribute(frame, name, value)
- local info = UIPanelWindows[frame:GetName()];
- if ( not info ) then
- return;
- end
-
- if ( not frame:GetAttribute("UIPanelLayout-defined") ) then
- frame:SetAttribute("UIPanelLayout-defined", true);
- for name,value in pairs(info) do
- frame:SetAttribute("UIPanelLayout-"..name, value);
- end
- end
-
- frame:SetAttribute("UIPanelLayout-"..name, value);
- end
- -- These are windows that rely on a parent frame to be open. If the parent closes or a pushable frame overlaps them they must be hidden.
- UIChildWindows = {
- "OpenMailFrame",
- "GuildControlUI",
- "GuildMemberDetailFrame",
- "TokenFramePopup",
- "GuildBankPopupFrame",
- "GearManagerDialog",
- };
- UISpecialFrames = {
- "ItemRefTooltip",
- "ColorPickerFrame",
- "ScrollOfResurrectionFrame",
- "ScrollOfResurrectionSelectionFrame"
- };
- UIMenus = {
- "ChatMenu",
- "EmoteMenu",
- "LanguageMenu",
- "DropDownList1",
- "DropDownList2",
- };
- NUM_ITEM_QUALITIES = 7;
- ITEM_QUALITY_COLORS = { };
- for i = -1, NUM_ITEM_QUALITIES do
- ITEM_QUALITY_COLORS[i] = { };
- ITEM_QUALITY_COLORS[i].r,
- ITEM_QUALITY_COLORS[i].g,
- ITEM_QUALITY_COLORS[i].b,
- ITEM_QUALITY_COLORS[i].hex = GetItemQualityColor(i);
- ITEM_QUALITY_COLORS[i].hex = "|c"..ITEM_QUALITY_COLORS[i].hex;
- end
- function UIParent_OnLoad(self)
- self:RegisterEvent("PLAYER_LOGIN");
- self:RegisterEvent("PLAYER_DEAD");
- self:RegisterEvent("SELF_RES_SPELL_CHANGED");
- self:RegisterEvent("PLAYER_ALIVE");
- self:RegisterEvent("PLAYER_UNGHOST");
- self:RegisterEvent("RESURRECT_REQUEST");
- self:RegisterEvent("PLAYER_SKINNED");
- self:RegisterEvent("TRADE_REQUEST");
- self:RegisterEvent("CHANNEL_INVITE_REQUEST");
- self:RegisterEvent("CHANNEL_PASSWORD_REQUEST");
- self:RegisterEvent("PARTY_INVITE_REQUEST");
- self:RegisterEvent("PARTY_INVITE_CANCEL");
- self:RegisterEvent("GUILD_INVITE_REQUEST");
- self:RegisterEvent("GUILD_INVITE_CANCEL");
- self:RegisterEvent("ARENA_TEAM_INVITE_REQUEST");
- self:RegisterEvent("PLAYER_CAMPING");
- self:RegisterEvent("PLAYER_QUITING");
- self:RegisterEvent("LOGOUT_CANCEL");
- self:RegisterEvent("LOOT_BIND_CONFIRM");
- self:RegisterEvent("EQUIP_BIND_CONFIRM");
- self:RegisterEvent("AUTOEQUIP_BIND_CONFIRM");
- self:RegisterEvent("USE_BIND_CONFIRM");
- self:RegisterEvent("CONFIRM_BEFORE_USE");
- self:RegisterEvent("DELETE_ITEM_CONFIRM");
- self:RegisterEvent("QUEST_ACCEPT_CONFIRM");
- self:RegisterEvent("QUEST_LOG_UPDATE");
- self:RegisterEvent("UNIT_QUEST_LOG_CHANGED");
- self:RegisterEvent("CURSOR_UPDATE");
- self:RegisterEvent("LOCALPLAYER_PET_RENAMED");
- self:RegisterEvent("PLAYER_ENTERING_WORLD");
- self:RegisterEvent("MIRROR_TIMER_START");
- self:RegisterEvent("DUEL_REQUESTED");
- self:RegisterEvent("DUEL_OUTOFBOUNDS");
- self:RegisterEvent("DUEL_INBOUNDS");
- self:RegisterEvent("DUEL_FINISHED");
- self:RegisterEvent("PET_BATTLE_PVP_DUEL_REQUESTED");
- self:RegisterEvent("PET_BATTLE_QUEUE_PROPOSE_MATCH");
- self:RegisterEvent("PET_BATTLE_QUEUE_PROPOSAL_DECLINED");
- self:RegisterEvent("PET_BATTLE_QUEUE_PROPOSAL_ACCEPTED");
- self:RegisterEvent("PET_BATTLE_PVP_DUEL_REQUEST_CANCEL");
- self:RegisterEvent("TRADE_REQUEST_CANCEL");
- self:RegisterEvent("CONFIRM_XP_LOSS");
- self:RegisterEvent("CORPSE_IN_RANGE");
- self:RegisterEvent("CORPSE_IN_INSTANCE");
- self:RegisterEvent("CORPSE_OUT_OF_RANGE");
- self:RegisterEvent("AREA_SPIRIT_HEALER_IN_RANGE");
- self:RegisterEvent("AREA_SPIRIT_HEALER_OUT_OF_RANGE");
- self:RegisterEvent("BIND_ENCHANT");
- self:RegisterEvent("REPLACE_ENCHANT");
- self:RegisterEvent("TRADE_REPLACE_ENCHANT");
- self:RegisterEvent("END_BOUND_TRADEABLE");
- self:RegisterEvent("CURRENT_SPELL_CAST_CHANGED");
- self:RegisterEvent("MACRO_ACTION_BLOCKED");
- self:RegisterEvent("ADDON_ACTION_BLOCKED");
- self:RegisterEvent("MACRO_ACTION_FORBIDDEN");
- self:RegisterEvent("ADDON_ACTION_FORBIDDEN");
- self:RegisterEvent("PLAYER_CONTROL_LOST");
- self:RegisterEvent("PLAYER_CONTROL_GAINED");
- self:RegisterEvent("START_LOOT_ROLL");
- self:RegisterEvent("CONFIRM_LOOT_ROLL");
- self:RegisterEvent("CONFIRM_DISENCHANT_ROLL");
- self:RegisterEvent("INSTANCE_BOOT_START");
- self:RegisterEvent("INSTANCE_BOOT_STOP");
- self:RegisterEvent("INSTANCE_LOCK_START");
- self:RegisterEvent("INSTANCE_LOCK_STOP");
- self:RegisterEvent("INSTANCE_LOCK_WARNING");
- self:RegisterEvent("CONFIRM_TALENT_WIPE");
- self:RegisterEvent("CONFIRM_BINDER");
- self:RegisterEvent("CONFIRM_SUMMON");
- self:RegisterEvent("CANCEL_SUMMON");
- self:RegisterEvent("GOSSIP_CONFIRM");
- self:RegisterEvent("GOSSIP_CONFIRM_CANCEL");
- self:RegisterEvent("GOSSIP_ENTER_CODE");
- self:RegisterEvent("GOSSIP_CLOSED");
- self:RegisterEvent("BILLING_NAG_DIALOG");
- self:RegisterEvent("IGR_BILLING_NAG_DIALOG");
- self:RegisterEvent("VARIABLES_LOADED");
- self:RegisterEvent("GROUP_ROSTER_UPDATE");
- self:RegisterEvent("RAID_INSTANCE_WELCOME");
- self:RegisterEvent("LEVEL_GRANT_PROPOSED");
- self:RegisterEvent("RAISED_AS_GHOUL");
- self:RegisterEvent("SOR_START_EXPERIENCE_INCOMPLETE");
- self:RegisterEvent("MISSING_OUT_ON_LOOT");
- self:RegisterEvent("SPELL_CONFIRMATION_PROMPT");
- self:RegisterEvent("SPELL_CONFIRMATION_TIMEOUT");
-
- -- Events for auction UI handling
- self:RegisterEvent("AUCTION_HOUSE_SHOW");
- self:RegisterEvent("AUCTION_HOUSE_CLOSED");
- self:RegisterEvent("AUCTION_HOUSE_DISABLED");
-
- -- Events for trainer UI handling
- self:RegisterEvent("TRAINER_SHOW");
- self:RegisterEvent("TRAINER_CLOSED");
- -- Events for trade skill UI handling
- self:RegisterEvent("TRADE_SKILL_SHOW");
- self:RegisterEvent("TRADE_SKILL_CLOSE");
- -- Events for Item socketing UI
- self:RegisterEvent("SOCKET_INFO_UPDATE");
- -- Events for taxi benchmarking
- self:RegisterEvent("ENABLE_TAXI_BENCHMARK");
- self:RegisterEvent("DISABLE_TAXI_BENCHMARK");
- -- Push to talk
- self:RegisterEvent("VOICE_PUSH_TO_TALK_START");
- self:RegisterEvent("VOICE_PUSH_TO_TALK_STOP");
- -- Events for BarberShop Handling
- self:RegisterEvent("BARBER_SHOP_OPEN");
- self:RegisterEvent("BARBER_SHOP_CLOSE");
- -- Events for Guild bank UI
- self:RegisterEvent("GUILDBANKFRAME_OPENED");
- self:RegisterEvent("GUILDBANKFRAME_CLOSED");
- -- Events for Achievements!
- self:RegisterEvent("ACHIEVEMENT_EARNED");
- --Events for GMChatUI
- self:RegisterEvent("CHAT_MSG_WHISPER");
-
- -- Events for WoW Mouse
- self:RegisterEvent("WOW_MOUSE_NOT_FOUND");
-
- -- Events for talent wipes
- self:RegisterEvent("TALENTS_INVOLUNTARILY_RESET");
-
-
- -- Events for reforging
- self:RegisterEvent("FORGE_MASTER_OPENED");
- self:RegisterEvent("FORGE_MASTER_CLOSED");
-
- -- Events for Archaeology
- self:RegisterEvent("ARCHAEOLOGY_TOGGLE");
-
- -- Events for transmogrify
- self:RegisterEvent("TRANSMOGRIFY_OPEN");
- self:RegisterEvent("TRANSMOGRIFY_CLOSE");
- -- Events for void storage
- self:RegisterEvent("VOID_STORAGE_OPEN");
- self:RegisterEvent("VOID_STORAGE_CLOSE");
-
- -- Events for Trial caps
- self:RegisterEvent("TRIAL_CAP_REACHED_MONEY");
- self:RegisterEvent("TRIAL_CAP_REACHED_LEVEL");
- -- Events for black market
- self:RegisterEvent("BLACK_MARKET_OPEN");
- self:RegisterEvent("BLACK_MARKET_CLOSE");
- -- Events for item upgrades
- self:RegisterEvent("ITEM_UPGRADE_MASTER_OPENED");
- self:RegisterEvent("ITEM_UPGRADE_MASTER_CLOSED");
- -- Events for Pet Jornal
- self:RegisterEvent("PET_JOURNAL_NEW_BATTLE_SLOT");
-
- -- Events for Quest Choice
- self:RegisterEvent("QUEST_CHOICE_UPDATE");
- end
- -- Addons --
- local FailedAddOnLoad = {};
- function UIParentLoadAddOn(name)
- local loaded, reason = LoadAddOn(name);
- if ( not loaded ) then
- if ( not FailedAddOnLoad[name] ) then
- message(format(ADDON_LOAD_FAILED, name, _G["ADDON_"..reason]));
- FailedAddOnLoad[name] = true;
- end
- end
- return loaded;
- end
- function AuctionFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_AuctionUI");
- end
- function BattlefieldMinimap_LoadUI()
- UIParentLoadAddOn("Blizzard_BattlefieldMinimap");
- end
- function ClassTrainerFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_TrainerUI");
- end
- function CombatLog_LoadUI()
- UIParentLoadAddOn("Blizzard_CombatLog");
- end
- function GuildBankFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_GuildBankUI");
- end
- function InspectFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_InspectUI");
- end
- function KeyBindingFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_BindingUI");
- end
- function MacroFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_MacroUI");
- end
- function MacroFrame_SaveMacro()
- -- this will be overwritten with the real thing when the addon is loaded
- end
- function RaidFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_RaidUI");
- end
- function TalentFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_TalentUI");
- end
- function TradeSkillFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_TradeSkillUI");
- end
- function GMSurveyFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_GMSurveyUI");
- end
- function ItemSocketingFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_ItemSocketingUI");
- end
- function BarberShopFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_BarberShopUI");
- end
- function AchievementFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_AchievementUI");
- end
- function TimeManager_LoadUI()
- UIParentLoadAddOn("Blizzard_TimeManager");
- end
- function TokenFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_TokenUI");
- end
- function GlyphFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_GlyphUI");
- end
- function Calendar_LoadUI()
- UIParentLoadAddOn("Blizzard_Calendar");
- end
- function Reforging_LoadUI()
- UIParentLoadAddOn("Blizzard_ReforgingUI");
- end
- function ItemAlteration_LoadUI()
- UIParentLoadAddOn("Blizzard_ItemAlterationUI");
- end
- function VoidStorage_LoadUI()
- UIParentLoadAddOn("Blizzard_VoidStorageUI");
- end
- function ArchaeologyFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_ArchaeologyUI");
- end
- function GMChatFrame_LoadUI(...)
- if ( IsAddOnLoaded("Blizzard_GMChatUI") ) then
- return;
- else
- UIParentLoadAddOn("Blizzard_GMChatUI");
- if ( select(1, ...) ) then
- GMChatFrame_OnEvent(GMChatFrame, ...);
- end
- end
- end
- function Arena_LoadUI()
- UIParentLoadAddOn("Blizzard_ArenaUI");
- end
- function GuildFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_GuildUI");
- end
- function LookingForGuildFrame_LoadUI()
- UIParentLoadAddOn("Blizzard_LookingForGuildUI");
- end
- function EncounterJournal_LoadUI()
- UIParentLoadAddOn("Blizzard_EncounterJournal");
- end
- function PetJournal_LoadUI()
- UIParentLoadAddOn("Blizzard_PetJournal");
- end
- function BlackMarket_LoadUI()
- UIParentLoadAddOn("Blizzard_BlackMarketUI");
- end
- function ItemUpgrade_LoadUI()
- UIParentLoadAddOn("Blizzard_ItemUpgradeUI");
- end
- function PVP_LoadUI()
- UIParentLoadAddOn("Blizzard_PVPUI");
- end
- function QuestChoice_LoadUI()
- UIParentLoadAddOn("Blizzard_QuestChoice");
- end
- --[[
- function MovePad_LoadUI()
- UIParentLoadAddOn("Blizzard_MovePad");
- end
- ]]
- function ShowMacroFrame()
- MacroFrame_LoadUI();
- if ( MacroFrame_Show ) then
- MacroFrame_Show();
- end
- end
- function InspectAchievements (unit)
- if (IsBlizzCon()) then
- return;
- end
- AchievementFrame_LoadUI();
- AchievementFrame_DisplayComparison(unit);
- end
- function ToggleAchievementFrame(stats)
- if ( ( HasCompletedAnyAchievement() or IsInGuild() ) and CanShowAchievementUI() ) then
- AchievementFrame_LoadUI();
- AchievementFrame_ToggleAchievementFrame(stats);
- end
- end
- function ToggleTalentFrame()
- if (IsBlizzCon() or (UnitLevel("player") < SHOW_SPEC_LEVEL)) then
- return;
- end
- TalentFrame_LoadUI();
- if ( PlayerTalentFrame_Toggle ) then
- PlayerTalentFrame_Toggle(GetActiveSpecGroup());
- end
- end
- function ToggleGlyphFrame()
- if (IsBlizzCon()) then
- return;
- end
- if ( UnitLevel("player") < SHOW_INSCRIPTION_LEVEL ) then
- return;
- end
- GlyphFrame_LoadUI();
- if ( GlyphFrame_Toggle ) then
- GlyphFrame_Toggle();
- end
- end
- function OpenGlyphFrame()
- if (IsBlizzCon()) then
- return;
- end
- if ( UnitLevel("player") < SHOW_INSCRIPTION_LEVEL ) then
- return;
- end
- GlyphFrame_LoadUI();
- if ( GlyphFrame_Open ) then
- GlyphFrame_Open();
- end
- end
- function ToggleBattlefieldMinimap()
- BattlefieldMinimap_LoadUI();
- if ( BattlefieldMinimap_Toggle ) then
- BattlefieldMinimap_Toggle();
- end
- end
- function ToggleTimeManager()
- TimeManager_LoadUI();
- if ( TimeManager_Toggle ) then
- TimeManager_Toggle();
- end
- end
- function ToggleCalendar()
- if (IsBlizzCon()) then
- return;
- end
- Calendar_LoadUI();
- if ( Calendar_Toggle ) then
- Calendar_Toggle();
- end
- end
- function ToggleGuildFrame()
- local factionGroup = UnitFactionGroup("player");
- if (IsBlizzCon() or factionGroup == "Neutral") then
- return;
- end
- if ( IsTrialAccount() ) then
- UIErrorsFrame:AddMessage(ERR_RESTRICTED_ACCOUNT, 1.0, 0.1, 0.1, 1.0);
- return;
- end
- if ( IsInGuild() ) then
- GuildFrame_LoadUI();
- if ( GuildFrame_Toggle ) then
- GuildFrame_Toggle();
- end
- else
- ToggleGuildFinder();
- end
- end
- function ToggleGuildFinder()
- local factionGroup = UnitFactionGroup("player");
- if (IsBlizzCon() or factionGroup == "Neutral") then
- return;
- end
- LookingForGuildFrame_LoadUI();
- if ( LookingForGuildFrame_Toggle ) then
- LookingForGuildFrame_Toggle();
- end
- end
- function ToggleLFDParentFrame()
- local factionGroup = UnitFactionGroup("player");
- if (IsBlizzCon() or factionGroup == "Neutral") then
- return;
- end
- if ( UnitLevel("player") >= SHOW_LFD_LEVEL ) then
- PVEFrame_ToggleFrame("GroupFinderFrame", LFDParentFrame);
- end
- end
- function ToggleHelpFrame()
- if ( HelpFrame:IsShown() ) then
- HideUIPanel(HelpFrame);
- else
- StaticPopup_Hide("HELP_TICKET");
- StaticPopup_Hide("HELP_TICKET_ABANDON_CONFIRM");
- StaticPopup_Hide("GM_RESPONSE_NEED_MORE_HELP");
- StaticPopup_Hide("GM_RESPONSE_RESOLVE_CONFIRM");
- StaticPopup_Hide("GM_RESPONSE_MUST_RESOLVE_RESPONSE");
- HelpFrame_ShowFrame();
- end
- end
- function ToggleRaidFrame()
- local factionGroup = UnitFactionGroup("player");
- if (IsBlizzCon() or factionGroup == "Neutral") then
- return;
- end
- ToggleFriendsFrame(4);
- end
- function ToggleRaidBrowser()
- local factionGroup = UnitFactionGroup("player");
- if (IsBlizzCon() or factionGroup == "Neutral") then
- return;
- end
- if ( RaidBrowserFrame:IsShown() ) then
- HideUIPanel(RaidBrowserFrame);
- else
- ShowUIPanel(RaidBrowserFrame);
- end
- end
- function ToggleEncounterJournal()
- if (IsBlizzCon()) then
- return;
- end
- if ( not EncounterJournal ) then
- EncounterJournal_LoadUI();
- end
- if ( EncounterJournal ) then
- ToggleFrame(EncounterJournal);
- end
- end
- function TogglePetJournal(whichFrame)
- if ( not PetJournalParent ) then
- PetJournal_LoadUI();
- end
- if ( PetJournalParent ) then
- ToggleFrame(PetJournalParent);
- end
- if (whichFrame and PetJournalParent:IsShown()) then
- PetJournalParent_SetTab(PetJournalParent, whichFrame);
- end
- end
- function TogglePVPUI()
- if (IsBlizzCon()) then
- return;
- end
- if (not PVPUIFrame) then
- PVP_LoadUI();
- end
- if ( UnitLevel("player") >= SHOW_PVP_LEVEL and not IsPlayerNeutral()) then
- PVPUIFrame_ToggleFrame()
- end
- end
- function InspectUnit(unit)
- if (IsBlizzCon()) then
- return;
- end
- InspectFrame_LoadUI();
- if ( InspectFrame_Show ) then
- InspectFrame_Show(unit);
- end
- end
- -- UIParent_OnEvent --
- function UIParent_OnEvent(self, event, ...)
- local arg1, arg2, arg3, arg4, arg5, arg6 = ...;
- if ( event == "CURRENT_SPELL_CAST_CHANGED" and #StaticPopup_DisplayedFrames > 0 ) then
- if ( arg1 ) then
- StaticPopup_Hide("BIND_ENCHANT");
- StaticPopup_Hide("REPLACE_ENCHANT");
- end
- StaticPopup_Hide("TRADE_REPLACE_ENCHANT");
- StaticPopup_Hide("END_BOUND_TRADEABLE");
- elseif ( event == "VARIABLES_LOADED" ) then
- LocalizeFrames();
- if ( WorldStateFrame_CanShowBattlefieldMinimap() ) then
- if ( not BattlefieldMinimap ) then
- BattlefieldMinimap_LoadUI();
- end
- BattlefieldMinimap:Show();
- end
- if ( not TimeManagerFrame and GetCVar("timeMgrAlarmEnabled") == "1" ) then
- -- We have to load the time manager here if the alarm is enabled because the alarm can go off
- -- even if the clock is not shown. WorldFrame_OnUpdate handles alarm checking while the clock
- -- is hidden.
- TimeManager_LoadUI();
- end
- local lastTalkedToGM = GetCVar("lastTalkedToGM");
- if ( lastTalkedToGM ~= "" ) then
- GMChatFrame_LoadUI();
- GMChatFrame:Show()
- local info = ChatTypeInfo["WHISPER"];
- GMChatFrame:AddMessage(format(GM_CHAT_LAST_SESSION, "|TInterface\\ChatFrame\\UI-ChatIcon-Blizz:12:20:0:0:32:16:4:28:0:16|t "..
- "|HplayerGM:"..lastTalkedToGM.."|h".."["..lastTalkedToGM.."]".."|h"), info.r, info.g, info.b, info.id);
- GMChatFrameEditBox:SetAttribute("tellTarget", lastTalkedToGM);
- GMChatFrameEditBox:SetAttribute("chatType", "WHISPER");
- end
- TargetFrame_OnVariablesLoaded();
- elseif ( event == "PLAYER_LOGIN" ) then
- TimeManager_LoadUI();
- -- You can override this if you want a Combat Log replacement
- CombatLog_LoadUI();
- elseif ( event == "PLAYER_DEAD" ) then
- if ( not StaticPopup_Visible("DEATH") ) then
- CloseAllWindows(1);
- end
- if ( GetReleaseTimeRemaining() > 0 or GetReleaseTimeRemaining() == -1 ) then
- StaticPopup_Show("DEATH");
- end
- elseif ( event == "SELF_RES_SPELL_CHANGED" ) then
- if ( StaticPopup_Visible("DEATH") ) then
- StaticPopup_Show("DEATH"); --If we're already showing a death prompt, we should refresh it.
- end
- elseif ( event == "PLAYER_ALIVE" or event == "RAISED_AS_GHOUL" ) then
- StaticPopup_Hide("DEATH");
- StaticPopup_Hide("RESURRECT_NO_SICKNESS");
- if ( UnitIsGhost("player") ) then
- GhostFrame:Show();
- else
- GhostFrame:Hide();
- end
- elseif ( event == "PLAYER_UNGHOST" ) then
- StaticPopup_Hide("RESURRECT");
- StaticPopup_Hide("RESURRECT_NO_SICKNESS");
- StaticPopup_Hide("RESURRECT_NO_TIMER");
- StaticPopup_Hide("SKINNED");
- StaticPopup_Hide("SKINNED_REPOP");
- GhostFrame:Hide();
- elseif ( event == "RESURRECT_REQUEST" ) then
- ShowResurrectRequest(arg1);
- elseif ( event == "PLAYER_SKINNED" ) then
- StaticPopup_Hide("RESURRECT");
- StaticPopup_Hide("RESURRECT_NO_SICKNESS");
- StaticPopup_Hide("RESURRECT_NO_TIMER");
- --[[
- if (arg1 == 1) then
- StaticPopup_Show("SKINNED_REPOP");
- else
- StaticPopup_Show("SKINNED");
- end
- ]]
- UIErrorsFrame:AddMessage(DEATH_CORPSE_SKINNED, 1.0, 0.1, 0.1, 1.0);
- elseif ( event == "TRADE_REQUEST" ) then
- StaticPopup_Show("TRADE", arg1);
- elseif ( event == "CHANNEL_INVITE_REQUEST" ) then
- local dialog = StaticPopup_Show("CHAT_CHANNEL_INVITE", arg1, arg2);
- if ( dialog ) then
- dialog.data = arg1;
- end
- elseif ( event == "CHANNEL_PASSWORD_REQUEST" ) then
- local dialog = StaticPopup_Show("CHAT_CHANNEL_PASSWORD", arg1);
- if ( dialog ) then
- dialog.data = arg1;
- end
- elseif ( event == "PARTY_INVITE_REQUEST" ) then
- -- if there's a role, it's an LFG invite
- if ( arg2 or arg3 or arg4 ) then
- StaticPopupSpecial_Show(LFGInvitePopup);
- LFGInvitePopup_Update(arg1, arg2, arg3, arg4);
- elseif ( arg5 ) then --It's a X-realm invite
- StaticPopup_Show("PARTY_INVITE_XREALM", arg1);
- else
- StaticPopup_Show("PARTY_INVITE", arg1);
- end
- elseif ( event == "PARTY_INVITE_CANCEL" ) then
- StaticPopup_Hide("PARTY_INVITE");
- StaticPopup_Hide("PARTY_INVITE_XREALM");
- StaticPopupSpecial_Hide(LFGInvitePopup);
- elseif ( event == "GUILD_INVITE_REQUEST" ) then
- StaticPopup_Show("GUILD_INVITE", arg1, arg2);
- elseif ( event == "GUILD_INVITE_CANCEL" ) then
- StaticPopup_Hide("GUILD_INVITE");
- elseif ( event == "ARENA_TEAM_INVITE_REQUEST" ) then
- StaticPopup_Show("ARENA_TEAM_INVITE", arg1, arg2);
- elseif ( event == "ARENA_TEAM_INVITE_CANCEL" ) then
- StaticPopup_Hide("ARENA_TEAM_INVITE");
- elseif ( event == "PLAYER_CAMPING" ) then
- StaticPopup_Show("CAMP");
- elseif ( event == "PLAYER_QUITING" ) then
- StaticPopup_Show("QUIT");
- elseif ( event == "LOGOUT_CANCEL" ) then
- StaticPopup_Hide("CAMP");
- StaticPopup_Hide("QUIT");
- elseif ( event == "LOOT_BIND_CONFIRM" ) then
- local texture, item, quantity, quality, locked = GetLootSlotInfo(arg1);
- local dialog = StaticPopup_Show("LOOT_BIND", ITEM_QUALITY_COLORS[quality].hex..item.."|r");
- if ( dialog ) then
- dialog.data = arg1;
- end
- elseif ( event == "EQUIP_BIND_CONFIRM" ) then
- StaticPopup_Hide("AUTOEQUIP_BIND");
- local dialog = StaticPopup_Show("EQUIP_BIND");
- if ( dialog ) then
- dialog.data = arg1;
- end
- elseif ( event == "AUTOEQUIP_BIND_CONFIRM" ) then
- StaticPopup_Hide("EQUIP_BIND");
- local dialog = StaticPopup_Show("AUTOEQUIP_BIND");
- if ( dialog ) then
- dialog.data = arg1;
- end
- elseif ( event == "USE_BIND_CONFIRM" ) then
- StaticPopup_Show("USE_BIND");
- elseif ( event == "CONFIRM_BEFORE_USE" ) then
- StaticPopup_Show("CONFIM_BEFORE_USE");
- elseif ( event == "DELETE_ITEM_CONFIRM" ) then
- -- Check quality
- if ( arg2 >= 3 ) then
- if (arg3 == 4) then -- quest item?
- StaticPopup_Show("DELETE_GOOD_QUEST_ITEM", arg1);
- else
- StaticPopup_Show("DELETE_GOOD_ITEM", arg1);
- end
- else
- if (arg3 == 4) then -- quest item?
- StaticPopup_Show("DELETE_QUEST_ITEM", arg1);
- else
- StaticPopup_Show("DELETE_ITEM", arg1);
- end
- end
- elseif ( event == "QUEST_ACCEPT_CONFIRM" ) then
- local numEntries, numQuests = GetNumQuestLogEntries();
- if( numQuests >= MAX_QUESTS) then
- StaticPopup_Show("QUEST_ACCEPT_LOG_FULL", arg1, arg2);
- else
- StaticPopup_Show("QUEST_ACCEPT", arg1, arg2);
- end
- elseif ( event =="QUEST_LOG_UPDATE" or event == "UNIT_QUEST_LOG_CHANGED" ) then
- local frameName = StaticPopup_Visible("QUEST_ACCEPT_LOG_FULL");
- if( frameName ) then
- local numEntries, numQuests = GetNumQuestLogEntries();
- local button = _G[frameName.."Button1"];
- if( numQuests < MAX_QUESTS ) then
- button:Enable();
- else
- button:Disable();
- end
- end
- elseif ( event == "CURSOR_UPDATE" ) then
- if ( not CursorHasItem() ) then
- StaticPopup_Hide("EQUIP_BIND");
- StaticPopup_Hide("AUTOEQUIP_BIND");
- end
- elseif ( event == "PLAYER_ENTERING_WORLD" ) then
- -- Get multi-actionbar states (before CloseAllWindows() since that may be hooked by AddOns)
- -- We don't want to call this, as the values GetActionBarToggles() returns are incorrect if it's called before the client mirrors SetActionBarToggles values from the server.
- -- SHOW_MULTI_ACTIONBAR_1, SHOW_MULTI_ACTIONBAR_2, SHOW_MULTI_ACTIONBAR_3, SHOW_MULTI_ACTIONBAR_4 = GetActionBarToggles();
- MultiActionBar_Update();
- -- Close any windows that were previously open
- CloseAllWindows(1);
- -- Until PVPFrame is checked in, this is placed here.
- for i=1, MAX_ARENA_TEAMS do
- GetArenaTeam(i);
- end
- VoiceChat_Toggle();
- UpdateMicroButtons();
- -- Fix for Bug 124392
- StaticPopup_Hide("LEVEL_GRANT_PROPOSED");
- StaticPopup_Hide("CONFIRM_LEAVE_BATTLEFIELD");
-
- local _, instanceType = IsInInstance();
- if ( instanceType == "arena" or instanceType == "pvp") then
- Arena_LoadUI();
- end
- if ( UnitIsGhost("player") ) then
- GhostFrame:Show();
- else
- GhostFrame:Hide();
- end
- if ( GetReleaseTimeRemaining() > 0 or GetReleaseTimeRemaining() == -1 ) then
- StaticPopup_Show("DEATH");
- end
- elseif ( event == "GROUP_ROSTER_UPDATE" ) then
- -- Hide/Show party member frames
- RaidOptionsFrame_UpdatePartyFrames();
- if ( not IsInGroup(LE_PARTY_CATEGORY_INSTANCE) ) then
- StaticPopup_Hide("CONFIRM_LEAVE_INSTANCE_PARTY");
- end
- elseif ( event == "MIRROR_TIMER_START" ) then
- MirrorTimer_Show(arg1, arg2, arg3, arg4, arg5, arg6);
- elseif ( event == "DUEL_REQUESTED" ) then
- StaticPopup_Show("DUEL_REQUESTED", arg1);
- elseif ( event == "DUEL_OUTOFBOUNDS" ) then
- StaticPopup_Show("DUEL_OUTOFBOUNDS");
- elseif ( event == "DUEL_INBOUNDS" ) then
- StaticPopup_Hide("DUEL_OUTOFBOUNDS");
- elseif ( event == "DUEL_FINISHED" ) then
- StaticPopup_Hide("DUEL_REQUESTED");
- StaticPopup_Hide("DUEL_OUTOFBOUNDS");
- elseif ( event == "PET_BATTLE_PVP_DUEL_REQUESTED" ) then
- StaticPopup_Show("PET_BATTLE_PVP_DUEL_REQUESTED", arg1);
- elseif ( event == "PET_BATTLE_PVP_DUEL_REQUEST_CANCEL" ) then
- StaticPopup_Hide("PET_BATTLE_PVP_DUEL_REQUESTED");
- elseif ( event == "PET_BATTLE_QUEUE_PROPOSE_MATCH" ) then
- PlaySound("UI_PetBattles_PVP_ThroughQueue");
- StaticPopupSpecial_Show(PetBattleQueueReadyFrame);
- elseif ( event == "PET_BATTLE_QUEUE_PROPOSAL_DECLINED" or event == "PET_BATTLE_QUEUE_PROPOSAL_ACCEPTED" ) then
- StaticPopupSpecial_Hide(PetBattleQueueReadyFrame);
- elseif ( event == "TRADE_REQUEST_CANCEL" ) then
- StaticPopup_Hide("TRADE");
- elseif ( event == "CONFIRM_XP_LOSS" ) then
- local resSicknessTime = GetResSicknessDuration();
- if ( resSicknessTime ) then
- local dialog = nil;
- if (UnitLevel("player") <= 10) then
- dialog = StaticPopup_Show("XP_LOSS_NO_DURABILITY", resSicknessTime);
- else
- dialog = StaticPopup_Show("XP_LOSS", resSicknessTime);
- end
- if ( dialog ) then
- dialog.data = resSicknessTime;
- end
- else
- local dialog = nil;
- if (UnitLevel("player") <= 10) then
- dialog = StaticPopup_Show("XP_LOSS_NO_SICKNESS_NO_DURABILITY");
- else
- dialog = StaticPopup_Show("XP_LOSS_NO_SICKNESS");
- end
- if ( dialog ) then
- dialog.data = 1;
- end
- end
- HideUIPanel(GossipFrame);
- elseif ( event == "CORPSE_IN_RANGE" ) then
- StaticPopup_Show("RECOVER_CORPSE");
- elseif ( event == "CORPSE_IN_INSTANCE" ) then
- StaticPopup_Show("RECOVER_CORPSE_INSTANCE");
- elseif ( event == "CORPSE_OUT_OF_RANGE" ) then
- StaticPopup_Hide("RECOVER_CORPSE");
- StaticPopup_Hide("RECOVER_CORPSE_INSTANCE");
- StaticPopup_Hide("XP_LOSS");
- elseif ( event == "AREA_SPIRIT_HEALER_IN_RANGE" ) then
- AcceptAreaSpiritHeal();
- StaticPopup_Show("AREA_SPIRIT_HEAL");
- elseif ( event == "AREA_SPIRIT_HEALER_OUT_OF_RANGE" ) then
- StaticPopup_Hide("AREA_SPIRIT_HEAL");
- elseif ( event == "BIND_ENCHANT" ) then
- StaticPopup_Show("BIND_ENCHANT");
- elseif ( event == "REPLACE_ENCHANT" ) then
- StaticPopup_Show("REPLACE_ENCHANT", arg1, arg2);
- elseif ( event == "TRADE_REPLACE_ENCHANT" ) then
- StaticPopup_Show("TRADE_REPLACE_ENCHANT", arg1, arg2);
- elseif ( event == "END_BOUND_TRADEABLE" ) then
- local dialog = StaticPopup_Show("END_BOUND_TRADEABLE", nil, nil, arg1);
- elseif ( event == "MACRO_ACTION_BLOCKED" or event == "ADDON_ACTION_BLOCKED" ) then
- if ( not INTERFACE_ACTION_BLOCKED_SHOWN ) then
- local info = ChatTypeInfo["SYSTEM"];
- DEFAULT_CHAT_FRAME:AddMessage(INTERFACE_ACTION_BLOCKED, info.r, info.g, info.b, info.id);
- INTERFACE_ACTION_BLOCKED_SHOWN = true;
- end
- elseif ( event == "MACRO_ACTION_FORBIDDEN" ) then
- StaticPopup_Show("MACRO_ACTION_FORBIDDEN");
- elseif ( event == "ADDON_ACTION_FORBIDDEN" ) then
- local dialog = StaticPopup_Show("ADDON_ACTION_FORBIDDEN", arg1);
- if ( dialog ) then
- dialog.data = arg1;
- end
- elseif ( event == "PLAYER_CONTROL_LOST" ) then
- if ( UnitOnTaxi("player") ) then
- return;
- end
- CloseAllWindows_WithExceptions();
-
- --[[
- -- Disable all microbuttons except the main menu
- SetDesaturation(MicroButtonPortrait, 1);
-
- Designers previously wanted these disabled when feared, they seem to have changed their minds
- CharacterMicroButton:Disable();
- SpellbookMicroButton:Disable();
- TalentMicroButton:Disable();
- QuestLogMicroButton:Disable();
- GuildMicroButton:Disable();
- WorldMapMicroButton:Disable();
- ]]
- UIParent.isOutOfControl = 1;
- elseif ( event == "PLAYER_CONTROL_GAINED" ) then
- --[[
- -- Enable all microbuttons
- SetDesaturation(MicroButtonPortrait, nil);
- CharacterMicroButton:Enable();
- SpellbookMicroButton:Enable();
- TalentMicroButton:Enable();
- QuestLogMicroButton:Enable();
- GuildMicroButton:Enable();
- WorldMapMicroButton:Enable();
- ]]
- UIParent.isOutOfControl = nil;
- elseif ( event == "START_LOOT_ROLL" ) then
- GroupLootFrame_OpenNewFrame(arg1, arg2);
- elseif ( event == "CONFIRM_LOOT_ROLL" ) then
- local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo(arg1);
- local dialog = StaticPopup_Show("CONFIRM_LOOT_ROLL", ITEM_QUALITY_COLORS[quality].hex..name.."|r");
- if ( dialog ) then
- dialog.text:SetFormattedText(arg3, ITEM_QUALITY_COLORS[quality].hex..name.."|r");
- StaticPopup_Resize(dialog, "CONFIRM_LOOT_ROLL");
- dialog.data = arg1;
- dialog.data2 = arg2;
- end
- elseif ( event == "MISSING_OUT_ON_LOOT" ) then
- MissingLootFrame_Show();
- elseif ( event == "SPELL_CONFIRMATION_PROMPT" ) then
- local spellID, confirmType, text, duration, currencyID = ...;
- if ( confirmType == CONFIRMATION_PROMPT_BONUS_ROLL ) then
- BonusRollFrame_StartBonusRoll(spellID, text, duration, currencyID);
- else
- StaticPopup_Show("SPELL_CONFIRMATION_PROMPT", text, duration, spellID);
- end
- elseif ( event == "SPELL_CONFIRMATION_TIMEOUT" ) then
- local spellID, confirmType = ...;
- if ( confirmType == CONFIRMATION_PROMPT_BONUS_ROLL ) then
- BonusRollFrame_CloseBonusRoll();
- else
- StaticPopup_Hide("SPELL_CONFIRMATION_PROMPT", spellID);
- end
- elseif ( event == "CONFIRM_DISENCHANT_ROLL" ) then
- local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo(arg1);
- local dialog = StaticPopup_Show("CONFIRM_LOOT_ROLL", ITEM_QUALITY_COLORS[quality].hex..name.."|r");
- if ( dialog ) then
- dialog.text:SetFormattedText(LOOT_NO_DROP_DISENCHANT, ITEM_QUALITY_COLORS[quality].hex..name.."|r");
- StaticPopup_Resize(dialog, "CONFIRM_LOOT_ROLL");
- dialog.data = arg1;
- dialog.data2 = arg2;
- end
- elseif ( event == "INSTANCE_BOOT_START" ) then
- StaticPopup_Show("INSTANCE_BOOT");
- elseif ( event == "INSTANCE_BOOT_STOP" ) then
- StaticPopup_Hide("INSTANCE_BOOT");
- elseif ( event == "INSTANCE_LOCK_START" ) then
- StaticPopup_Show("INSTANCE_LOCK", nil, nil, true);
- elseif ( event == "INSTANCE_LOCK_STOP" ) then
- StaticPopup_Hide("INSTANCE_LOCK");
- elseif ( event == "INSTANCE_LOCK_WARNING" ) then
- StaticPopup_Show("INSTANCE_LOCK", nil, nil, false);
- elseif ( event == "CONFIRM_TALENT_WIPE" ) then
- HideUIPanel(GossipFrame);
- StaticPopupDialogs["CONFIRM_TALENT_WIPE"].text = _G["CONFIRM_TALENT_WIPE_"..arg2];
- local dialog = StaticPopup_Show("CONFIRM_TALENT_WIPE");
- if ( dialog ) then
- MoneyFrame_Update(dialog:GetName().."MoneyFrame", arg1);
- -- open the talent UI to the player's active talent group...just so the player knows
- -- exactly which talent spec he is wiping
- -- TalentFrame_LoadUI();
- -- if ( PlayerTalentFrame_Open ) then
- -- PlayerTalentFrame_Open(GetActiveSpecGroup());
- -- end
- end
- elseif ( event == "CONFIRM_BINDER" ) then
- StaticPopup_Show("CONFIRM_BINDER", arg1);
- elseif ( event == "CONFIRM_SUMMON" ) then
- StaticPopup_Show("CONFIRM_SUMMON");
- elseif ( event == "CANCEL_SUMMON" ) then
- StaticPopup_Hide("CONFIRM_SUMMON");
- elseif ( event == "BILLING_NAG_DIALOG" ) then
- StaticPopup_Show("BILLING_NAG", arg1);
- elseif ( event == "IGR_BILLING_NAG_DIALOG" ) then
- StaticPopup_Show("IGR_BILLING_NAG");
- elseif ( event == "GOSSIP_CONFIRM" ) then
- if ( arg3 > 0 ) then
- StaticPopupDialogs["GOSSIP_CONFIRM"].hasMoneyFrame = 1;
- else
- StaticPopupDialogs["GOSSIP_CONFIRM"].hasMoneyFrame = nil;
- end
- local dialog = StaticPopup_Show("GOSSIP_CONFIRM", arg2);
- if ( dialog ) then
- dialog.data = arg1;
- if ( arg3 > 0 ) then
- MoneyFrame_Update(dialog:GetName().."MoneyFrame", arg3);
- end
- end
- elseif ( event == "GOSSIP_ENTER_CODE" ) then
- local dialog = StaticPopup_Show("GOSSIP_ENTER_CODE");
- if ( dialog ) then
- dialog.data = arg1;
- end
- elseif ( event == "GOSSIP_CONFIRM_CANCEL" or event == "GOSSIP_CLOSED" ) then
- StaticPopup_Hide("GOSSIP_CONFIRM");
- StaticPopup_Hide("GOSSIP_ENTER_CODE");
-
- --Events for handling Auction UI
- elseif ( event == "AUCTION_HOUSE_SHOW" ) then
- AuctionFrame_LoadUI();
- if ( AuctionFrame_Show ) then
- AuctionFrame_Show();
- end
- elseif ( event == "AUCTION_HOUSE_CLOSED" ) then
- if ( AuctionFrame_Hide ) then
- AuctionFrame_Hide();
- end
- elseif ( event == "AUCTION_HOUSE_DISABLED" ) then
- StaticPopup_Show("AUCTION_HOUSE_DISABLED");
- -- Events for trainer UI handling
- elseif ( event == "TRAINER_SHOW" ) then
- ClassTrainerFrame_LoadUI();
- if ( ClassTrainerFrame_Show ) then
- ClassTrainerFrame_Show();
- end
- elseif ( event == "TRAINER_CLOSED" ) then
- if ( ClassTrainerFrame_Hide ) then
- ClassTrainerFrame_Hide();
- end
- -- Events for trade skill UI handling
- elseif ( event == "TRADE_SKILL_SHOW" ) then
- TradeSkillFrame_LoadUI();
- if ( TradeSkillFrame_Show ) then
- TradeSkillFrame_Show();
- end
- elseif ( event == "TRADE_SKILL_CLOSE" ) then
- if ( TradeSkillFrame_Hide ) then
- TradeSkillFrame_Hide();
- end
- -- Event for item socketing handling
- elseif ( event == "SOCKET_INFO_UPDATE" ) then
- ItemSocketingFrame_LoadUI();
- ItemSocketingFrame_Update();
- ShowUIPanel(ItemSocketingFrame);
- -- Event for BarberShop handling
- elseif ( event == "BARBER_SHOP_OPEN" ) then
- BarberShopFrame_LoadUI();
- if ( BarberShopFrame ) then
- ShowUIPanel(BarberShopFrame);
- end
- elseif ( event == "BARBER_SHOP_CLOSE" ) then
- if ( BarberShopFrame and BarberShopFrame:IsVisible() ) then
- BarberShopFrame:Hide();
- end
-
- -- Event for guildbank handling
- elseif ( event == "GUILDBANKFRAME_OPENED" ) then
- GuildBankFrame_LoadUI();
- if ( GuildBankFrame ) then
- ShowUIPanel(GuildBankFrame);
- if ( not GuildBankFrame:IsVisible() ) then
- CloseGuildBankFrame();
- end
- end
- elseif ( event == "GUILDBANKFRAME_CLOSED" ) then
- if ( GuildBankFrame ) then
- HideUIPanel(GuildBankFrame);
- end
- -- Event for barbershop handling
- elseif ( event == "BARBER_SHOP_OPEN" ) then
- BarberShopFrame_LoadUI();
- if ( BarberShopFrame ) then
- ShowUIPanel(BarberShopFrame);
- end
- elseif ( event == "BARBER_SHOP_CLOSE" ) then
- BarberShopFrame_LoadUI();
- if ( BarberShopFrame ) then
- HideUIPanel(BarberShopFrame);
- end
-
- -- Events for achievement handling
- elseif ( event == "ACHIEVEMENT_EARNED" ) then
- -- if ( not AchievementFrame ) then
- -- AchievementFrame_LoadUI();
- -- AchievementAlertFrame_ShowAlert(...);
- -- end
- -- self:UnregisterEvent(event);
- -- Display instance reset info
- elseif ( event == "RAID_INSTANCE_WELCOME" ) then
- local dungeonName = arg1;
- local lockExpireTime = arg2;
- local locked = arg3;
- local extended = arg4;
- local message;
- if ( locked == 0 ) then
- message = format(RAID_INSTANCE_WELCOME, dungeonName, SecondsToTime(lockExpireTime, nil, 1))
- else
- if ( lockExpireTime == 0 ) then
- message = format(RAID_INSTANCE_WELCOME_EXTENDED, dungeonName);
- else
- if ( extended == 0 ) then
- message = format(RAID_INSTANCE_WELCOME_LOCKED, dungeonName, SecondsToTime(lockExpireTime, nil, 1));
- else
- message = format(RAID_INSTANCE_WELCOME_LOCKED_EXTENDED, dungeonName, SecondsToTime(lockExpireTime, nil, 1));
- end
- end
- end
- local info = ChatTypeInfo["SYSTEM"];
- DEFAULT_CHAT_FRAME:AddMessage(message, info.r, info.g, info.b, info.id);
-
- -- Events for taxi benchmarking
- elseif ( event == "ENABLE_TAXI_BENCHMARK" ) then
- if ( not FramerateText:IsShown() ) then
- ToggleFramerate(true);
- end
- local info = ChatTypeInfo["SYSTEM"];
- DEFAULT_CHAT_FRAME:AddMessage(BENCHMARK_TAXI_MODE_ON, info.r, info.g, info.b, info.id);
- elseif ( event == "DISABLE_TAXI_BENCHMARK" ) then
- if ( FramerateText.benchmark ) then
- ToggleFramerate();
- end
- local info = ChatTypeInfo["SYSTEM"];
- DEFAULT_CHAT_FRAME:AddMessage(BENCHMARK_TAXI_MODE_OFF, info.r, info.g, info.b, info.id);
-
- -- Push to talk
- elseif ( event == "VOICE_PUSH_TO_TALK_START" and GetVoiceCurrentSessionID() ) then
- if ( GetCVarBool("PushToTalkSound") ) then
- PlaySound("VoiceChatOn");
- end
- -- Animate the player frame speaker even if not broadcasting
- if ( GetCVar("VoiceChatMode") == "0" ) then
- UIFrameFadeIn(PlayerSpeakerFrame, 0.2, PlayerSpeakerFrame:GetAlpha(), 1);
- end
- elseif ( event == "VOICE_PUSH_TO_TALK_STOP" ) then
- if ( GetCVarBool("PushToTalkSound") and GetVoiceCurrentSessionID() ) then
- PlaySound("VoiceChatOff");
- end
- -- Stop Animation
- if ( GetCVar("VoiceChatMode") == "0" and PlayerSpeakerFrame:GetAlpha() > 0 ) then
- UIFrameFadeOut(PlayerSpeakerFrame, 0.2, PlayerSpeakerFrame:GetAlpha(), 0);
- end
- elseif ( event == "LEVEL_GRANT_PROPOSED" ) then
- StaticPopup_Show("LEVEL_GRANT_PROPOSED", arg1);
- elseif ( event == "CHAT_MSG_WHISPER" and arg6 == "GM" ) then --GMChatUI
- GMChatFrame_LoadUI(event, ...);
- elseif ( event == "WOW_MOUSE_NOT_FOUND" ) then
- StaticPopup_Show("WOW_MOUSE_NOT_FOUND");
- elseif ( event == "TALENTS_INVOLUNTARILY_RESET" ) then
- if ( arg1 ) then
- StaticPopup_Show("TALENTS_INVOLUNTARILY_RESET_PET");
- else
- StaticPopup_Show("TALENTS_INVOLUNTARILY_RESET");
- end
-
- -- Events for Reforging UI handling
- elseif ( event == "FORGE_MASTER_OPENED" ) then
- Reforging_LoadUI();
- if ( ReforgingFrame_Show ) then
- ReforgingFrame_Show();
- end
- elseif ( event == "FORGE_MASTER_CLOSED" ) then
- if ( ReforgingFrame_Hide ) then
- ReforgingFrame_Hide();
- end
-
- -- Events for Archaeology
- elseif ( event == "ARCHAEOLOGY_TOGGLE" ) then
- ArchaeologyFrame_LoadUI();
- if ( ArchaeologyFrame_Show and not ArchaeologyFrame:IsShown()) then
- ArchaeologyFrame_Show();
- elseif ( ArchaeologyFrame_Hide ) then
- ArchaeologyFrame_Hide();
- end
-
- -- Events for Transmogrify UI handling
- elseif ( event == "TRANSMOGRIFY_OPEN" ) then
- ItemAlteration_LoadUI();
- if ( TransmogrifyFrame_Show ) then
- TransmogrifyFrame_Show();
- end
- elseif ( event == "TRANSMOGRIFY_CLOSE" ) then
- if ( TransmogrifyFrame_Hide ) then
- TransmogrifyFrame_Hide();
- end
- -- Events for Void Storage UI handling
- elseif ( event == "VOID_STORAGE_OPEN" ) then
- VoidStorage_LoadUI();
- if ( VoidStorageFrame_Show ) then
- VoidStorageFrame_Show();
- end
- elseif ( event == "VOID_STORAGE_CLOSE" ) then
- if ( VoidStorageFrame_Hide ) then
- VoidStorageFrame_Hide();
- end
-
- --Events for Trial caps
- elseif ( event == "TRIAL_CAP_REACHED_MONEY" ) then
- TrialAccountCapReached_Inform("money");
- elseif ( event == "TRIAL_CAP_REACHED_LEVEL" ) then
- TrialAccountCapReached_Inform("level");
-
- elseif( event == "SOR_START_EXPERIENCE_INCOMPLETE" ) then
- StaticPopup_Show("ERR_SOR_STARTING_EXPERIENCE_INCOMPLETE");
-
- -- Events for Black Market UI handling
- elseif ( event == "BLACK_MARKET_OPEN" ) then
- BlackMarket_LoadUI();
- if ( BlackMarketFrame_Show ) then
- BlackMarketFrame_Show();
- end
- elseif ( event == "BLACK_MARKET_CLOSE" ) then
- if ( BlackMarketFrame_Hide ) then
- BlackMarketFrame_Hide();
- end
- -- Events for Item Upgrading
- elseif ( event == "ITEM_UPGRADE_MASTER_OPENED" ) then
- ItemUpgrade_LoadUI();
- if ( ItemUpgradeFrame_Show ) then
- ItemUpgradeFrame_Show();
- end
- elseif ( event == "ITEM_UPGRADE_MASTER_CLOSED" ) then
- if ( ItemUpgradeFrame_Hide ) then
- ItemUpgradeFrame_Hide();
- end
- -- Events for Pet Journal
- elseif ( event == "PET_JOURNAL_NEW_BATTLE_SLOT" ) then
- CompanionsMicroButtonAlert:Show();
- MicroButtonPulse(CompanionsMicroButton);
-
- -- Quest Choice trigger event
-
- elseif (event == "QUEST_CHOICE_UPDATE") then
- QuestChoice_LoadUI();
- if ( QuestChoiceFrame_Show) then
- QuestChoiceFrame_Show();
- end
- end
- end
- -- Frame Management --
- -- UIPARENT_MANAGED_FRAME_POSITIONS stores all the frames that have positioning dependencies based on other frames.
- -- UIPARENT_MANAGED_FRAME_POSITIONS["FRAME"] = {
- --Note: this is out of date and there are several more options now.
- -- none = This value is used if no dependent frames are shown
- -- reputation = This is the offset used if the reputation watch bar is shown
- -- anchorTo = This is the object that the stored frame is anchored to
- -- point = This is the point on the frame used as the anchor
- -- rpoint = This is the point on the "anchorTo" frame that the stored frame is anchored to
- -- bottomEither = This offset is used if either bottom multibar is shown
- -- bottomLeft
- -- var = If this is set use _G[varName] = value instead of setpoint
- -- };
- -- some standard offsets
- local actionBarOffset = 45;
- local menuBarTop = 55;
- local overrideActionBarTop = 40;
- local petBattleTop = 60;
- function UpdateMenuBarTop ()
- --Determines the optimal magic number based on resolution and action bar status.
- menuBarTop = 55;
- local width, height = string.match((({GetScreenResolutions()})[GetCurrentResolution()] or ""), "(%d+).-(%d+)");
- if ( tonumber(width) / tonumber(height ) > 4/3 ) then
- --Widescreen resolution
- menuBarTop = 75;
- end
- end
- UIPARENT_MANAGED_FRAME_POSITIONS = {
- --Items with baseY set to "true" are positioned based on the value of menuBarTop and their offset needs to be repeatedly evaluated as menuBarTop can change.
- --"yOffset" gets added to the value of "baseY", which is used for values based on menuBarTop.
- ["MultiBarBottomLeft"] = {baseY = 17, reputation = 1, maxLevel = 1, anchorTo = "ActionButton1", point = "BOTTOMLEFT", rpoint = "TOPLEFT"};
- ["MultiBarRight"] = {baseY = 98, reputation = 1, anchorTo = "UIParent", point = "BOTTOMRIGHT", rpoint = "BOTTOMRIGHT"};
- ["VoiceChatTalkers"] = {baseY = true, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, reputation = 1};
- ["GroupLootContainer"] = {baseY = true, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1};
- ["MissingLootFrame"] = {baseY = true, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1};
- ["TutorialFrameAlertButton"] = {baseY = true, yOffset = -10, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, reputation = 1};
- ["FramerateLabel"] = {baseY = true, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1, playerPowerBarAlt = 1, extraActionBarFrame = 1};
- ["CastingBarFrame"] = {baseY = true, yOffset = 40, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1, tutorialAlert = 1, playerPowerBarAlt = 1, extraActionBarFrame = 1};
- ["PlayerPowerBarAlt"] = {baseY = true, yOffset = 40, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1, tutorialAlert = 1, extraActionBarFrame = 1};
- ["ExtraActionBarFrame"] = {baseY = true, yOffset = 40, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1, tutorialAlert = 1};
- ["ChatFrame1"] = {baseY = true, yOffset = 40, bottomLeft = actionBarOffset-8, justBottomRightAndStance = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1, maxLevel = 1, point = "BOTTOMLEFT", rpoint = "BOTTOMLEFT", xOffset = 32};
- ["ChatFrame2"] = {baseY = true, yOffset = 40, bottomRight = actionBarOffset-8, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, rightLeft = -2*actionBarOffset, rightRight = -actionBarOffset, reputation = 1, maxLevel = 1, point = "BOTTOMRIGHT", rpoint = "BOTTOMRIGHT", xOffset = -32};
- ["StanceBarFrame"] = {baseY = 0, bottomLeft = actionBarOffset, reputation = 1, maxLevel = 1, anchorTo = "MainMenuBar", point = "BOTTOMLEFT", rpoint = "TOPLEFT", xOffset = 30};
- ["PossessBarFrame"] = {baseY = 0, bottomLeft = actionBarOffset, reputation = 1, maxLevel = 1, anchorTo = "MainMenuBar", point = "BOTTOMLEFT", rpoint = "TOPLEFT", xOffset = 30};
- ["MultiCastActionBarFrame"] = {baseY = 0, bottomLeft = actionBarOffset, reputation = 1, maxLevel = 1, anchorTo = "MainMenuBar", point = "BOTTOMLEFT", rpoint = "TOPLEFT", xOffset = 30};
- ["AuctionProgressFrame"] = {baseY = true, yOffset = 18, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1, tutorialAlert = 1};
-
- -- Vars
- -- These indexes require global variables of the same name to be declared. For example, if I have an index ["FOO"] then I need to make sure the global variable
- -- FOO exists before this table is constructed. The function UIParent_ManageFramePosition will use the "FOO" table index to change the value of the FOO global
- -- variable so that other modules can use the most up-to-date value of FOO without having knowledge of the UIPARENT_MANAGED_FRAME_POSITIONS table.
- ["CONTAINER_OFFSET_X"] = {baseX = 0, rightLeft = 2*actionBarOffset+3, rightRight = actionBarOffset+3, isVar = "xAxis"};
- ["CONTAINER_OFFSET_Y"] = {baseY = true, yOffset = 10, bottomEither = actionBarOffset, reputation = 1, isVar = "yAxis"};
- ["BATTLEFIELD_TAB_OFFSET_Y"] = {baseY = 210, bottomRight = actionBarOffset, reputation = 1, isVar = "yAxis"};
- ["PETACTIONBAR_YPOS"] = {baseY = 97, bottomLeft = actionBarOffset, justBottomRightAndStance = actionBarOffset, reputation = 1, maxLevel = 1, isVar = "yAxis"};
- ["MULTICASTACTIONBAR_YPOS"] = {baseY = 0, bottomLeft = actionBarOffset, reputation = 1, maxLevel = 1, isVar = "yAxis"};
- };
- -- If any Var entries in UIPARENT_MANAGED_FRAME_POSITIONS are used exclusively by addons, they should be declared here and not in one of the addon's files.
- -- The reason why is that it is possible for UIParent_ManageFramePosition to be run before the addon loads.
- BATTLEFIELD_TAB_OFFSET_Y = 0;
- -- constant offsets
- for _, data in pairs(UIPARENT_MANAGED_FRAME_POSITIONS) do
- for flag, value in pairs(data) do
- if ( flag == "reputation" ) then
- data[flag] = value * 9;
- elseif ( flag == "maxLevel" ) then
- data[flag] = value * -5;
- elseif ( flag == "pet" ) then
- data[flag] = value * 35;
- elseif ( flag == "tutorialAlert" ) then
- data[flag] = value * 35;
- end
- end
- end
- function UIParent_ManageFramePosition(index, value, yOffsetFrames, xOffsetFrames, hasBottomLeft, hasBottomRight, hasPetBar)
- local frame, xOffset, yOffset, anchorTo, point, rpoint;
- frame = _G[index];
- if ( not frame or (type(frame)=="table" and frame.ignoreFramePositionManager)) then
- return;
- end
-
- -- Always start with base as the base offset or default to zero if no "none" specified
- xOffset = 0;
- if ( value["baseX"] ) then
- xOffset = value["baseX"];
- elseif ( value["xOffset"] ) then
- xOffset = value["xOffset"];
- end
- yOffset = 0;
- if ( tonumber(value["baseY"]) ) then
- --tonumber(nil) and tonumber(boolean) evaluate as nil, tonumber(number) evaluates as a number, which evaluates as true.
- --This allows us to use the true value in baseY for flagging a frame's positioning…
Large files files are truncated, but you can click here to view the full file