From 1af2c4d831de03bdf942872bf47809bfe62f700f Mon Sep 17 00:00:00 2001 From: Parnic Date: Wed, 22 Sep 2010 05:47:01 +0000 Subject: [PATCH] - added some more protection against people tweaking settings or changing profiles while in combat and added a warning message explaining that stuff could be broked if they manage to do it anyway - fixed cooldown bars that are set to "when ready" to be properly hidden when the module is disabled or profiles are changed --- IceElement.lua | 2 +- IceHUD.lua | 27 +++++++++++++++++++++++++-- modules/CustomCDBar.lua | 4 ++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/IceElement.lua b/IceElement.lua index fa37136..6dc4f5c 100644 --- a/IceElement.lua +++ b/IceElement.lua @@ -98,7 +98,7 @@ function IceElement.prototype:Disable(core) if (not core) then self.moduleSettings.enabled = false end - self:Show(false) + self:Show(false, true) self:UnregisterAllEvents() end diff --git a/IceHUD.lua b/IceHUD.lua index 2d28d9b..de1b3b4 100644 --- a/IceHUD.lua +++ b/IceHUD.lua @@ -863,6 +863,20 @@ StaticPopupDialogs["ICEHUD_CHANGED_DOGTAG"] = { hideOnEscape = 0 } +StaticPopupDialogs["ICEHUD_CHANGED_PROFILE_COMBAT"] = { + text = "You have changed IceHUD profiles while in combat. This can cause problems due to Blizzard's secure frame policy. You may need to reload your UI to repair IceHUD.", + button1 = OKAY, + OnShow = function(self) + self:SetFrameStrata("TOOLTIP") + end, + OnHide = function(self) + self:SetFrameStrata("DIALOG") + end, + timeout = 0, + whileDead = 1, + hideOnEscape = 0 +} + function IceHUD:OnInitialize() self:SetDebugging(false) self:Debug("IceHUD:OnInitialize()") @@ -892,7 +906,13 @@ function IceHUD:OnInitialize() LibStub("AceConfig-3.0"):RegisterOptionsTable("IceHUD", self.options, "/icehudcl") ConfigDialog:SetDefaultSize("IceHUD", 750, 650) - self:RegisterChatCommand("icehud", function() IceHUD:OpenConfig() end) + self:RegisterChatCommand("icehud", function() + if not UnitAffectingCombat("player") then + IceHUD:OpenConfig() + else + DEFAULT_CHAT_FRAME:AddMessage("|cff8888ffIceHUD|r: Combat lockdown restriction. Leave combat and try again.") + end + end) self:RegisterChatCommand("rl", function() ReloadUI() end) self:SyncSettingsVersions() @@ -1052,7 +1072,7 @@ function IceHUD:InitLDB() label = "IceHUD", icon = "Interface\\Icons\\Spell_Frost_Frost", OnClick = function(button, msg) - if not (UnitAffectingCombat("player")) then + if not UnitAffectingCombat("player") then IceHUD:OpenConfig() else DEFAULT_CHAT_FRAME:AddMessage("|cff8888ffIceHUD|r: Combat lockdown restriction. Leave combat and try again.") @@ -1174,6 +1194,9 @@ function IceHUD:OnDisable() end function IceHUD:PreProfileChanged(db) + if UnitAffectingCombat("player") then + StaticPopup_Show("ICEHUD_CHANGED_PROFILE_COMBAT") + end self.IceCore:Disable() end diff --git a/modules/CustomCDBar.lua b/modules/CustomCDBar.lua index f8e0ecf..f8262ca 100644 --- a/modules/CustomCDBar.lua +++ b/modules/CustomCDBar.lua @@ -535,8 +535,8 @@ function IceCustomCDBar.prototype:IsReady() return is_ready end -function IceCustomCDBar.prototype:Show(bShouldShow) - if self.moduleSettings.enabled then +function IceCustomCDBar.prototype:Show(bShouldShow, bForceHide) + if self.moduleSettings.enabled and not bForceHide then if (self.moduleSettings.displayMode == "Always") then if not self.bIsVisible then IceCustomCDBar.super.prototype.Show(self, true)