history purge old
His Dad [07-01-15 - 19:34]
diff --git a/history.lua b/history.lua
index d027038..06a65bb 100644
--- a/history.lua
+++ b/history.lua
@@ -1,13 +1,13 @@
hist = {
name = "history",
- version = "10",
+ version = "11",
initialised = false,
SV={},
L={},
me = {},
player = "",
tz_offset =0,
- debug = false
+ debug = true
}
local function log_truncate(max)
@@ -20,6 +20,7 @@ local function log_truncate(max)
end
end
+
local function log(text)
table.insert(hist.SV.log,{["TimeStamp"]=GetTimeStamp(),
@@ -112,6 +113,7 @@ function load_history()
end
end
log("Added " .. tostring(count) .. " historic achievements.")
+ d("reloaded achievements")
end
local function fix() -- fix links etc for any old data
@@ -259,6 +261,11 @@ local function Dead()
end
end
+local function delete_old ()
+ d("deleted old characters")
+ log("deleted old characters")
+ hist.SV.old = {}
+end
function hist.Initialise(_, addOnName)
if (hist.name ~= addOnName) then return end
@@ -321,10 +328,10 @@ function hist.Initialise(_, addOnName)
if hist.debug then
log("Begin Duplicate tests, Saved -- Calculated" )
- -- log("Alliance test: " .. hist.me.Alliance .. " -- " .. zo_strformat("<<C:1>>",GetAllianceName(GetUnitAlliance("player"))))
- --- log("Race test: " .. hist.me.Race .. " -- " .. zo_strformat("<<C:1>>",GetUnitRace("player")))
- -- log("Class test: " .. hist.me.Class .. " -- " .. zo_strformat("<<C:1>>",GetUnitClass("player")))
- -- log("Gender test: " .. hist.me.Gender .. " -- " .. gendertext())
+ log("Alliance test: " .. hist.me.Alliance .. " -- " .. zo_strformat("<<C:1>>",GetAllianceName(GetUnitAlliance("player"))))
+ log("Race test: " .. hist.me.Race .. " -- " .. zo_strformat("<<C:1>>",GetUnitRace("player")))
+ log("Class test: " .. hist.me.Class .. " -- " .. zo_strformat("<<C:1>>",GetUnitClass("player")))
+ log("Gender test: " .. hist.me.Gender .. " -- " .. gendertext())
log("Level Lower: " .. hist.me.level .. " -- " .. level)
end
if hist.me.level > level
@@ -351,7 +358,7 @@ function hist.Initialise(_, addOnName)
log ("History: Fixed bad map key.")
end
if hist.debug then
- log_truncate(50)
+ log_truncate(500)
else
log_truncate(20)
end
@@ -379,5 +386,6 @@ SLASH_COMMANDS["/histload"] = load_history
SLASH_COMMANDS["/histfix"] = fix
SLASH_COMMANDS["/histclear"] = log_clear
SLASH_COMMANDS["/histstart"] = get_start
+SLASH_COMMANDS["/histdelold"]= delete_old
EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_ADD_ON_LOADED, hist.Initialise)