Mercurial > wow > ouroloot
changeset 77:a07c9dd79f3a
Formalize the code handling unique ID collisions that turn out to not be avoidable with improv numbers. Turn on debug.comm and debug.loot with @debug@ markers.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Mon, 11 Jun 2012 21:03:16 +0000 |
parents | 124da015c4a2 |
children | f8118aa5fbb8 |
files | core.lua gui.lua |
diffstat | 2 files changed, 47 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/core.lua Fri Jun 08 08:05:37 2012 +0000 +++ b/core.lua Mon Jun 11 21:03:16 2012 +0000 @@ -143,10 +143,7 @@ .." a download URL for copy-and-pasting. You can %s to ping other raiders" .." for their installed versions (same as '/ouroloot ping' or clicking the" .." 'Ping!' button on the options panel)." -local unique_collision = "|cffff1010%s:|r Item '%s' was carrying unique tag " - .."<%s>, but that was already in use! (New sender was '%s', previous cache " - .."entry was <%s/%s>.) This may require a live human to figure out; the " - .."loot in question has not been stored." +local unique_collision = "|cffff1010%s:|r|nItem '%s' was carrying unique tag <%s>, but that was already in use; tried to generate a new tag and failed!|n|nRemote sender was '%s', previous cache entry was <%s/%s>.|n|nThis may require a live human to figure out; the loot in question has not been stored." local remote_chatty = "|cff00ff00%s|r changed %d/%s from %s%s|r to %s%s|r" local qualnames = { ['gray'] = 0, ['grey'] = 0, ['poor'] = 0, ['trash'] = 0, @@ -195,6 +192,12 @@ cache = false, alsolog = false, } + --@debug@ + DEBUG_PRINT = true + debug.loot = true + debug.comm = true + --@end-debug@ + -- This looks ugly, but it factors out the load-time decisions from -- the run-time ones. Args to [dp]print are concatenated with spaces. if tekdebug then @@ -337,6 +340,7 @@ -- En masse forward decls of symbols defined inside local blocks local _register_bossmod, makedate, create_new_cache, _init, _log local _history_by_loot_id, _notify_about_remote, _setup_unique_replace +local _unavoidable_collision -- Try to extract numbers from the .toc "Version" and munge them into an -- integral form for comparison. The result doesn't need to be meaningful as @@ -1378,8 +1382,7 @@ i = g_uniques[unique] local err = unique_collision:format (ERROR_CAPS, iname, unique, tostring(from), tostring(i.loot), tostring(i.history)) - self:Print(err) - _G.PlaySoundFile ([[Interface\AddOns\Ouro_Loot\sfrr.ogg]], "master") + _unavoidable_collision (err) -- Make sure this is logged one way or another ;(self.debug.loot and self.dprint or pprint)('loot', "COLLISION", prefix, err); ret1, ret2 = nil, err @@ -2475,6 +2478,33 @@ end end +do + local clicky + function _unavoidable_collision (err) + -- This should happen so rarely that it's not worth moving into gui.lua + if not StaticPopupDialogs["OUROL_COLLISION"] then + StaticPopupDialogs["OUROL_COLLISION"] = flib.StaticPopup{ + button1 = OKAY, + } + clicky = addon.format_hypertext( + [[ SYSTEM FAILURE -- RELEASE RINZLER ]], "|cffff0000", + function() StaticPopup_Show "OUROL_COLLISION" end) + end + StaticPopupDialogs["OUROL_COLLISION"].text = err + _G.PlaySoundFile ([[Interface\AddOns\Ouro_Loot\sfrr.ogg]], "Master") + addon:Print (" ") + addon:Print (" ", clicky) + addon:Print (" ") + end +end +--function DOTEST() +-- local err = unique_collision:format (ERROR_CAPS, +-- "Codpiece of the Grimacing Lunatic", +-- 'n3183021', 'Farmbuyer', '14', '78') +-- _unavoidable_collision (err) +-- pprint('ohfuck', "COLLISION", err) +--end + ------ Saved texts function addon:check_saved_table(silent_p)
--- a/gui.lua Fri Jun 08 08:05:37 2012 +0000 +++ b/gui.lua Mon Jun 11 21:03:16 2012 +0000 @@ -1875,13 +1875,19 @@ w = mkbutton("MidS-H", [[not exactly an Easter egg, with sound]]) w:SetRelativeWidth(0.15) w:SetCallback("OnClick", function() - PlaySoundFile[[Sound\Music\WorldEvents\HordeFirepole.mp3]] + PlaySoundFile ([[Sound\Music\WorldEvents\HordeFirepole.mp3]], "Master") end) simple:AddChild(w) w = mkbutton("MidS-A", [[not exactly an Easter egg, with sound]]) w:SetRelativeWidth(0.15) w:SetCallback("OnClick", function() - PlaySoundFile[[Sound\Music\WorldEvents\AllianceFirepole.mp3]] + PlaySoundFile ([[Sound\Music\WorldEvents\AllianceFirepole.mp3]], "Master") + end) + simple:AddChild(w) + w = mkbutton("SFRR", [[test]]) + w:SetRelativeWidth(0.15) + w:SetCallback("OnClick", function() + PlaySoundFile ([[Interface\AddOns\Ouro_Loot\sfrr.ogg]], "Master") end) simple:AddChild(w) grp:AddChild(simple) @@ -2663,7 +2669,7 @@ } StaticPopupDialogs["OUROL_REMIND"] = flib.StaticPopup{ - text = "Do you wish to activate Ouro Loot?\n\n(Hit the Escape key to close this window without clicking; Enter is the same as Activate)", + text = "Do you wish to activate Ouro Loot?|n|n(Hit the Escape key to close this window without clicking; Enter is the same as Activate)", button1 = "Activate recording", -- "accept", left button2 = "Broadcast Only", -- "cancel", middle button3 = HELP_LABEL, -- "alt", right @@ -2857,10 +2863,10 @@ t = flib.StaticPopup{ -- Concatenate this once at load time. There is no ITEM_QUALITY_LEGENDARY constant. text = "Include a snapshot of the " .. ITEM_QUALITY_COLORS[5].hex - .. "CURRENT|r raid?\n\nClicking '" .. YES .. "' will allow this entry to " + .. "CURRENT|r raid?|n|nClicking '" .. YES .. "' will allow this entry to " .. "appear in attendance lists, but with the roster as it is NOW, not as it " .. "was THEN. Clicking '" .. NO .."' means this kill cannot be included in " - .. "attendance.\n\n(Enter = '" .. YES .."', Escape = '" .. CANCEL .. "')", + .. "attendance.|n|n(Enter = '" .. YES .."', Escape = '" .. CANCEL .. "')", button1 = YES, -- "accept", left button2 = NO, -- "cancel", middle button3 = CANCEL, -- "alt", right