Mercurial > wow > wowdb-profiler
changeset 14:27c153c3a1ed
Wipe SavedVariables if the current WoW build number is greater than the last recorded build number. If a merchant can repair items, record that fact.
author | James D. Callahan III <jcallahan@curse.com> |
---|---|
date | Thu, 03 May 2012 10:43:18 -0500 |
parents | 39972835bdc9 |
children | 62b0fb4281cd |
files | Main.lua |
diffstat | 1 files changed, 23 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Main.lua Tue May 01 16:07:13 2012 -0500 +++ b/Main.lua Thu May 03 10:43:18 2012 -0500 @@ -159,6 +159,20 @@ ----------------------------------------------------------------------- function WDP:OnInitialize() db = LibStub("AceDB-3.0"):New("WoWDBProfilerData", DATABASE_DEFAULTS, "Default").global + + local wow_version, build_num = _G.GetBuildInfo() + local raw_db = _G["WoWDBProfilerData"] + + build_num = tonumber(build_num) + + if raw_db.build_num and raw_db.build_num < build_num then + for entry in pairs(DATABASE_DEFAULTS.global) do + db[entry] = {} + end + raw_db.build_num = build_num + elseif not raw_db.build_num then + raw_db.build_num = build_num + end end @@ -274,9 +288,7 @@ end return true end, - [AF.OBJECT] = function() - return true - end, + [AF.OBJECT] = true, } @@ -308,10 +320,13 @@ local verify_func = LOOT_VERIFY_FUNCS[action_data.type] local update_func = LOOT_UPDATE_FUNCS[action_data.type] - if not verify_func or not update_func or not verify_func() then + if not verify_func or not update_func then return end + if _G.type(verify_func) == "function" and not verify_func() then + return + end local loot_registry = {} action_data.drops = {} @@ -415,6 +430,10 @@ merchant.sells[("%s:%s:[%s]"):format(item_id, stack_size, price_string)] = num_available end end + + if _G.CanMerchantRepair() then + merchant.can_repair = true + end end