diff core.lua @ 51:857aea8ae33d

Also detect LFR happening and load then, before they zone in and potentially get into combat. Detect combat and avoid secure button creation in that case anyhow.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Wed, 01 Feb 2012 02:34:10 +0000
parents 973d7396e0bf
children 7af58a7dce7d
line wrap: on
line diff
--- a/core.lua	Mon Jan 30 14:43:24 2012 +0000
+++ b/core.lua	Wed Feb 01 02:34:10 2012 +0000
@@ -271,6 +271,7 @@
 	DEFAULT_CHAT_FRAME:HookScript("OnHyperlinkClick", function(self, link, string, mousebutton)
 		local ltype, arg = strsplit(":",link)
 		if ltype ~= "OuroRaid" then return end
+		-- XXX this is crap, redo this as a dispatch table with code at the call site
 		if arg == 'openloot' then
 			addon:BuildMainDisplay()
 		elseif arg == 'popupurl' then
@@ -290,6 +291,8 @@
 		elseif arg == 'waferthin' then   -- mint? it's wafer thin!
 			g_wafer_thin = true          -- fuck off, I'm full
 			addon:broadcast('bcast_denied')   -- remove once tested
+		elseif arg == 'reload' then
+			addon:BuildMainDisplay('opt')
 		end
 	end)
 
@@ -531,7 +534,14 @@
 		end
 	end
 
-	if opts.keybinding then
+	while opts.keybinding do
+		if InCombatLockdown() then
+			self:Print("Cannot create '%s' as a keybinding while in combat!",
+				opts.keybinding_text)
+			self:Print("The rest of the addon will continue to work, but you will need to reload out of combat to get the keybinding.  Either type /reload or use the button on %s in the lower right.", self.format_hypertext('reload',"the options tab",ITEM_QUALITY_UNCOMMON))
+			break
+		end
+
 		KeyBindingFrame_LoadUI()
 		local btn = CreateFrame("Button", "OuroLootBindingOpen", nil, "SecureActionButtonTemplate")
 		btn:SetAttribute("type", "macro")
@@ -544,8 +554,10 @@
 				SaveBindings(c)
 			end
 		else
-			self:Print("Error registering '%s' as a keybinding, check spelling!", opts.keybinding_text)
+			self:Print("Error registering '%s' as a keybinding, check spelling!",
+				opts.keybinding_text)
 		end
+		break
 	end
 
 	--[[