PageRenderTime 55ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/FrameXML/UIParent.lua

https://bitbucket.org/Shenton/world-of-warcraft-user-interface-source
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

  1. TOOLTIP_UPDATE_TIME = 0.2;
  2. ROTATIONS_PER_SECOND = .5;
  3. BOSS_FRAME_CASTBAR_HEIGHT = 16;
  4. -- Alpha animation stuff
  5. FADEFRAMES = {};
  6. FLASHFRAMES = {};
  7. -- Pulsing stuff
  8. PULSEBUTTONS = {};
  9. -- Shine animation
  10. SHINES_TO_ANIMATE = {};
  11. -- Per panel settings
  12. UIPanelWindows = {};
  13. --Center Menu Frames
  14. UIPanelWindows["GameMenuFrame"] = { area = "center", pushable = 0, whileDead = 1 };
  15. UIPanelWindows["VideoOptionsFrame"] = { area = "center", pushable = 0, whileDead = 1 };
  16. UIPanelWindows["AudioOptionsFrame"] = { area = "center", pushable = 0, whileDead = 1 };
  17. UIPanelWindows["InterfaceOptionsFrame"] = { area = "center", pushable = 0, whileDead = 1 };
  18. UIPanelWindows["HelpFrame"] = { area = "center", pushable = 0, whileDead = 1 };
  19. -- Frames using the new Templates
  20. UIPanelWindows["CharacterFrame"] = { area = "left", pushable = 3, whileDead = 1};
  21. UIPanelWindows["SpellBookFrame"] = { area = "left", pushable = 1, whileDead = 1, width = 575, height = 545 };
  22. UIPanelWindows["TaxiFrame"] = { area = "left", pushable = 0, width = 605, height = 580 };
  23. UIPanelWindows["PVPUIFrame"] = { area = "left", pushable = 0, whileDead = 1, width = 563};
  24. UIPanelWindows["PVPBannerFrame"] = { area = "left", pushable = 1};
  25. UIPanelWindows["PetStableFrame"] = { area = "left", pushable = 0};
  26. UIPanelWindows["PVEFrame"] = { area = "left", pushable = 0, whileDead = 1, width = 563};
  27. UIPanelWindows["EncounterJournal"] = { area = "left", pushable = 0, whileDead = 1, width = 830};
  28. UIPanelWindows["PetJournalParent"] = { area = "left", pushable = 0, whileDead = 1, width = 830};
  29. UIPanelWindows["TradeFrame"] = { area = "left", pushable = 1};
  30. UIPanelWindows["LootFrame"] = { area = "left", pushable = 7};
  31. UIPanelWindows["MerchantFrame"] = { area = "left", pushable = 0};
  32. UIPanelWindows["TabardFrame"] = { area = "left", pushable = 0};
  33. UIPanelWindows["PVPBannerFrame"] = { area = "left", pushable = 1};
  34. UIPanelWindows["MailFrame"] = { area = "left", pushable = 0};
  35. UIPanelWindows["BankFrame"] = { area = "left", pushable = 6, width = 425 };
  36. UIPanelWindows["QuestLogFrame"] = { area = "doublewide", pushable = 0, whileDead = 1 };
  37. UIPanelWindows["QuestLogDetailFrame"] = { area = "left", pushable = 1, whileDead = 1 };
  38. UIPanelWindows["QuestFrame"] = { area = "left", pushable = 0};
  39. UIPanelWindows["GuildRegistrarFrame"] = { area = "left", pushable = 0};
  40. UIPanelWindows["GossipFrame"] = { area = "left", pushable = 0};
  41. UIPanelWindows["DressUpFrame"] = { area = "left", pushable = 2};
  42. UIPanelWindows["PetitionFrame"] = { area = "left", pushable = 0};
  43. UIPanelWindows["ItemTextFrame"] = { area = "left", pushable = 0};
  44. UIPanelWindows["FriendsFrame"] = { area = "left", pushable = 0, whileDead = 1, extraWidth = 32};
  45. UIPanelWindows["RaidParentFrame"] = { area = "left", pushable = 1, whileDead = 1 };
  46. UIPanelWindows["RaidBrowserFrame"] = { area = "left", pushable = 1, };
  47. -- Frames NOT using the new Templates
  48. UIPanelWindows["WorldMapFrame"] = { area = "full", pushable = 0, xoffset = -16, yoffset = 12, whileDead = 1 };
  49. UIPanelWindows["CinematicFrame"] = { area = "full", pushable = 0, xoffset = -16, yoffset = 12, whileDead = 1 };
  50. UIPanelWindows["ChatConfigFrame"] = { area = "center", pushable = 0, xoffset = -16, yoffset = 12, whileDead = 1 };
  51. UIPanelWindows["WorldStateScoreFrame"] = { area = "center", pushable = 0, xoffset = -16, yoffset = 12, whileDead = 1 };
  52. UIPanelWindows["QuestChoiceFrame"] = { area = "center", pushable = 0, xoffset = -16, yoffset = 12, whileDead = 0, allowOtherPanels = 1 };
  53. local function GetUIPanelWindowInfo(frame, name)
  54. if ( not frame:GetAttribute("UIPanelLayout-defined") ) then
  55. local info = UIPanelWindows[frame:GetName()];
  56. if ( not info ) then
  57. return;
  58. end
  59. frame:SetAttribute("UIPanelLayout-defined", true);
  60. for name,value in pairs(info) do
  61. frame:SetAttribute("UIPanelLayout-"..name, value);
  62. end
  63. end
  64. return frame:GetAttribute("UIPanelLayout-"..name);
  65. end
  66. function SetUIPanelAttribute(frame, name, value)
  67. local info = UIPanelWindows[frame:GetName()];
  68. if ( not info ) then
  69. return;
  70. end
  71. if ( not frame:GetAttribute("UIPanelLayout-defined") ) then
  72. frame:SetAttribute("UIPanelLayout-defined", true);
  73. for name,value in pairs(info) do
  74. frame:SetAttribute("UIPanelLayout-"..name, value);
  75. end
  76. end
  77. frame:SetAttribute("UIPanelLayout-"..name, value);
  78. end
  79. -- 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.
  80. UIChildWindows = {
  81. "OpenMailFrame",
  82. "GuildControlUI",
  83. "GuildMemberDetailFrame",
  84. "TokenFramePopup",
  85. "GuildBankPopupFrame",
  86. "GearManagerDialog",
  87. };
  88. UISpecialFrames = {
  89. "ItemRefTooltip",
  90. "ColorPickerFrame",
  91. "ScrollOfResurrectionFrame",
  92. "ScrollOfResurrectionSelectionFrame"
  93. };
  94. UIMenus = {
  95. "ChatMenu",
  96. "EmoteMenu",
  97. "LanguageMenu",
  98. "DropDownList1",
  99. "DropDownList2",
  100. };
  101. NUM_ITEM_QUALITIES = 7;
  102. ITEM_QUALITY_COLORS = { };
  103. for i = -1, NUM_ITEM_QUALITIES do
  104. ITEM_QUALITY_COLORS[i] = { };
  105. ITEM_QUALITY_COLORS[i].r,
  106. ITEM_QUALITY_COLORS[i].g,
  107. ITEM_QUALITY_COLORS[i].b,
  108. ITEM_QUALITY_COLORS[i].hex = GetItemQualityColor(i);
  109. ITEM_QUALITY_COLORS[i].hex = "|c"..ITEM_QUALITY_COLORS[i].hex;
  110. end
  111. function UIParent_OnLoad(self)
  112. self:RegisterEvent("PLAYER_LOGIN");
  113. self:RegisterEvent("PLAYER_DEAD");
  114. self:RegisterEvent("SELF_RES_SPELL_CHANGED");
  115. self:RegisterEvent("PLAYER_ALIVE");
  116. self:RegisterEvent("PLAYER_UNGHOST");
  117. self:RegisterEvent("RESURRECT_REQUEST");
  118. self:RegisterEvent("PLAYER_SKINNED");
  119. self:RegisterEvent("TRADE_REQUEST");
  120. self:RegisterEvent("CHANNEL_INVITE_REQUEST");
  121. self:RegisterEvent("CHANNEL_PASSWORD_REQUEST");
  122. self:RegisterEvent("PARTY_INVITE_REQUEST");
  123. self:RegisterEvent("PARTY_INVITE_CANCEL");
  124. self:RegisterEvent("GUILD_INVITE_REQUEST");
  125. self:RegisterEvent("GUILD_INVITE_CANCEL");
  126. self:RegisterEvent("ARENA_TEAM_INVITE_REQUEST");
  127. self:RegisterEvent("PLAYER_CAMPING");
  128. self:RegisterEvent("PLAYER_QUITING");
  129. self:RegisterEvent("LOGOUT_CANCEL");
  130. self:RegisterEvent("LOOT_BIND_CONFIRM");
  131. self:RegisterEvent("EQUIP_BIND_CONFIRM");
  132. self:RegisterEvent("AUTOEQUIP_BIND_CONFIRM");
  133. self:RegisterEvent("USE_BIND_CONFIRM");
  134. self:RegisterEvent("CONFIRM_BEFORE_USE");
  135. self:RegisterEvent("DELETE_ITEM_CONFIRM");
  136. self:RegisterEvent("QUEST_ACCEPT_CONFIRM");
  137. self:RegisterEvent("QUEST_LOG_UPDATE");
  138. self:RegisterEvent("UNIT_QUEST_LOG_CHANGED");
  139. self:RegisterEvent("CURSOR_UPDATE");
  140. self:RegisterEvent("LOCALPLAYER_PET_RENAMED");
  141. self:RegisterEvent("PLAYER_ENTERING_WORLD");
  142. self:RegisterEvent("MIRROR_TIMER_START");
  143. self:RegisterEvent("DUEL_REQUESTED");
  144. self:RegisterEvent("DUEL_OUTOFBOUNDS");
  145. self:RegisterEvent("DUEL_INBOUNDS");
  146. self:RegisterEvent("DUEL_FINISHED");
  147. self:RegisterEvent("PET_BATTLE_PVP_DUEL_REQUESTED");
  148. self:RegisterEvent("PET_BATTLE_QUEUE_PROPOSE_MATCH");
  149. self:RegisterEvent("PET_BATTLE_QUEUE_PROPOSAL_DECLINED");
  150. self:RegisterEvent("PET_BATTLE_QUEUE_PROPOSAL_ACCEPTED");
  151. self:RegisterEvent("PET_BATTLE_PVP_DUEL_REQUEST_CANCEL");
  152. self:RegisterEvent("TRADE_REQUEST_CANCEL");
  153. self:RegisterEvent("CONFIRM_XP_LOSS");
  154. self:RegisterEvent("CORPSE_IN_RANGE");
  155. self:RegisterEvent("CORPSE_IN_INSTANCE");
  156. self:RegisterEvent("CORPSE_OUT_OF_RANGE");
  157. self:RegisterEvent("AREA_SPIRIT_HEALER_IN_RANGE");
  158. self:RegisterEvent("AREA_SPIRIT_HEALER_OUT_OF_RANGE");
  159. self:RegisterEvent("BIND_ENCHANT");
  160. self:RegisterEvent("REPLACE_ENCHANT");
  161. self:RegisterEvent("TRADE_REPLACE_ENCHANT");
  162. self:RegisterEvent("END_BOUND_TRADEABLE");
  163. self:RegisterEvent("CURRENT_SPELL_CAST_CHANGED");
  164. self:RegisterEvent("MACRO_ACTION_BLOCKED");
  165. self:RegisterEvent("ADDON_ACTION_BLOCKED");
  166. self:RegisterEvent("MACRO_ACTION_FORBIDDEN");
  167. self:RegisterEvent("ADDON_ACTION_FORBIDDEN");
  168. self:RegisterEvent("PLAYER_CONTROL_LOST");
  169. self:RegisterEvent("PLAYER_CONTROL_GAINED");
  170. self:RegisterEvent("START_LOOT_ROLL");
  171. self:RegisterEvent("CONFIRM_LOOT_ROLL");
  172. self:RegisterEvent("CONFIRM_DISENCHANT_ROLL");
  173. self:RegisterEvent("INSTANCE_BOOT_START");
  174. self:RegisterEvent("INSTANCE_BOOT_STOP");
  175. self:RegisterEvent("INSTANCE_LOCK_START");
  176. self:RegisterEvent("INSTANCE_LOCK_STOP");
  177. self:RegisterEvent("INSTANCE_LOCK_WARNING");
  178. self:RegisterEvent("CONFIRM_TALENT_WIPE");
  179. self:RegisterEvent("CONFIRM_BINDER");
  180. self:RegisterEvent("CONFIRM_SUMMON");
  181. self:RegisterEvent("CANCEL_SUMMON");
  182. self:RegisterEvent("GOSSIP_CONFIRM");
  183. self:RegisterEvent("GOSSIP_CONFIRM_CANCEL");
  184. self:RegisterEvent("GOSSIP_ENTER_CODE");
  185. self:RegisterEvent("GOSSIP_CLOSED");
  186. self:RegisterEvent("BILLING_NAG_DIALOG");
  187. self:RegisterEvent("IGR_BILLING_NAG_DIALOG");
  188. self:RegisterEvent("VARIABLES_LOADED");
  189. self:RegisterEvent("GROUP_ROSTER_UPDATE");
  190. self:RegisterEvent("RAID_INSTANCE_WELCOME");
  191. self:RegisterEvent("LEVEL_GRANT_PROPOSED");
  192. self:RegisterEvent("RAISED_AS_GHOUL");
  193. self:RegisterEvent("SOR_START_EXPERIENCE_INCOMPLETE");
  194. self:RegisterEvent("MISSING_OUT_ON_LOOT");
  195. self:RegisterEvent("SPELL_CONFIRMATION_PROMPT");
  196. self:RegisterEvent("SPELL_CONFIRMATION_TIMEOUT");
  197. -- Events for auction UI handling
  198. self:RegisterEvent("AUCTION_HOUSE_SHOW");
  199. self:RegisterEvent("AUCTION_HOUSE_CLOSED");
  200. self:RegisterEvent("AUCTION_HOUSE_DISABLED");
  201. -- Events for trainer UI handling
  202. self:RegisterEvent("TRAINER_SHOW");
  203. self:RegisterEvent("TRAINER_CLOSED");
  204. -- Events for trade skill UI handling
  205. self:RegisterEvent("TRADE_SKILL_SHOW");
  206. self:RegisterEvent("TRADE_SKILL_CLOSE");
  207. -- Events for Item socketing UI
  208. self:RegisterEvent("SOCKET_INFO_UPDATE");
  209. -- Events for taxi benchmarking
  210. self:RegisterEvent("ENABLE_TAXI_BENCHMARK");
  211. self:RegisterEvent("DISABLE_TAXI_BENCHMARK");
  212. -- Push to talk
  213. self:RegisterEvent("VOICE_PUSH_TO_TALK_START");
  214. self:RegisterEvent("VOICE_PUSH_TO_TALK_STOP");
  215. -- Events for BarberShop Handling
  216. self:RegisterEvent("BARBER_SHOP_OPEN");
  217. self:RegisterEvent("BARBER_SHOP_CLOSE");
  218. -- Events for Guild bank UI
  219. self:RegisterEvent("GUILDBANKFRAME_OPENED");
  220. self:RegisterEvent("GUILDBANKFRAME_CLOSED");
  221. -- Events for Achievements!
  222. self:RegisterEvent("ACHIEVEMENT_EARNED");
  223. --Events for GMChatUI
  224. self:RegisterEvent("CHAT_MSG_WHISPER");
  225. -- Events for WoW Mouse
  226. self:RegisterEvent("WOW_MOUSE_NOT_FOUND");
  227. -- Events for talent wipes
  228. self:RegisterEvent("TALENTS_INVOLUNTARILY_RESET");
  229. -- Events for reforging
  230. self:RegisterEvent("FORGE_MASTER_OPENED");
  231. self:RegisterEvent("FORGE_MASTER_CLOSED");
  232. -- Events for Archaeology
  233. self:RegisterEvent("ARCHAEOLOGY_TOGGLE");
  234. -- Events for transmogrify
  235. self:RegisterEvent("TRANSMOGRIFY_OPEN");
  236. self:RegisterEvent("TRANSMOGRIFY_CLOSE");
  237. -- Events for void storage
  238. self:RegisterEvent("VOID_STORAGE_OPEN");
  239. self:RegisterEvent("VOID_STORAGE_CLOSE");
  240. -- Events for Trial caps
  241. self:RegisterEvent("TRIAL_CAP_REACHED_MONEY");
  242. self:RegisterEvent("TRIAL_CAP_REACHED_LEVEL");
  243. -- Events for black market
  244. self:RegisterEvent("BLACK_MARKET_OPEN");
  245. self:RegisterEvent("BLACK_MARKET_CLOSE");
  246. -- Events for item upgrades
  247. self:RegisterEvent("ITEM_UPGRADE_MASTER_OPENED");
  248. self:RegisterEvent("ITEM_UPGRADE_MASTER_CLOSED");
  249. -- Events for Pet Jornal
  250. self:RegisterEvent("PET_JOURNAL_NEW_BATTLE_SLOT");
  251. -- Events for Quest Choice
  252. self:RegisterEvent("QUEST_CHOICE_UPDATE");
  253. end
  254. -- Addons --
  255. local FailedAddOnLoad = {};
  256. function UIParentLoadAddOn(name)
  257. local loaded, reason = LoadAddOn(name);
  258. if ( not loaded ) then
  259. if ( not FailedAddOnLoad[name] ) then
  260. message(format(ADDON_LOAD_FAILED, name, _G["ADDON_"..reason]));
  261. FailedAddOnLoad[name] = true;
  262. end
  263. end
  264. return loaded;
  265. end
  266. function AuctionFrame_LoadUI()
  267. UIParentLoadAddOn("Blizzard_AuctionUI");
  268. end
  269. function BattlefieldMinimap_LoadUI()
  270. UIParentLoadAddOn("Blizzard_BattlefieldMinimap");
  271. end
  272. function ClassTrainerFrame_LoadUI()
  273. UIParentLoadAddOn("Blizzard_TrainerUI");
  274. end
  275. function CombatLog_LoadUI()
  276. UIParentLoadAddOn("Blizzard_CombatLog");
  277. end
  278. function GuildBankFrame_LoadUI()
  279. UIParentLoadAddOn("Blizzard_GuildBankUI");
  280. end
  281. function InspectFrame_LoadUI()
  282. UIParentLoadAddOn("Blizzard_InspectUI");
  283. end
  284. function KeyBindingFrame_LoadUI()
  285. UIParentLoadAddOn("Blizzard_BindingUI");
  286. end
  287. function MacroFrame_LoadUI()
  288. UIParentLoadAddOn("Blizzard_MacroUI");
  289. end
  290. function MacroFrame_SaveMacro()
  291. -- this will be overwritten with the real thing when the addon is loaded
  292. end
  293. function RaidFrame_LoadUI()
  294. UIParentLoadAddOn("Blizzard_RaidUI");
  295. end
  296. function TalentFrame_LoadUI()
  297. UIParentLoadAddOn("Blizzard_TalentUI");
  298. end
  299. function TradeSkillFrame_LoadUI()
  300. UIParentLoadAddOn("Blizzard_TradeSkillUI");
  301. end
  302. function GMSurveyFrame_LoadUI()
  303. UIParentLoadAddOn("Blizzard_GMSurveyUI");
  304. end
  305. function ItemSocketingFrame_LoadUI()
  306. UIParentLoadAddOn("Blizzard_ItemSocketingUI");
  307. end
  308. function BarberShopFrame_LoadUI()
  309. UIParentLoadAddOn("Blizzard_BarberShopUI");
  310. end
  311. function AchievementFrame_LoadUI()
  312. UIParentLoadAddOn("Blizzard_AchievementUI");
  313. end
  314. function TimeManager_LoadUI()
  315. UIParentLoadAddOn("Blizzard_TimeManager");
  316. end
  317. function TokenFrame_LoadUI()
  318. UIParentLoadAddOn("Blizzard_TokenUI");
  319. end
  320. function GlyphFrame_LoadUI()
  321. UIParentLoadAddOn("Blizzard_GlyphUI");
  322. end
  323. function Calendar_LoadUI()
  324. UIParentLoadAddOn("Blizzard_Calendar");
  325. end
  326. function Reforging_LoadUI()
  327. UIParentLoadAddOn("Blizzard_ReforgingUI");
  328. end
  329. function ItemAlteration_LoadUI()
  330. UIParentLoadAddOn("Blizzard_ItemAlterationUI");
  331. end
  332. function VoidStorage_LoadUI()
  333. UIParentLoadAddOn("Blizzard_VoidStorageUI");
  334. end
  335. function ArchaeologyFrame_LoadUI()
  336. UIParentLoadAddOn("Blizzard_ArchaeologyUI");
  337. end
  338. function GMChatFrame_LoadUI(...)
  339. if ( IsAddOnLoaded("Blizzard_GMChatUI") ) then
  340. return;
  341. else
  342. UIParentLoadAddOn("Blizzard_GMChatUI");
  343. if ( select(1, ...) ) then
  344. GMChatFrame_OnEvent(GMChatFrame, ...);
  345. end
  346. end
  347. end
  348. function Arena_LoadUI()
  349. UIParentLoadAddOn("Blizzard_ArenaUI");
  350. end
  351. function GuildFrame_LoadUI()
  352. UIParentLoadAddOn("Blizzard_GuildUI");
  353. end
  354. function LookingForGuildFrame_LoadUI()
  355. UIParentLoadAddOn("Blizzard_LookingForGuildUI");
  356. end
  357. function EncounterJournal_LoadUI()
  358. UIParentLoadAddOn("Blizzard_EncounterJournal");
  359. end
  360. function PetJournal_LoadUI()
  361. UIParentLoadAddOn("Blizzard_PetJournal");
  362. end
  363. function BlackMarket_LoadUI()
  364. UIParentLoadAddOn("Blizzard_BlackMarketUI");
  365. end
  366. function ItemUpgrade_LoadUI()
  367. UIParentLoadAddOn("Blizzard_ItemUpgradeUI");
  368. end
  369. function PVP_LoadUI()
  370. UIParentLoadAddOn("Blizzard_PVPUI");
  371. end
  372. function QuestChoice_LoadUI()
  373. UIParentLoadAddOn("Blizzard_QuestChoice");
  374. end
  375. --[[
  376. function MovePad_LoadUI()
  377. UIParentLoadAddOn("Blizzard_MovePad");
  378. end
  379. ]]
  380. function ShowMacroFrame()
  381. MacroFrame_LoadUI();
  382. if ( MacroFrame_Show ) then
  383. MacroFrame_Show();
  384. end
  385. end
  386. function InspectAchievements (unit)
  387. if (IsBlizzCon()) then
  388. return;
  389. end
  390. AchievementFrame_LoadUI();
  391. AchievementFrame_DisplayComparison(unit);
  392. end
  393. function ToggleAchievementFrame(stats)
  394. if ( ( HasCompletedAnyAchievement() or IsInGuild() ) and CanShowAchievementUI() ) then
  395. AchievementFrame_LoadUI();
  396. AchievementFrame_ToggleAchievementFrame(stats);
  397. end
  398. end
  399. function ToggleTalentFrame()
  400. if (IsBlizzCon() or (UnitLevel("player") < SHOW_SPEC_LEVEL)) then
  401. return;
  402. end
  403. TalentFrame_LoadUI();
  404. if ( PlayerTalentFrame_Toggle ) then
  405. PlayerTalentFrame_Toggle(GetActiveSpecGroup());
  406. end
  407. end
  408. function ToggleGlyphFrame()
  409. if (IsBlizzCon()) then
  410. return;
  411. end
  412. if ( UnitLevel("player") < SHOW_INSCRIPTION_LEVEL ) then
  413. return;
  414. end
  415. GlyphFrame_LoadUI();
  416. if ( GlyphFrame_Toggle ) then
  417. GlyphFrame_Toggle();
  418. end
  419. end
  420. function OpenGlyphFrame()
  421. if (IsBlizzCon()) then
  422. return;
  423. end
  424. if ( UnitLevel("player") < SHOW_INSCRIPTION_LEVEL ) then
  425. return;
  426. end
  427. GlyphFrame_LoadUI();
  428. if ( GlyphFrame_Open ) then
  429. GlyphFrame_Open();
  430. end
  431. end
  432. function ToggleBattlefieldMinimap()
  433. BattlefieldMinimap_LoadUI();
  434. if ( BattlefieldMinimap_Toggle ) then
  435. BattlefieldMinimap_Toggle();
  436. end
  437. end
  438. function ToggleTimeManager()
  439. TimeManager_LoadUI();
  440. if ( TimeManager_Toggle ) then
  441. TimeManager_Toggle();
  442. end
  443. end
  444. function ToggleCalendar()
  445. if (IsBlizzCon()) then
  446. return;
  447. end
  448. Calendar_LoadUI();
  449. if ( Calendar_Toggle ) then
  450. Calendar_Toggle();
  451. end
  452. end
  453. function ToggleGuildFrame()
  454. local factionGroup = UnitFactionGroup("player");
  455. if (IsBlizzCon() or factionGroup == "Neutral") then
  456. return;
  457. end
  458. if ( IsTrialAccount() ) then
  459. UIErrorsFrame:AddMessage(ERR_RESTRICTED_ACCOUNT, 1.0, 0.1, 0.1, 1.0);
  460. return;
  461. end
  462. if ( IsInGuild() ) then
  463. GuildFrame_LoadUI();
  464. if ( GuildFrame_Toggle ) then
  465. GuildFrame_Toggle();
  466. end
  467. else
  468. ToggleGuildFinder();
  469. end
  470. end
  471. function ToggleGuildFinder()
  472. local factionGroup = UnitFactionGroup("player");
  473. if (IsBlizzCon() or factionGroup == "Neutral") then
  474. return;
  475. end
  476. LookingForGuildFrame_LoadUI();
  477. if ( LookingForGuildFrame_Toggle ) then
  478. LookingForGuildFrame_Toggle();
  479. end
  480. end
  481. function ToggleLFDParentFrame()
  482. local factionGroup = UnitFactionGroup("player");
  483. if (IsBlizzCon() or factionGroup == "Neutral") then
  484. return;
  485. end
  486. if ( UnitLevel("player") >= SHOW_LFD_LEVEL ) then
  487. PVEFrame_ToggleFrame("GroupFinderFrame", LFDParentFrame);
  488. end
  489. end
  490. function ToggleHelpFrame()
  491. if ( HelpFrame:IsShown() ) then
  492. HideUIPanel(HelpFrame);
  493. else
  494. StaticPopup_Hide("HELP_TICKET");
  495. StaticPopup_Hide("HELP_TICKET_ABANDON_CONFIRM");
  496. StaticPopup_Hide("GM_RESPONSE_NEED_MORE_HELP");
  497. StaticPopup_Hide("GM_RESPONSE_RESOLVE_CONFIRM");
  498. StaticPopup_Hide("GM_RESPONSE_MUST_RESOLVE_RESPONSE");
  499. HelpFrame_ShowFrame();
  500. end
  501. end
  502. function ToggleRaidFrame()
  503. local factionGroup = UnitFactionGroup("player");
  504. if (IsBlizzCon() or factionGroup == "Neutral") then
  505. return;
  506. end
  507. ToggleFriendsFrame(4);
  508. end
  509. function ToggleRaidBrowser()
  510. local factionGroup = UnitFactionGroup("player");
  511. if (IsBlizzCon() or factionGroup == "Neutral") then
  512. return;
  513. end
  514. if ( RaidBrowserFrame:IsShown() ) then
  515. HideUIPanel(RaidBrowserFrame);
  516. else
  517. ShowUIPanel(RaidBrowserFrame);
  518. end
  519. end
  520. function ToggleEncounterJournal()
  521. if (IsBlizzCon()) then
  522. return;
  523. end
  524. if ( not EncounterJournal ) then
  525. EncounterJournal_LoadUI();
  526. end
  527. if ( EncounterJournal ) then
  528. ToggleFrame(EncounterJournal);
  529. end
  530. end
  531. function TogglePetJournal(whichFrame)
  532. if ( not PetJournalParent ) then
  533. PetJournal_LoadUI();
  534. end
  535. if ( PetJournalParent ) then
  536. ToggleFrame(PetJournalParent);
  537. end
  538. if (whichFrame and PetJournalParent:IsShown()) then
  539. PetJournalParent_SetTab(PetJournalParent, whichFrame);
  540. end
  541. end
  542. function TogglePVPUI()
  543. if (IsBlizzCon()) then
  544. return;
  545. end
  546. if (not PVPUIFrame) then
  547. PVP_LoadUI();
  548. end
  549. if ( UnitLevel("player") >= SHOW_PVP_LEVEL and not IsPlayerNeutral()) then
  550. PVPUIFrame_ToggleFrame()
  551. end
  552. end
  553. function InspectUnit(unit)
  554. if (IsBlizzCon()) then
  555. return;
  556. end
  557. InspectFrame_LoadUI();
  558. if ( InspectFrame_Show ) then
  559. InspectFrame_Show(unit);
  560. end
  561. end
  562. -- UIParent_OnEvent --
  563. function UIParent_OnEvent(self, event, ...)
  564. local arg1, arg2, arg3, arg4, arg5, arg6 = ...;
  565. if ( event == "CURRENT_SPELL_CAST_CHANGED" and #StaticPopup_DisplayedFrames > 0 ) then
  566. if ( arg1 ) then
  567. StaticPopup_Hide("BIND_ENCHANT");
  568. StaticPopup_Hide("REPLACE_ENCHANT");
  569. end
  570. StaticPopup_Hide("TRADE_REPLACE_ENCHANT");
  571. StaticPopup_Hide("END_BOUND_TRADEABLE");
  572. elseif ( event == "VARIABLES_LOADED" ) then
  573. LocalizeFrames();
  574. if ( WorldStateFrame_CanShowBattlefieldMinimap() ) then
  575. if ( not BattlefieldMinimap ) then
  576. BattlefieldMinimap_LoadUI();
  577. end
  578. BattlefieldMinimap:Show();
  579. end
  580. if ( not TimeManagerFrame and GetCVar("timeMgrAlarmEnabled") == "1" ) then
  581. -- We have to load the time manager here if the alarm is enabled because the alarm can go off
  582. -- even if the clock is not shown. WorldFrame_OnUpdate handles alarm checking while the clock
  583. -- is hidden.
  584. TimeManager_LoadUI();
  585. end
  586. local lastTalkedToGM = GetCVar("lastTalkedToGM");
  587. if ( lastTalkedToGM ~= "" ) then
  588. GMChatFrame_LoadUI();
  589. GMChatFrame:Show()
  590. local info = ChatTypeInfo["WHISPER"];
  591. GMChatFrame:AddMessage(format(GM_CHAT_LAST_SESSION, "|TInterface\\ChatFrame\\UI-ChatIcon-Blizz:12:20:0:0:32:16:4:28:0:16|t "..
  592. "|HplayerGM:"..lastTalkedToGM.."|h".."["..lastTalkedToGM.."]".."|h"), info.r, info.g, info.b, info.id);
  593. GMChatFrameEditBox:SetAttribute("tellTarget", lastTalkedToGM);
  594. GMChatFrameEditBox:SetAttribute("chatType", "WHISPER");
  595. end
  596. TargetFrame_OnVariablesLoaded();
  597. elseif ( event == "PLAYER_LOGIN" ) then
  598. TimeManager_LoadUI();
  599. -- You can override this if you want a Combat Log replacement
  600. CombatLog_LoadUI();
  601. elseif ( event == "PLAYER_DEAD" ) then
  602. if ( not StaticPopup_Visible("DEATH") ) then
  603. CloseAllWindows(1);
  604. end
  605. if ( GetReleaseTimeRemaining() > 0 or GetReleaseTimeRemaining() == -1 ) then
  606. StaticPopup_Show("DEATH");
  607. end
  608. elseif ( event == "SELF_RES_SPELL_CHANGED" ) then
  609. if ( StaticPopup_Visible("DEATH") ) then
  610. StaticPopup_Show("DEATH"); --If we're already showing a death prompt, we should refresh it.
  611. end
  612. elseif ( event == "PLAYER_ALIVE" or event == "RAISED_AS_GHOUL" ) then
  613. StaticPopup_Hide("DEATH");
  614. StaticPopup_Hide("RESURRECT_NO_SICKNESS");
  615. if ( UnitIsGhost("player") ) then
  616. GhostFrame:Show();
  617. else
  618. GhostFrame:Hide();
  619. end
  620. elseif ( event == "PLAYER_UNGHOST" ) then
  621. StaticPopup_Hide("RESURRECT");
  622. StaticPopup_Hide("RESURRECT_NO_SICKNESS");
  623. StaticPopup_Hide("RESURRECT_NO_TIMER");
  624. StaticPopup_Hide("SKINNED");
  625. StaticPopup_Hide("SKINNED_REPOP");
  626. GhostFrame:Hide();
  627. elseif ( event == "RESURRECT_REQUEST" ) then
  628. ShowResurrectRequest(arg1);
  629. elseif ( event == "PLAYER_SKINNED" ) then
  630. StaticPopup_Hide("RESURRECT");
  631. StaticPopup_Hide("RESURRECT_NO_SICKNESS");
  632. StaticPopup_Hide("RESURRECT_NO_TIMER");
  633. --[[
  634. if (arg1 == 1) then
  635. StaticPopup_Show("SKINNED_REPOP");
  636. else
  637. StaticPopup_Show("SKINNED");
  638. end
  639. ]]
  640. UIErrorsFrame:AddMessage(DEATH_CORPSE_SKINNED, 1.0, 0.1, 0.1, 1.0);
  641. elseif ( event == "TRADE_REQUEST" ) then
  642. StaticPopup_Show("TRADE", arg1);
  643. elseif ( event == "CHANNEL_INVITE_REQUEST" ) then
  644. local dialog = StaticPopup_Show("CHAT_CHANNEL_INVITE", arg1, arg2);
  645. if ( dialog ) then
  646. dialog.data = arg1;
  647. end
  648. elseif ( event == "CHANNEL_PASSWORD_REQUEST" ) then
  649. local dialog = StaticPopup_Show("CHAT_CHANNEL_PASSWORD", arg1);
  650. if ( dialog ) then
  651. dialog.data = arg1;
  652. end
  653. elseif ( event == "PARTY_INVITE_REQUEST" ) then
  654. -- if there's a role, it's an LFG invite
  655. if ( arg2 or arg3 or arg4 ) then
  656. StaticPopupSpecial_Show(LFGInvitePopup);
  657. LFGInvitePopup_Update(arg1, arg2, arg3, arg4);
  658. elseif ( arg5 ) then --It's a X-realm invite
  659. StaticPopup_Show("PARTY_INVITE_XREALM", arg1);
  660. else
  661. StaticPopup_Show("PARTY_INVITE", arg1);
  662. end
  663. elseif ( event == "PARTY_INVITE_CANCEL" ) then
  664. StaticPopup_Hide("PARTY_INVITE");
  665. StaticPopup_Hide("PARTY_INVITE_XREALM");
  666. StaticPopupSpecial_Hide(LFGInvitePopup);
  667. elseif ( event == "GUILD_INVITE_REQUEST" ) then
  668. StaticPopup_Show("GUILD_INVITE", arg1, arg2);
  669. elseif ( event == "GUILD_INVITE_CANCEL" ) then
  670. StaticPopup_Hide("GUILD_INVITE");
  671. elseif ( event == "ARENA_TEAM_INVITE_REQUEST" ) then
  672. StaticPopup_Show("ARENA_TEAM_INVITE", arg1, arg2);
  673. elseif ( event == "ARENA_TEAM_INVITE_CANCEL" ) then
  674. StaticPopup_Hide("ARENA_TEAM_INVITE");
  675. elseif ( event == "PLAYER_CAMPING" ) then
  676. StaticPopup_Show("CAMP");
  677. elseif ( event == "PLAYER_QUITING" ) then
  678. StaticPopup_Show("QUIT");
  679. elseif ( event == "LOGOUT_CANCEL" ) then
  680. StaticPopup_Hide("CAMP");
  681. StaticPopup_Hide("QUIT");
  682. elseif ( event == "LOOT_BIND_CONFIRM" ) then
  683. local texture, item, quantity, quality, locked = GetLootSlotInfo(arg1);
  684. local dialog = StaticPopup_Show("LOOT_BIND", ITEM_QUALITY_COLORS[quality].hex..item.."|r");
  685. if ( dialog ) then
  686. dialog.data = arg1;
  687. end
  688. elseif ( event == "EQUIP_BIND_CONFIRM" ) then
  689. StaticPopup_Hide("AUTOEQUIP_BIND");
  690. local dialog = StaticPopup_Show("EQUIP_BIND");
  691. if ( dialog ) then
  692. dialog.data = arg1;
  693. end
  694. elseif ( event == "AUTOEQUIP_BIND_CONFIRM" ) then
  695. StaticPopup_Hide("EQUIP_BIND");
  696. local dialog = StaticPopup_Show("AUTOEQUIP_BIND");
  697. if ( dialog ) then
  698. dialog.data = arg1;
  699. end
  700. elseif ( event == "USE_BIND_CONFIRM" ) then
  701. StaticPopup_Show("USE_BIND");
  702. elseif ( event == "CONFIRM_BEFORE_USE" ) then
  703. StaticPopup_Show("CONFIM_BEFORE_USE");
  704. elseif ( event == "DELETE_ITEM_CONFIRM" ) then
  705. -- Check quality
  706. if ( arg2 >= 3 ) then
  707. if (arg3 == 4) then -- quest item?
  708. StaticPopup_Show("DELETE_GOOD_QUEST_ITEM", arg1);
  709. else
  710. StaticPopup_Show("DELETE_GOOD_ITEM", arg1);
  711. end
  712. else
  713. if (arg3 == 4) then -- quest item?
  714. StaticPopup_Show("DELETE_QUEST_ITEM", arg1);
  715. else
  716. StaticPopup_Show("DELETE_ITEM", arg1);
  717. end
  718. end
  719. elseif ( event == "QUEST_ACCEPT_CONFIRM" ) then
  720. local numEntries, numQuests = GetNumQuestLogEntries();
  721. if( numQuests >= MAX_QUESTS) then
  722. StaticPopup_Show("QUEST_ACCEPT_LOG_FULL", arg1, arg2);
  723. else
  724. StaticPopup_Show("QUEST_ACCEPT", arg1, arg2);
  725. end
  726. elseif ( event =="QUEST_LOG_UPDATE" or event == "UNIT_QUEST_LOG_CHANGED" ) then
  727. local frameName = StaticPopup_Visible("QUEST_ACCEPT_LOG_FULL");
  728. if( frameName ) then
  729. local numEntries, numQuests = GetNumQuestLogEntries();
  730. local button = _G[frameName.."Button1"];
  731. if( numQuests < MAX_QUESTS ) then
  732. button:Enable();
  733. else
  734. button:Disable();
  735. end
  736. end
  737. elseif ( event == "CURSOR_UPDATE" ) then
  738. if ( not CursorHasItem() ) then
  739. StaticPopup_Hide("EQUIP_BIND");
  740. StaticPopup_Hide("AUTOEQUIP_BIND");
  741. end
  742. elseif ( event == "PLAYER_ENTERING_WORLD" ) then
  743. -- Get multi-actionbar states (before CloseAllWindows() since that may be hooked by AddOns)
  744. -- 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.
  745. -- SHOW_MULTI_ACTIONBAR_1, SHOW_MULTI_ACTIONBAR_2, SHOW_MULTI_ACTIONBAR_3, SHOW_MULTI_ACTIONBAR_4 = GetActionBarToggles();
  746. MultiActionBar_Update();
  747. -- Close any windows that were previously open
  748. CloseAllWindows(1);
  749. -- Until PVPFrame is checked in, this is placed here.
  750. for i=1, MAX_ARENA_TEAMS do
  751. GetArenaTeam(i);
  752. end
  753. VoiceChat_Toggle();
  754. UpdateMicroButtons();
  755. -- Fix for Bug 124392
  756. StaticPopup_Hide("LEVEL_GRANT_PROPOSED");
  757. StaticPopup_Hide("CONFIRM_LEAVE_BATTLEFIELD");
  758. local _, instanceType = IsInInstance();
  759. if ( instanceType == "arena" or instanceType == "pvp") then
  760. Arena_LoadUI();
  761. end
  762. if ( UnitIsGhost("player") ) then
  763. GhostFrame:Show();
  764. else
  765. GhostFrame:Hide();
  766. end
  767. if ( GetReleaseTimeRemaining() > 0 or GetReleaseTimeRemaining() == -1 ) then
  768. StaticPopup_Show("DEATH");
  769. end
  770. elseif ( event == "GROUP_ROSTER_UPDATE" ) then
  771. -- Hide/Show party member frames
  772. RaidOptionsFrame_UpdatePartyFrames();
  773. if ( not IsInGroup(LE_PARTY_CATEGORY_INSTANCE) ) then
  774. StaticPopup_Hide("CONFIRM_LEAVE_INSTANCE_PARTY");
  775. end
  776. elseif ( event == "MIRROR_TIMER_START" ) then
  777. MirrorTimer_Show(arg1, arg2, arg3, arg4, arg5, arg6);
  778. elseif ( event == "DUEL_REQUESTED" ) then
  779. StaticPopup_Show("DUEL_REQUESTED", arg1);
  780. elseif ( event == "DUEL_OUTOFBOUNDS" ) then
  781. StaticPopup_Show("DUEL_OUTOFBOUNDS");
  782. elseif ( event == "DUEL_INBOUNDS" ) then
  783. StaticPopup_Hide("DUEL_OUTOFBOUNDS");
  784. elseif ( event == "DUEL_FINISHED" ) then
  785. StaticPopup_Hide("DUEL_REQUESTED");
  786. StaticPopup_Hide("DUEL_OUTOFBOUNDS");
  787. elseif ( event == "PET_BATTLE_PVP_DUEL_REQUESTED" ) then
  788. StaticPopup_Show("PET_BATTLE_PVP_DUEL_REQUESTED", arg1);
  789. elseif ( event == "PET_BATTLE_PVP_DUEL_REQUEST_CANCEL" ) then
  790. StaticPopup_Hide("PET_BATTLE_PVP_DUEL_REQUESTED");
  791. elseif ( event == "PET_BATTLE_QUEUE_PROPOSE_MATCH" ) then
  792. PlaySound("UI_PetBattles_PVP_ThroughQueue");
  793. StaticPopupSpecial_Show(PetBattleQueueReadyFrame);
  794. elseif ( event == "PET_BATTLE_QUEUE_PROPOSAL_DECLINED" or event == "PET_BATTLE_QUEUE_PROPOSAL_ACCEPTED" ) then
  795. StaticPopupSpecial_Hide(PetBattleQueueReadyFrame);
  796. elseif ( event == "TRADE_REQUEST_CANCEL" ) then
  797. StaticPopup_Hide("TRADE");
  798. elseif ( event == "CONFIRM_XP_LOSS" ) then
  799. local resSicknessTime = GetResSicknessDuration();
  800. if ( resSicknessTime ) then
  801. local dialog = nil;
  802. if (UnitLevel("player") <= 10) then
  803. dialog = StaticPopup_Show("XP_LOSS_NO_DURABILITY", resSicknessTime);
  804. else
  805. dialog = StaticPopup_Show("XP_LOSS", resSicknessTime);
  806. end
  807. if ( dialog ) then
  808. dialog.data = resSicknessTime;
  809. end
  810. else
  811. local dialog = nil;
  812. if (UnitLevel("player") <= 10) then
  813. dialog = StaticPopup_Show("XP_LOSS_NO_SICKNESS_NO_DURABILITY");
  814. else
  815. dialog = StaticPopup_Show("XP_LOSS_NO_SICKNESS");
  816. end
  817. if ( dialog ) then
  818. dialog.data = 1;
  819. end
  820. end
  821. HideUIPanel(GossipFrame);
  822. elseif ( event == "CORPSE_IN_RANGE" ) then
  823. StaticPopup_Show("RECOVER_CORPSE");
  824. elseif ( event == "CORPSE_IN_INSTANCE" ) then
  825. StaticPopup_Show("RECOVER_CORPSE_INSTANCE");
  826. elseif ( event == "CORPSE_OUT_OF_RANGE" ) then
  827. StaticPopup_Hide("RECOVER_CORPSE");
  828. StaticPopup_Hide("RECOVER_CORPSE_INSTANCE");
  829. StaticPopup_Hide("XP_LOSS");
  830. elseif ( event == "AREA_SPIRIT_HEALER_IN_RANGE" ) then
  831. AcceptAreaSpiritHeal();
  832. StaticPopup_Show("AREA_SPIRIT_HEAL");
  833. elseif ( event == "AREA_SPIRIT_HEALER_OUT_OF_RANGE" ) then
  834. StaticPopup_Hide("AREA_SPIRIT_HEAL");
  835. elseif ( event == "BIND_ENCHANT" ) then
  836. StaticPopup_Show("BIND_ENCHANT");
  837. elseif ( event == "REPLACE_ENCHANT" ) then
  838. StaticPopup_Show("REPLACE_ENCHANT", arg1, arg2);
  839. elseif ( event == "TRADE_REPLACE_ENCHANT" ) then
  840. StaticPopup_Show("TRADE_REPLACE_ENCHANT", arg1, arg2);
  841. elseif ( event == "END_BOUND_TRADEABLE" ) then
  842. local dialog = StaticPopup_Show("END_BOUND_TRADEABLE", nil, nil, arg1);
  843. elseif ( event == "MACRO_ACTION_BLOCKED" or event == "ADDON_ACTION_BLOCKED" ) then
  844. if ( not INTERFACE_ACTION_BLOCKED_SHOWN ) then
  845. local info = ChatTypeInfo["SYSTEM"];
  846. DEFAULT_CHAT_FRAME:AddMessage(INTERFACE_ACTION_BLOCKED, info.r, info.g, info.b, info.id);
  847. INTERFACE_ACTION_BLOCKED_SHOWN = true;
  848. end
  849. elseif ( event == "MACRO_ACTION_FORBIDDEN" ) then
  850. StaticPopup_Show("MACRO_ACTION_FORBIDDEN");
  851. elseif ( event == "ADDON_ACTION_FORBIDDEN" ) then
  852. local dialog = StaticPopup_Show("ADDON_ACTION_FORBIDDEN", arg1);
  853. if ( dialog ) then
  854. dialog.data = arg1;
  855. end
  856. elseif ( event == "PLAYER_CONTROL_LOST" ) then
  857. if ( UnitOnTaxi("player") ) then
  858. return;
  859. end
  860. CloseAllWindows_WithExceptions();
  861. --[[
  862. -- Disable all microbuttons except the main menu
  863. SetDesaturation(MicroButtonPortrait, 1);
  864. Designers previously wanted these disabled when feared, they seem to have changed their minds
  865. CharacterMicroButton:Disable();
  866. SpellbookMicroButton:Disable();
  867. TalentMicroButton:Disable();
  868. QuestLogMicroButton:Disable();
  869. GuildMicroButton:Disable();
  870. WorldMapMicroButton:Disable();
  871. ]]
  872. UIParent.isOutOfControl = 1;
  873. elseif ( event == "PLAYER_CONTROL_GAINED" ) then
  874. --[[
  875. -- Enable all microbuttons
  876. SetDesaturation(MicroButtonPortrait, nil);
  877. CharacterMicroButton:Enable();
  878. SpellbookMicroButton:Enable();
  879. TalentMicroButton:Enable();
  880. QuestLogMicroButton:Enable();
  881. GuildMicroButton:Enable();
  882. WorldMapMicroButton:Enable();
  883. ]]
  884. UIParent.isOutOfControl = nil;
  885. elseif ( event == "START_LOOT_ROLL" ) then
  886. GroupLootFrame_OpenNewFrame(arg1, arg2);
  887. elseif ( event == "CONFIRM_LOOT_ROLL" ) then
  888. local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo(arg1);
  889. local dialog = StaticPopup_Show("CONFIRM_LOOT_ROLL", ITEM_QUALITY_COLORS[quality].hex..name.."|r");
  890. if ( dialog ) then
  891. dialog.text:SetFormattedText(arg3, ITEM_QUALITY_COLORS[quality].hex..name.."|r");
  892. StaticPopup_Resize(dialog, "CONFIRM_LOOT_ROLL");
  893. dialog.data = arg1;
  894. dialog.data2 = arg2;
  895. end
  896. elseif ( event == "MISSING_OUT_ON_LOOT" ) then
  897. MissingLootFrame_Show();
  898. elseif ( event == "SPELL_CONFIRMATION_PROMPT" ) then
  899. local spellID, confirmType, text, duration, currencyID = ...;
  900. if ( confirmType == CONFIRMATION_PROMPT_BONUS_ROLL ) then
  901. BonusRollFrame_StartBonusRoll(spellID, text, duration, currencyID);
  902. else
  903. StaticPopup_Show("SPELL_CONFIRMATION_PROMPT", text, duration, spellID);
  904. end
  905. elseif ( event == "SPELL_CONFIRMATION_TIMEOUT" ) then
  906. local spellID, confirmType = ...;
  907. if ( confirmType == CONFIRMATION_PROMPT_BONUS_ROLL ) then
  908. BonusRollFrame_CloseBonusRoll();
  909. else
  910. StaticPopup_Hide("SPELL_CONFIRMATION_PROMPT", spellID);
  911. end
  912. elseif ( event == "CONFIRM_DISENCHANT_ROLL" ) then
  913. local texture, name, count, quality, bindOnPickUp = GetLootRollItemInfo(arg1);
  914. local dialog = StaticPopup_Show("CONFIRM_LOOT_ROLL", ITEM_QUALITY_COLORS[quality].hex..name.."|r");
  915. if ( dialog ) then
  916. dialog.text:SetFormattedText(LOOT_NO_DROP_DISENCHANT, ITEM_QUALITY_COLORS[quality].hex..name.."|r");
  917. StaticPopup_Resize(dialog, "CONFIRM_LOOT_ROLL");
  918. dialog.data = arg1;
  919. dialog.data2 = arg2;
  920. end
  921. elseif ( event == "INSTANCE_BOOT_START" ) then
  922. StaticPopup_Show("INSTANCE_BOOT");
  923. elseif ( event == "INSTANCE_BOOT_STOP" ) then
  924. StaticPopup_Hide("INSTANCE_BOOT");
  925. elseif ( event == "INSTANCE_LOCK_START" ) then
  926. StaticPopup_Show("INSTANCE_LOCK", nil, nil, true);
  927. elseif ( event == "INSTANCE_LOCK_STOP" ) then
  928. StaticPopup_Hide("INSTANCE_LOCK");
  929. elseif ( event == "INSTANCE_LOCK_WARNING" ) then
  930. StaticPopup_Show("INSTANCE_LOCK", nil, nil, false);
  931. elseif ( event == "CONFIRM_TALENT_WIPE" ) then
  932. HideUIPanel(GossipFrame);
  933. StaticPopupDialogs["CONFIRM_TALENT_WIPE"].text = _G["CONFIRM_TALENT_WIPE_"..arg2];
  934. local dialog = StaticPopup_Show("CONFIRM_TALENT_WIPE");
  935. if ( dialog ) then
  936. MoneyFrame_Update(dialog:GetName().."MoneyFrame", arg1);
  937. -- open the talent UI to the player's active talent group...just so the player knows
  938. -- exactly which talent spec he is wiping
  939. -- TalentFrame_LoadUI();
  940. -- if ( PlayerTalentFrame_Open ) then
  941. -- PlayerTalentFrame_Open(GetActiveSpecGroup());
  942. -- end
  943. end
  944. elseif ( event == "CONFIRM_BINDER" ) then
  945. StaticPopup_Show("CONFIRM_BINDER", arg1);
  946. elseif ( event == "CONFIRM_SUMMON" ) then
  947. StaticPopup_Show("CONFIRM_SUMMON");
  948. elseif ( event == "CANCEL_SUMMON" ) then
  949. StaticPopup_Hide("CONFIRM_SUMMON");
  950. elseif ( event == "BILLING_NAG_DIALOG" ) then
  951. StaticPopup_Show("BILLING_NAG", arg1);
  952. elseif ( event == "IGR_BILLING_NAG_DIALOG" ) then
  953. StaticPopup_Show("IGR_BILLING_NAG");
  954. elseif ( event == "GOSSIP_CONFIRM" ) then
  955. if ( arg3 > 0 ) then
  956. StaticPopupDialogs["GOSSIP_CONFIRM"].hasMoneyFrame = 1;
  957. else
  958. StaticPopupDialogs["GOSSIP_CONFIRM"].hasMoneyFrame = nil;
  959. end
  960. local dialog = StaticPopup_Show("GOSSIP_CONFIRM", arg2);
  961. if ( dialog ) then
  962. dialog.data = arg1;
  963. if ( arg3 > 0 ) then
  964. MoneyFrame_Update(dialog:GetName().."MoneyFrame", arg3);
  965. end
  966. end
  967. elseif ( event == "GOSSIP_ENTER_CODE" ) then
  968. local dialog = StaticPopup_Show("GOSSIP_ENTER_CODE");
  969. if ( dialog ) then
  970. dialog.data = arg1;
  971. end
  972. elseif ( event == "GOSSIP_CONFIRM_CANCEL" or event == "GOSSIP_CLOSED" ) then
  973. StaticPopup_Hide("GOSSIP_CONFIRM");
  974. StaticPopup_Hide("GOSSIP_ENTER_CODE");
  975. --Events for handling Auction UI
  976. elseif ( event == "AUCTION_HOUSE_SHOW" ) then
  977. AuctionFrame_LoadUI();
  978. if ( AuctionFrame_Show ) then
  979. AuctionFrame_Show();
  980. end
  981. elseif ( event == "AUCTION_HOUSE_CLOSED" ) then
  982. if ( AuctionFrame_Hide ) then
  983. AuctionFrame_Hide();
  984. end
  985. elseif ( event == "AUCTION_HOUSE_DISABLED" ) then
  986. StaticPopup_Show("AUCTION_HOUSE_DISABLED");
  987. -- Events for trainer UI handling
  988. elseif ( event == "TRAINER_SHOW" ) then
  989. ClassTrainerFrame_LoadUI();
  990. if ( ClassTrainerFrame_Show ) then
  991. ClassTrainerFrame_Show();
  992. end
  993. elseif ( event == "TRAINER_CLOSED" ) then
  994. if ( ClassTrainerFrame_Hide ) then
  995. ClassTrainerFrame_Hide();
  996. end
  997. -- Events for trade skill UI handling
  998. elseif ( event == "TRADE_SKILL_SHOW" ) then
  999. TradeSkillFrame_LoadUI();
  1000. if ( TradeSkillFrame_Show ) then
  1001. TradeSkillFrame_Show();
  1002. end
  1003. elseif ( event == "TRADE_SKILL_CLOSE" ) then
  1004. if ( TradeSkillFrame_Hide ) then
  1005. TradeSkillFrame_Hide();
  1006. end
  1007. -- Event for item socketing handling
  1008. elseif ( event == "SOCKET_INFO_UPDATE" ) then
  1009. ItemSocketingFrame_LoadUI();
  1010. ItemSocketingFrame_Update();
  1011. ShowUIPanel(ItemSocketingFrame);
  1012. -- Event for BarberShop handling
  1013. elseif ( event == "BARBER_SHOP_OPEN" ) then
  1014. BarberShopFrame_LoadUI();
  1015. if ( BarberShopFrame ) then
  1016. ShowUIPanel(BarberShopFrame);
  1017. end
  1018. elseif ( event == "BARBER_SHOP_CLOSE" ) then
  1019. if ( BarberShopFrame and BarberShopFrame:IsVisible() ) then
  1020. BarberShopFrame:Hide();
  1021. end
  1022. -- Event for guildbank handling
  1023. elseif ( event == "GUILDBANKFRAME_OPENED" ) then
  1024. GuildBankFrame_LoadUI();
  1025. if ( GuildBankFrame ) then
  1026. ShowUIPanel(GuildBankFrame);
  1027. if ( not GuildBankFrame:IsVisible() ) then
  1028. CloseGuildBankFrame();
  1029. end
  1030. end
  1031. elseif ( event == "GUILDBANKFRAME_CLOSED" ) then
  1032. if ( GuildBankFrame ) then
  1033. HideUIPanel(GuildBankFrame);
  1034. end
  1035. -- Event for barbershop handling
  1036. elseif ( event == "BARBER_SHOP_OPEN" ) then
  1037. BarberShopFrame_LoadUI();
  1038. if ( BarberShopFrame ) then
  1039. ShowUIPanel(BarberShopFrame);
  1040. end
  1041. elseif ( event == "BARBER_SHOP_CLOSE" ) then
  1042. BarberShopFrame_LoadUI();
  1043. if ( BarberShopFrame ) then
  1044. HideUIPanel(BarberShopFrame);
  1045. end
  1046. -- Events for achievement handling
  1047. elseif ( event == "ACHIEVEMENT_EARNED" ) then
  1048. -- if ( not AchievementFrame ) then
  1049. -- AchievementFrame_LoadUI();
  1050. -- AchievementAlertFrame_ShowAlert(...);
  1051. -- end
  1052. -- self:UnregisterEvent(event);
  1053. -- Display instance reset info
  1054. elseif ( event == "RAID_INSTANCE_WELCOME" ) then
  1055. local dungeonName = arg1;
  1056. local lockExpireTime = arg2;
  1057. local locked = arg3;
  1058. local extended = arg4;
  1059. local message;
  1060. if ( locked == 0 ) then
  1061. message = format(RAID_INSTANCE_WELCOME, dungeonName, SecondsToTime(lockExpireTime, nil, 1))
  1062. else
  1063. if ( lockExpireTime == 0 ) then
  1064. message = format(RAID_INSTANCE_WELCOME_EXTENDED, dungeonName);
  1065. else
  1066. if ( extended == 0 ) then
  1067. message = format(RAID_INSTANCE_WELCOME_LOCKED, dungeonName, SecondsToTime(lockExpireTime, nil, 1));
  1068. else
  1069. message = format(RAID_INSTANCE_WELCOME_LOCKED_EXTENDED, dungeonName, SecondsToTime(lockExpireTime, nil, 1));
  1070. end
  1071. end
  1072. end
  1073. local info = ChatTypeInfo["SYSTEM"];
  1074. DEFAULT_CHAT_FRAME:AddMessage(message, info.r, info.g, info.b, info.id);
  1075. -- Events for taxi benchmarking
  1076. elseif ( event == "ENABLE_TAXI_BENCHMARK" ) then
  1077. if ( not FramerateText:IsShown() ) then
  1078. ToggleFramerate(true);
  1079. end
  1080. local info = ChatTypeInfo["SYSTEM"];
  1081. DEFAULT_CHAT_FRAME:AddMessage(BENCHMARK_TAXI_MODE_ON, info.r, info.g, info.b, info.id);
  1082. elseif ( event == "DISABLE_TAXI_BENCHMARK" ) then
  1083. if ( FramerateText.benchmark ) then
  1084. ToggleFramerate();
  1085. end
  1086. local info = ChatTypeInfo["SYSTEM"];
  1087. DEFAULT_CHAT_FRAME:AddMessage(BENCHMARK_TAXI_MODE_OFF, info.r, info.g, info.b, info.id);
  1088. -- Push to talk
  1089. elseif ( event == "VOICE_PUSH_TO_TALK_START" and GetVoiceCurrentSessionID() ) then
  1090. if ( GetCVarBool("PushToTalkSound") ) then
  1091. PlaySound("VoiceChatOn");
  1092. end
  1093. -- Animate the player frame speaker even if not broadcasting
  1094. if ( GetCVar("VoiceChatMode") == "0" ) then
  1095. UIFrameFadeIn(PlayerSpeakerFrame, 0.2, PlayerSpeakerFrame:GetAlpha(), 1);
  1096. end
  1097. elseif ( event == "VOICE_PUSH_TO_TALK_STOP" ) then
  1098. if ( GetCVarBool("PushToTalkSound") and GetVoiceCurrentSessionID() ) then
  1099. PlaySound("VoiceChatOff");
  1100. end
  1101. -- Stop Animation
  1102. if ( GetCVar("VoiceChatMode") == "0" and PlayerSpeakerFrame:GetAlpha() > 0 ) then
  1103. UIFrameFadeOut(PlayerSpeakerFrame, 0.2, PlayerSpeakerFrame:GetAlpha(), 0);
  1104. end
  1105. elseif ( event == "LEVEL_GRANT_PROPOSED" ) then
  1106. StaticPopup_Show("LEVEL_GRANT_PROPOSED", arg1);
  1107. elseif ( event == "CHAT_MSG_WHISPER" and arg6 == "GM" ) then --GMChatUI
  1108. GMChatFrame_LoadUI(event, ...);
  1109. elseif ( event == "WOW_MOUSE_NOT_FOUND" ) then
  1110. StaticPopup_Show("WOW_MOUSE_NOT_FOUND");
  1111. elseif ( event == "TALENTS_INVOLUNTARILY_RESET" ) then
  1112. if ( arg1 ) then
  1113. StaticPopup_Show("TALENTS_INVOLUNTARILY_RESET_PET");
  1114. else
  1115. StaticPopup_Show("TALENTS_INVOLUNTARILY_RESET");
  1116. end
  1117. -- Events for Reforging UI handling
  1118. elseif ( event == "FORGE_MASTER_OPENED" ) then
  1119. Reforging_LoadUI();
  1120. if ( ReforgingFrame_Show ) then
  1121. ReforgingFrame_Show();
  1122. end
  1123. elseif ( event == "FORGE_MASTER_CLOSED" ) then
  1124. if ( ReforgingFrame_Hide ) then
  1125. ReforgingFrame_Hide();
  1126. end
  1127. -- Events for Archaeology
  1128. elseif ( event == "ARCHAEOLOGY_TOGGLE" ) then
  1129. ArchaeologyFrame_LoadUI();
  1130. if ( ArchaeologyFrame_Show and not ArchaeologyFrame:IsShown()) then
  1131. ArchaeologyFrame_Show();
  1132. elseif ( ArchaeologyFrame_Hide ) then
  1133. ArchaeologyFrame_Hide();
  1134. end
  1135. -- Events for Transmogrify UI handling
  1136. elseif ( event == "TRANSMOGRIFY_OPEN" ) then
  1137. ItemAlteration_LoadUI();
  1138. if ( TransmogrifyFrame_Show ) then
  1139. TransmogrifyFrame_Show();
  1140. end
  1141. elseif ( event == "TRANSMOGRIFY_CLOSE" ) then
  1142. if ( TransmogrifyFrame_Hide ) then
  1143. TransmogrifyFrame_Hide();
  1144. end
  1145. -- Events for Void Storage UI handling
  1146. elseif ( event == "VOID_STORAGE_OPEN" ) then
  1147. VoidStorage_LoadUI();
  1148. if ( VoidStorageFrame_Show ) then
  1149. VoidStorageFrame_Show();
  1150. end
  1151. elseif ( event == "VOID_STORAGE_CLOSE" ) then
  1152. if ( VoidStorageFrame_Hide ) then
  1153. VoidStorageFrame_Hide();
  1154. end
  1155. --Events for Trial caps
  1156. elseif ( event == "TRIAL_CAP_REACHED_MONEY" ) then
  1157. TrialAccountCapReached_Inform("money");
  1158. elseif ( event == "TRIAL_CAP_REACHED_LEVEL" ) then
  1159. TrialAccountCapReached_Inform("level");
  1160. elseif( event == "SOR_START_EXPERIENCE_INCOMPLETE" ) then
  1161. StaticPopup_Show("ERR_SOR_STARTING_EXPERIENCE_INCOMPLETE");
  1162. -- Events for Black Market UI handling
  1163. elseif ( event == "BLACK_MARKET_OPEN" ) then
  1164. BlackMarket_LoadUI();
  1165. if ( BlackMarketFrame_Show ) then
  1166. BlackMarketFrame_Show();
  1167. end
  1168. elseif ( event == "BLACK_MARKET_CLOSE" ) then
  1169. if ( BlackMarketFrame_Hide ) then
  1170. BlackMarketFrame_Hide();
  1171. end
  1172. -- Events for Item Upgrading
  1173. elseif ( event == "ITEM_UPGRADE_MASTER_OPENED" ) then
  1174. ItemUpgrade_LoadUI();
  1175. if ( ItemUpgradeFrame_Show ) then
  1176. ItemUpgradeFrame_Show();
  1177. end
  1178. elseif ( event == "ITEM_UPGRADE_MASTER_CLOSED" ) then
  1179. if ( ItemUpgradeFrame_Hide ) then
  1180. ItemUpgradeFrame_Hide();
  1181. end
  1182. -- Events for Pet Journal
  1183. elseif ( event == "PET_JOURNAL_NEW_BATTLE_SLOT" ) then
  1184. CompanionsMicroButtonAlert:Show();
  1185. MicroButtonPulse(CompanionsMicroButton);
  1186. -- Quest Choice trigger event
  1187. elseif (event == "QUEST_CHOICE_UPDATE") then
  1188. QuestChoice_LoadUI();
  1189. if ( QuestChoiceFrame_Show) then
  1190. QuestChoiceFrame_Show();
  1191. end
  1192. end
  1193. end
  1194. -- Frame Management --
  1195. -- UIPARENT_MANAGED_FRAME_POSITIONS stores all the frames that have positioning dependencies based on other frames.
  1196. -- UIPARENT_MANAGED_FRAME_POSITIONS["FRAME"] = {
  1197. --Note: this is out of date and there are several more options now.
  1198. -- none = This value is used if no dependent frames are shown
  1199. -- reputation = This is the offset used if the reputation watch bar is shown
  1200. -- anchorTo = This is the object that the stored frame is anchored to
  1201. -- point = This is the point on the frame used as the anchor
  1202. -- rpoint = This is the point on the "anchorTo" frame that the stored frame is anchored to
  1203. -- bottomEither = This offset is used if either bottom multibar is shown
  1204. -- bottomLeft
  1205. -- var = If this is set use _G[varName] = value instead of setpoint
  1206. -- };
  1207. -- some standard offsets
  1208. local actionBarOffset = 45;
  1209. local menuBarTop = 55;
  1210. local overrideActionBarTop = 40;
  1211. local petBattleTop = 60;
  1212. function UpdateMenuBarTop ()
  1213. --Determines the optimal magic number based on resolution and action bar status.
  1214. menuBarTop = 55;
  1215. local width, height = string.match((({GetScreenResolutions()})[GetCurrentResolution()] or ""), "(%d+).-(%d+)");
  1216. if ( tonumber(width) / tonumber(height ) > 4/3 ) then
  1217. --Widescreen resolution
  1218. menuBarTop = 75;
  1219. end
  1220. end
  1221. UIPARENT_MANAGED_FRAME_POSITIONS = {
  1222. --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.
  1223. --"yOffset" gets added to the value of "baseY", which is used for values based on menuBarTop.
  1224. ["MultiBarBottomLeft"] = {baseY = 17, reputation = 1, maxLevel = 1, anchorTo = "ActionButton1", point = "BOTTOMLEFT", rpoint = "TOPLEFT"};
  1225. ["MultiBarRight"] = {baseY = 98, reputation = 1, anchorTo = "UIParent", point = "BOTTOMRIGHT", rpoint = "BOTTOMRIGHT"};
  1226. ["VoiceChatTalkers"] = {baseY = true, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, reputation = 1};
  1227. ["GroupLootContainer"] = {baseY = true, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1};
  1228. ["MissingLootFrame"] = {baseY = true, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1};
  1229. ["TutorialFrameAlertButton"] = {baseY = true, yOffset = -10, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, reputation = 1};
  1230. ["FramerateLabel"] = {baseY = true, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1, playerPowerBarAlt = 1, extraActionBarFrame = 1};
  1231. ["CastingBarFrame"] = {baseY = true, yOffset = 40, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1, tutorialAlert = 1, playerPowerBarAlt = 1, extraActionBarFrame = 1};
  1232. ["PlayerPowerBarAlt"] = {baseY = true, yOffset = 40, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1, tutorialAlert = 1, extraActionBarFrame = 1};
  1233. ["ExtraActionBarFrame"] = {baseY = true, yOffset = 40, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1, tutorialAlert = 1};
  1234. ["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};
  1235. ["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};
  1236. ["StanceBarFrame"] = {baseY = 0, bottomLeft = actionBarOffset, reputation = 1, maxLevel = 1, anchorTo = "MainMenuBar", point = "BOTTOMLEFT", rpoint = "TOPLEFT", xOffset = 30};
  1237. ["PossessBarFrame"] = {baseY = 0, bottomLeft = actionBarOffset, reputation = 1, maxLevel = 1, anchorTo = "MainMenuBar", point = "BOTTOMLEFT", rpoint = "TOPLEFT", xOffset = 30};
  1238. ["MultiCastActionBarFrame"] = {baseY = 0, bottomLeft = actionBarOffset, reputation = 1, maxLevel = 1, anchorTo = "MainMenuBar", point = "BOTTOMLEFT", rpoint = "TOPLEFT", xOffset = 30};
  1239. ["AuctionProgressFrame"] = {baseY = true, yOffset = 18, bottomEither = actionBarOffset, overrideActionBar = overrideActionBarTop, petBattleFrame = petBattleTop, bonusActionBar = 1, pet = 1, reputation = 1, tutorialAlert = 1};
  1240. -- Vars
  1241. -- 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
  1242. -- 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
  1243. -- 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.
  1244. ["CONTAINER_OFFSET_X"] = {baseX = 0, rightLeft = 2*actionBarOffset+3, rightRight = actionBarOffset+3, isVar = "xAxis"};
  1245. ["CONTAINER_OFFSET_Y"] = {baseY = true, yOffset = 10, bottomEither = actionBarOffset, reputation = 1, isVar = "yAxis"};
  1246. ["BATTLEFIELD_TAB_OFFSET_Y"] = {baseY = 210, bottomRight = actionBarOffset, reputation = 1, isVar = "yAxis"};
  1247. ["PETACTIONBAR_YPOS"] = {baseY = 97, bottomLeft = actionBarOffset, justBottomRightAndStance = actionBarOffset, reputation = 1, maxLevel = 1, isVar = "yAxis"};
  1248. ["MULTICASTACTIONBAR_YPOS"] = {baseY = 0, bottomLeft = actionBarOffset, reputation = 1, maxLevel = 1, isVar = "yAxis"};
  1249. };
  1250. -- 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.
  1251. -- The reason why is that it is possible for UIParent_ManageFramePosition to be run before the addon loads.
  1252. BATTLEFIELD_TAB_OFFSET_Y = 0;
  1253. -- constant offsets
  1254. for _, data in pairs(UIPARENT_MANAGED_FRAME_POSITIONS) do
  1255. for flag, value in pairs(data) do
  1256. if ( flag == "reputation" ) then
  1257. data[flag] = value * 9;
  1258. elseif ( flag == "maxLevel" ) then
  1259. data[flag] = value * -5;
  1260. elseif ( flag == "pet" ) then
  1261. data[flag] = value * 35;
  1262. elseif ( flag == "tutorialAlert" ) then
  1263. data[flag] = value * 35;
  1264. end
  1265. end
  1266. end
  1267. function UIParent_ManageFramePosition(index, value, yOffsetFrames, xOffsetFrames, hasBottomLeft, hasBottomRight, hasPetBar)
  1268. local frame, xOffset, yOffset, anchorTo, point, rpoint;
  1269. frame = _G[index];
  1270. if ( not frame or (type(frame)=="table" and frame.ignoreFramePositionManager)) then
  1271. return;
  1272. end
  1273. -- Always start with base as the base offset or default to zero if no "none" specified
  1274. xOffset = 0;
  1275. if ( value["baseX"] ) then
  1276. xOffset = value["baseX"];
  1277. elseif ( value["xOffset"] ) then
  1278. xOffset = value["xOffset"];
  1279. end
  1280. yOffset = 0;
  1281. if ( tonumber(value["baseY"]) ) then
  1282. --tonumber(nil) and tonumber(boolean) evaluate as nil, tonumber(number) evaluates as a number, which evaluates as true.
  1283. --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