Mercurial > wow > ouroloot
diff core.lua @ 55:ac57a4342812
More people going to be looking at g_loot entries, so start cleaning up older fields a bit, and handle loading older data.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Sat, 07 Apr 2012 05:40:20 +0000 |
parents | 6d5fcbdc0590 |
children | fcc0d0ff5832 |
line wrap: on
line diff
--- a/core.lua Sat Apr 07 04:59:27 2012 +0000 +++ b/core.lua Sat Apr 07 05:40:20 2012 +0000 @@ -18,7 +18,7 @@ - startday table with month/day/year/text fields from makedate() Boss specific g_loot indices: -- bosskill name of boss/encounter; not necessarily a kill; +- bossname name of boss/encounter; - may be changed if "snarky boss names" option is enabled - reason wipe/kill ("pull" does not generate an entry) - instance name of instance, including size and difficulty @@ -88,6 +88,7 @@ ------ Constants local option_defaults = { + ['datarev'] = 15, -- cheating, this isn't actually an option ['popup_on_join'] = true, ['register_slashloot'] = true, ['scroll_to_bottom'] = true, @@ -441,6 +442,7 @@ end,10,self) end opts = OuroLootSV_opts + local stored_datarev = opts.datarev for opt,default in pairs(option_defaults) do if opts[opt] == nil then opts[opt] = default @@ -508,6 +510,19 @@ self.history_all.HISTFORMAT = nil -- don't keep this in live data --OuroLootSV_hist = nil + -- Handle changes to the stored data format, in stages from oldest to + -- newest. This won't look coherent until multiple stages are happening. + if stored_datarev == nil then + self:Print("Transitioning saved data format to 15...") + for i,e in ipairs(OuroLootSV) do + if e.bosskill then + e.bossname, e.bosskill = e.bosskill, nil + end + end + stored_datarev = 15 + end + --if stored_datarev == 15 then.... + _init(self) self.dprint('flow', "version strings:", revision_large, self.status_text) self.OnInitialize = nil @@ -801,7 +816,7 @@ if addon.latest_instance then return end addon.latest_instance = instance_tag() addon:_mark_boss_kill (addon._addLootEntry{ - kind='boss',reason='kill',bosskill=[[trash]],instance=addon.latest_instance,duration=0 + kind='boss',reason='kill',bossname=[[trash]],instance=addon.latest_instance,duration=0 }) end @@ -1003,7 +1018,7 @@ elseif cmd == "fake" then -- maybe comment this out for real users self:_mark_boss_kill (self._addLootEntry{ - kind='boss',reason='kill',bosskill="Baron Steamroller",instance=instance_tag(),duration=0 + kind='boss',reason='kill',bossname="Baron Steamroller",instance=instance_tag(),duration=0 }) self:CHAT_MSG_LOOT ('manual', my_name, 54797) if self.display then @@ -1395,7 +1410,7 @@ if boss.reason == 'kill' then addon:_mark_boss_kill (bossi) if opts.chatty_on_kill then - addon:Print("Registered kill for '%s' in %s!", boss.bosskill, boss.instance) + addon:Print("Registered kill for '%s' in %s!", boss.bossname, boss.instance) end end wipe(candidates) @@ -1429,7 +1444,7 @@ -- DBM might not trigger for a while). local c = { kind = 'boss', - bosskill = bossname, -- minor misnomer, might not actually be a kill + bossname = bossname, reason = reason, instance = intag, duration = duration, -- these two deliberately may be nil @@ -1450,7 +1465,7 @@ self:Print("Something horribly wrong;", index, "is not a valid entry!") return end - if not e.bosskill then + if not e.bossname then self:Print("Something horribly wrong;", index, "is not a boss entry!") return end @@ -1463,8 +1478,8 @@ local i,d = 1,g_loot[1] while d ~= e do - if d.bosskill and - d.bosskill == e.bosskill and + if d.bossname and + d.bossname == e.bossname and d.instance == e.instance and d.reason == 'wipe' then @@ -1648,7 +1663,7 @@ assert(g_loot[is].kind == 'boss') local boss = tremove (g_loot, is) - --pprint('loot', "MOVING", boss.bosskill) + --pprint('loot', "MOVING", boss.bossname) tinsert (g_loot, should_be, boss) return should_be end