comparison 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
comparison
equal deleted inserted replaced
50:973d7396e0bf 51:857aea8ae33d
269 end 269 end
270 270
271 DEFAULT_CHAT_FRAME:HookScript("OnHyperlinkClick", function(self, link, string, mousebutton) 271 DEFAULT_CHAT_FRAME:HookScript("OnHyperlinkClick", function(self, link, string, mousebutton)
272 local ltype, arg = strsplit(":",link) 272 local ltype, arg = strsplit(":",link)
273 if ltype ~= "OuroRaid" then return end 273 if ltype ~= "OuroRaid" then return end
274 -- XXX this is crap, redo this as a dispatch table with code at the call site
274 if arg == 'openloot' then 275 if arg == 'openloot' then
275 addon:BuildMainDisplay() 276 addon:BuildMainDisplay()
276 elseif arg == 'popupurl' then 277 elseif arg == 'popupurl' then
277 -- Sadly, this is not generated by the packager, so hardcode it for now. 278 -- Sadly, this is not generated by the packager, so hardcode it for now.
278 -- The 'data' field is handled differently for onshow than for other callbacks. 279 -- The 'data' field is handled differently for onshow than for other callbacks.
288 end 289 end
289 addon:broadcast('bcast_responder') 290 addon:broadcast('bcast_responder')
290 elseif arg == 'waferthin' then -- mint? it's wafer thin! 291 elseif arg == 'waferthin' then -- mint? it's wafer thin!
291 g_wafer_thin = true -- fuck off, I'm full 292 g_wafer_thin = true -- fuck off, I'm full
292 addon:broadcast('bcast_denied') -- remove once tested 293 addon:broadcast('bcast_denied') -- remove once tested
294 elseif arg == 'reload' then
295 addon:BuildMainDisplay('opt')
293 end 296 end
294 end) 297 end)
295 298
296 local old = ItemRefTooltip.SetHyperlink 299 local old = ItemRefTooltip.SetHyperlink
297 function ItemRefTooltip:SetHyperlink (link, ...) 300 function ItemRefTooltip:SetHyperlink (link, ...)
529 return AC:Print (chat_prefix, str, ...) 532 return AC:Print (chat_prefix, str, ...)
530 end 533 end
531 end 534 end
532 end 535 end
533 536
534 if opts.keybinding then 537 while opts.keybinding do
538 if InCombatLockdown() then
539 self:Print("Cannot create '%s' as a keybinding while in combat!",
540 opts.keybinding_text)
541 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))
542 break
543 end
544
535 KeyBindingFrame_LoadUI() 545 KeyBindingFrame_LoadUI()
536 local btn = CreateFrame("Button", "OuroLootBindingOpen", nil, "SecureActionButtonTemplate") 546 local btn = CreateFrame("Button", "OuroLootBindingOpen", nil, "SecureActionButtonTemplate")
537 btn:SetAttribute("type", "macro") 547 btn:SetAttribute("type", "macro")
538 btn:SetAttribute("macrotext", "/ouroloot toggle") 548 btn:SetAttribute("macrotext", "/ouroloot toggle")
539 if SetBindingClick(opts.keybinding_text, "OuroLootBindingOpen") then 549 if SetBindingClick(opts.keybinding_text, "OuroLootBindingOpen") then
542 local c = GetCurrentBindingSet() 552 local c = GetCurrentBindingSet()
543 if c == ACCOUNT_BINDINGS or c == CHARACTER_BINDINGS then 553 if c == ACCOUNT_BINDINGS or c == CHARACTER_BINDINGS then
544 SaveBindings(c) 554 SaveBindings(c)
545 end 555 end
546 else 556 else
547 self:Print("Error registering '%s' as a keybinding, check spelling!", opts.keybinding_text) 557 self:Print("Error registering '%s' as a keybinding, check spelling!",
548 end 558 opts.keybinding_text)
559 end
560 break
549 end 561 end
550 562
551 --[[ 563 --[[
552 The four loot format patterns of interest, changed into relatively tight 564 The four loot format patterns of interest, changed into relatively tight
553 string match patterns. Done at enable-time rather than load-time against 565 string match patterns. Done at enable-time rather than load-time against