Mercurial > wow > ouroloot
diff core.lua @ 97:ba5ff82dcf19
(First breaking change for MoP/3.0, incomplete transition.) Move generic user options to acedb. Remove older savedvar-upgrade code for a clean break. Add a profiles tab since it will be expected; changing profiles not yet implemented.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Fri, 27 Jul 2012 10:23:12 +0000 |
parents | 780b7e0eeeeb |
children | b5a55c69ef67 |
line wrap: on
line diff
--- a/core.lua Thu Jul 26 20:46:00 2012 +0000 +++ b/core.lua Fri Jul 27 10:23:12 2012 +0000 @@ -102,9 +102,6 @@ OuroLootSV_saved = nil -- table of copies of saved texts, default nil; keys -- are numeric indices of tables, subkeys of those -- are name/forum/attend/date -OuroLootSV_opts = nil -- same as option_defaults until changed - -- autoshard: optional name of disenchanting player, default nil - -- threshold: optional loot threshold, default nil OuroLootSV_hist = nil OuroLootSV_log = {} @@ -138,6 +135,8 @@ ['precache_history_uniques'] = false, ['chatty_on_remote_changes'] = false, ['chatty_on_remote_changes_frame'] = 1, + ['itemfilter'] = {}, + ['itemvault'] = {}, } local virgin = "First time loaded? Hi! Use the /ouroloot command" .." to show the main display. You should probably browse the instructions" @@ -712,75 +711,33 @@ g_restore_p = OuroLootSV ~= nil self.dprint('flow', "oninit sets restore as", g_restore_p) - if _G.OuroLootSV_opts == nil then - _G.OuroLootSV_opts = {} + if _G.OuroLootOptsDB == nil then local vclick = self.format_hypertext ([[click here]], ITEM_QUALITY_UNCOMMON, 'help') self:ScheduleTimer(function(s) + for id in pairs(self.default_itemfilter) do + opts.itemfilter[id] = true + end + for id in pairs(self.default_itemvault) do + opts.itemvault[id] = true + end s:Print(virgin, tostring(vclick)) virgin = nil end,10,self) else virgin = nil end - opts = _G.OuroLootSV_opts + self.db = _G.LibStub("AceDB-3.0"):New("OuroLootOptsDB", + { profile = option_defaults } , --[[Default=]]true) + opts = self.db.profile + + --[[ local stored_datarev = opts.datarev or 14 for opt,default in pairs(option_defaults) do if opts[opt] == nil then opts[opt] = default end end - opts.datarev = option_defaults.datarev - - -- transition&remove old options - opts['forum_use_itemid'] = nil - if opts['forum_format'] then - opts.forum['Custom...'] = opts['forum_format'] - opts['forum_format'] = nil - end - if opts.forum['[url]'] then - opts.forum['[url] Wowhead'] = opts.forum['[url]'] - opts.forum['[url]'] = nil - opts.forum['[url] MMO/Wowstead'] = option_defaults.forum['[url] MMO/Wowstead'] - if opts['forum_current'] == '[url]' then - opts['forum_current'] = '[url] Wowhead' - end - end - if opts['register_slashloot'] then - self:Print[[The "/loot" command is no longer available, because it is used by Blizzard in MoP. You can toggle on other synonyms for "/ouroloot" in the Options tab.]] - end - opts['register_slashloot'] = nil - option_defaults = nil - if OuroLootSV then -- may not be the same as testing g_restore_p soon - if OuroLootSV.saved then - OuroLootSV_saved = OuroLootSV.saved; OuroLootSV.saved = nil - end - if OuroLootSV.threshold then - opts.threshold = OuroLootSV.threshold; OuroLootSV.threshold = nil - end - if OuroLootSV.autoshard then - opts.autoshard = OuroLootSV.autoshard; OuroLootSV.autoshard = nil - end - end - - -- get item filter table if needed - if opts.itemfilter == nil then - opts.itemfilter = self.default_itemfilter - else - -- remove old stuff that doesn't "drop" anymore - -- find some way of only doing this once - opts.itemfilter[29434] = nil -- Badge of Justice - opts.itemfilter[40752] = nil -- Emblem of Heroism - opts.itemfilter[40753] = nil -- Emblem of Valor - opts.itemfilter[45624] = nil -- Emblem of Conquest - opts.itemfilter[43228] = nil -- Stone Keeper's Shard - opts.itemfilter[47241] = nil -- Emblem of Triumph - opts.itemfilter[49426] = nil -- Emblem of Frost - end - self.default_itemfilter = nil - if opts.itemvault == nil then - opts.itemvault = self.default_itemvault - end - self.default_itemvault = nil + opts.datarev = option_defaults.datarev]] self:RegisterChatCommand("ouroloot", "OnSlash") if opts.register_slash_synonyms then @@ -825,65 +782,11 @@ -- Handle changes to the stored data format in stages from oldest to newest. -- bumpers[X] is responsible for updating from X to X+1. -- (This is turning into a lot of loops over the same table. Consolidate?) - if OuroLootSV then + if false and OuroLootSV then local dirty = false local bumpers = {} - bumpers[14] = function() - for i,e in ipairs(OuroLootSV) do - if e.bosskill then - e.bossname, e.bosskill = e.bosskill, nil - end - end - end - - bumpers[15] = function() - for i,e in ipairs(OuroLootSV) do - if e.kind == 'boss' then - e.maxsize, e.raiderlist, e.raidersnap = 0, nil, {} - end - end - OuroLootSV.raiders = OuroLootSV.raiders or {} - for name,r in pairs(OuroLootSV.raiders) do - r.subgroup = 0 - end - end - - bumpers[16] = function() - for i,e in ipairs(OuroLootSV) do - if e.kind == 'boss' then -- brown paper bag bugs - e.raidersnap = e.raidersnap or {} - e.maxsize = e.maxsize or 0 - end - end - end - - bumpers[17] = function() - for i,e in ipairs(OuroLootSV) do - if e.kind == 'loot' and e.is_heroic then - e.variant, e.is_heroic = 1, nil - -- Could try detecting any previous LFR loot here, but... gah - end - end - end - - bumpers[18] = bumpers[16] - -- In the not-very-many days between 16 and 19, I managed to break - -- the exact same data in the exact same way. At least they're - -- not actually running the same loop twice... probably... sigh. - - bumpers[19] = function() - local date = _G.date - for i,e in ipairs(OuroLootSV) do - if e.kind == 'loot' then - if e.history_unique then - e.unique, e.history_unique = e.history_unique, nil - end - if e.unique == nil or #e.unique == 0 then - e.unique = e.id .. e.person .. date("%Y/%m/%d %H:%M",e.stamp) - end - end - end - end + --bumpers[14] = function() start + --bumpers[19] = function() latest --[===[ local real = bumpers @@ -1120,7 +1023,7 @@ g_loot = {} -- not saved, just fooling PLAYER_LOGOUT tests _G.OuroLootSV = nil _G.OuroLootSV_saved = nil - _G.OuroLootSV_opts = nil + _G.OuroLootOptsDB = nil _G.OuroLootSV_hist = nil _G.OuroLootSV_log = nil _G.ReloadUI()