Mercurial > wow > ouroloot
diff core.lua @ 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 |
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)