diff main.lua @ 7:332550e56fd2

Handle the case of a guildmaster opening the main window manually. This whole thing should be moved to LoD.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Sat, 10 Dec 2011 19:12:10 +0000
parents e66407f67848
children e6382ba088c3
line wrap: on
line diff
--- a/main.lua	Wed Nov 30 22:07:07 2011 +0000
+++ b/main.lua	Sat Dec 10 19:12:10 2011 +0000
@@ -131,6 +131,8 @@
 	self:RegisterEvent("GUILD_RANKS_UPDATE")
 	self:RegisterChatCommand("wrdw", "OnChatCommand")
 
+	-- Ideally, most of this stuff wouldn't be done at load time at all; this
+	-- whole addon should be LoD.
 	if (not IsGuildLeader()) and self.db.profile.guildcontrol then
 		local function onclick() addon:BuildWindow() end
 		local function onenter(this) GameTooltip_AddNewbieTip(this, GUILDCONTROL, 1.0, 1.0, 1.0, "/wrdw", 1) end
@@ -159,6 +161,10 @@
 end
 
 function addon:OnChatCommand (input)
+	if not NUM_RANK_FLAGS then  -- in case a GM didn't get it loaded earlier
+		GuildFrame_LoadUI()
+		UIParentLoadAddOn("Blizzard_GuildControlUI")
+	end
 	if not input or input:trim() == "" then
 		if self.display and self.display:IsShown() then
 			self.display:Hide()