comparison 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
comparison
equal deleted inserted replaced
6:f80357fa754a 7:332550e56fd2
129 129
130 function addon:OnEnable() 130 function addon:OnEnable()
131 self:RegisterEvent("GUILD_RANKS_UPDATE") 131 self:RegisterEvent("GUILD_RANKS_UPDATE")
132 self:RegisterChatCommand("wrdw", "OnChatCommand") 132 self:RegisterChatCommand("wrdw", "OnChatCommand")
133 133
134 -- Ideally, most of this stuff wouldn't be done at load time at all; this
135 -- whole addon should be LoD.
134 if (not IsGuildLeader()) and self.db.profile.guildcontrol then 136 if (not IsGuildLeader()) and self.db.profile.guildcontrol then
135 local function onclick() addon:BuildWindow() end 137 local function onclick() addon:BuildWindow() end
136 local function onenter(this) GameTooltip_AddNewbieTip(this, GUILDCONTROL, 1.0, 1.0, 1.0, "/wrdw", 1) end 138 local function onenter(this) GameTooltip_AddNewbieTip(this, GUILDCONTROL, 1.0, 1.0, 1.0, "/wrdw", 1) end
137 GuildFrame_LoadUI() 139 GuildFrame_LoadUI()
138 if not NUM_RANK_FLAGS then 140 if not NUM_RANK_FLAGS then
157 self:Disable() 159 self:Disable()
158 end 160 end
159 end 161 end
160 162
161 function addon:OnChatCommand (input) 163 function addon:OnChatCommand (input)
164 if not NUM_RANK_FLAGS then -- in case a GM didn't get it loaded earlier
165 GuildFrame_LoadUI()
166 UIParentLoadAddOn("Blizzard_GuildControlUI")
167 end
162 if not input or input:trim() == "" then 168 if not input or input:trim() == "" then
163 if self.display and self.display:IsShown() then 169 if self.display and self.display:IsShown() then
164 self.display:Hide() 170 self.display:Hide()
165 else 171 else
166 self:BuildWindow() 172 self:BuildWindow()