Mercurial > wow > ouroloot
changeset 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 |
files | core.lua gui.lua text_tabs.lua |
diffstat | 3 files changed, 37 insertions(+), 22 deletions(-) [+] |
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
--- a/gui.lua Sat Apr 07 04:59:27 2012 +0000 +++ b/gui.lua Sat Apr 07 05:40:20 2012 +0000 @@ -302,7 +302,7 @@ v = ("wipe (%d:%.2d)"):format(math.floor(e.duration/60), math.floor(e.duration%60)) end e.cols = { - {value = e.bosskill}, + {value = e.bossname}, {value = e.instance}, {value = v or ""}, } @@ -522,7 +522,7 @@ df_DELETE = function(rowi) local gone = tremove(g_loot,rowi) addon:Print("Removed %s.", - gone.itemlink or gone.bosskill or gone.startday.text) + gone.itemlink or gone.bossname or gone.startday.text) if gone.kind == 'loot' and IsShiftKeyDown() then addon:_delHistoryEntry (rowi, gone) end @@ -553,12 +553,12 @@ repeat local e = g_loot[rowi] if e.kind == 'boss' then - addon:broadcast('boss', e.reason, e.bosskill, e.instance) + addon:broadcast('boss', e.reason, e.bossname, e.instance) elseif e.kind == 'loot' then -- This only works because GetItemInfo accepts multiple argument formats addon:broadcast('loot', e.person, e.itemlink, e.count, e.cols[3].value) end - addon:Print("Rebroadcast entry", rowi, e.itemlink or e.bosskill or UNKNOWN) + addon:Print("Rebroadcast entry", rowi, e.itemlink or e.bossname or UNKNOWN) rowi = rowi + 1 until rowi >= fencepost end, @@ -804,7 +804,7 @@ EasyMenu (eoi_player_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") elseif kind == 'boss' then - eoi_boss_dropdown[1].text = e.bosskill + eoi_boss_dropdown[1].text = e.bossname EasyMenu (eoi_boss_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") elseif kind == 'time' then @@ -967,8 +967,8 @@ for i,e in ipairs(g_loot) do if type(e.cols) ~= 'table' then addon:Print("ARGH, index",i,"bad in eoi_OGS, type",type(e.cols), - "entry kind", e.kind, "data", e.itemname or e.bosskill or e.startday.text, - "-- please take a screenshot and send to Farmbuyer.") + "entry kind", e.kind, "data", e.itemname or e.bossname or e.startday.text, + "-- please take a screenshot and send to Farmbuyer@US-Kilrogg.") tabledump(e) end end @@ -996,8 +996,8 @@ for i,e in ipairs(g_loot) do if type(e.cols) ~= 'table' then addon:Print("ARGH, index",i,"bad in eoi refresh, refreshed at", opt_index, "type",type(e.cols), - "entry kind", e.kind, "data", e.itemname or e.bosskill or e.startday.text, - "-- please take a screenshot and send to Farmbuyer.") + "entry kind", e.kind, "data", e.itemname or e.bossname or e.startday.text, + "-- please take a screenshot and send to Farmbuyer@US-Kilrogg.") tabledump(e) end end @@ -1152,7 +1152,7 @@ ["Delete this loot history"] = function(rowi) --local gone = tremove(g_loot,rowi) --addon:Print("Removed %s.", - --gone.itemlink or gone.bosskill or gone.startday.text) + --gone.itemlink or gone.bossname or gone.startday.text) end, } local hist_dropdown = gen_easymenu_table( @@ -2133,7 +2133,7 @@ -- been real loot happening at the same time. local boss_index = addon._addLootEntry{ kind = 'boss', - bosskill = (OuroLootSV_opts.snarky_boss and addon.boss_abbrev[data.name] or data.name) or data.name, + bossname = (OuroLootSV_opts.snarky_boss and addon.boss_abbrev[data.name] or data.name) or data.name, reason = 'kill', instance = data.instance, duration = 0,
--- a/text_tabs.lua Sat Apr 07 04:59:27 2012 +0000 +++ b/text_tabs.lua Sat Apr 07 05:40:20 2012 +0000 @@ -89,7 +89,7 @@ cache[#cache+1] = "\n[b]" .. e.instance .. "[/b]" generated.last_instance = e.instance end - cache[#cache+1] = "[i]" .. e.bosskill .. "[/i]" + cache[#cache+1] = "[i]" .. e.bossname .. "[/i]" elseif e.kind == 'time' then cache[#cache+1] = "[b]" .. e.startday.text .. "[/b]" @@ -142,7 +142,7 @@ local e = loot[i] if e.kind == 'boss' and e.reason == 'kill' then - cache[#cache+1] = ("\n%s -- %s\n%s"):format(e.instance, e.bosskill, e.raiderlist or '<none recorded>') + cache[#cache+1] = ("\n%s -- %s\n%s"):format(e.instance, e.bossname, e.raiderlist or '<none recorded>') elseif e.kind == 'time' then cache[#cache+1] = e.startday.text