changeset 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 94dacaeff463
files Ouro_Loot.toc core.lua gui.lua
diffstat 3 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Ouro_Loot.toc	Mon Jan 30 14:43:24 2012 +0000
+++ b/Ouro_Loot.toc	Wed Feb 01 02:34:10 2012 +0000
@@ -9,6 +9,8 @@
 ## X-LoadOn-Slash: /ouroloot
 ## X-LoadOn-InterfaceOptions: Ouro Loot
 ## X-LoadOn-Raid: true
+## X-LoadOn-Events: LFG_PROPOSAL_SHOW
+## X-LoadOn-LFG_PROPOSAL_SHOW: AddonLoader:LoadAddOn('Ouro_Loot')
 
 #@no-lib-strip@
 libs\LibStub\LibStub.lua
--- 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
 
 	--[[
--- a/gui.lua	Mon Jan 30 14:43:24 2012 +0000
+++ b/gui.lua	Wed Feb 01 02:34:10 2012 +0000
@@ -155,6 +155,7 @@
 
 	-- LOD tab has been clicked on.
 	local function _handle_LOD (tabs_container,specials,tabtitle)
+		-- "tabtitle" here is the name in _taborder, not the colorized string
 		local what = _tabtexts[tabtitle]
 		local addon_index = what.LOD
 		local loaded_at = what.loaded_at
@@ -174,7 +175,7 @@
 			end
 			next_insertion_position = real_nip
 			dirty_tabs = true
-			addon:BuildMainDisplay()
+			return addon:OpenMainDisplayToTab(tabtitle) or addon:BuildMainDisplay()
 		end
 		addon.display:Hide()
 		if what.LOD_enabled then
@@ -206,8 +207,8 @@
 	-- routine handle it like any other plugin.
 	function addon:_gui_add_LOD_tab (tabtitle, folder, addon_index, enabled_p, why_not)
 		_tabtexts[tabtitle] = {
-			title = tabtitle,
-			desc = ("'%s' is not loaded yet.  Click the tab to load it now."):format(folder),
+			title = ("|cffff0000(%s)|r"):format(tabtitle),
+			desc = ("'|cffff0000%s|r' is not loaded yet.  Click the tab to load it now."):format(folder),
 			LOD = addon_index,
 			LOD_enabled = enabled_p,
 			LOD_why_not = why_not,