diff --git a/HistOffline.lua b/HistOffline.lua
index 821eef4..d38414f 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -158,15 +158,16 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
-- Creates boxes, stage from names to allow optional sorting in future.
for _,char in ipairs(accounts[acc].names) do
accounts[acc].name[char] = {}
+ local thischar = History_SV["Default"][acc]["$AccountWide"]["data"][char] -- shorter reference
-- Pull in some char data for processing
-- == Gender
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].Gender =="M" then
+ if thischar.Gender =="M" then
accounts[acc].name[char].gender = L.Male
- elseif History_SV["Default"][acc]["$AccountWide"]["data"][char].Gender == "F" then
+ elseif thischar.Gender == "F" then
accounts[acc].name[char].gender = L.Female
end
-- ==Level
- local level = History_SV["Default"][acc]["$AccountWide"]["data"][char].level
+ local level = thischar.level
accounts[acc].name[char].level = level
if (level <=50) then
@@ -175,7 +176,7 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
accounts[acc].name[char].levelstr = "V" .. tostring(level -50)
end
-- == Cumulative TimePlayed
- accounts[acc].name[char].timeplayed = math.floor(History_SV["Default"][acc]["$AccountWide"]["data"][char].levels[level].time/60)
+ accounts[acc].name[char].timeplayed = math.floor(thischar.levels[level].time/60)
-- Generate the levelling box. ============================
local leveling_box = {}
@@ -192,7 +193,7 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
-- levels as stored are unsorted, so create a level table which is sorted,
local levels = {}
- for i,_ in pairs(History_SV["Default"][acc]["$AccountWide"]["data"][char].levels) do
+ for i,_ in pairs(thischar.levels) do
table.insert(levels, i)
end
@@ -200,18 +201,18 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
for i,j in ipairs(levels) do -- traverse in sorted order
-- print (char, i,j)
- local timelevel = math.floor(History_SV["Default"][acc]["$AccountWide"]["data"][char].levels[j].time)
+ local timelevel = math.floor(thischar.levels[j].time)
accounts[acc].name[char].leveling_box.numlin = i
accounts[acc].name[char].leveling_box:setcell(i,1, j)
accounts[acc].name[char].leveling_box:setcell(i,2, math.floor(timelevel/60))
- accounts[acc].name[char].leveling_box:setcell(i,3, os.date("%Y-%m-%d",History_SV["Default"][acc]["$AccountWide"]["data"][char].levels[j].begin))
- accounts[acc].name[char].leveling_box:setcell(i,4, History_SV["Default"][acc]["$AccountWide"]["data"][char].levels[j].deaths)
- accounts[acc].name[char].leveling_box:setcell(i,5, History_SV["Default"][acc]["$AccountWide"]["data"][char].levels[j].Ach_Points)
+ accounts[acc].name[char].leveling_box:setcell(i,3, os.date("%Y-%m-%d",thischar.levels[j].begin))
+ accounts[acc].name[char].leveling_box:setcell(i,4, thischar.levels[j].deaths)
+ accounts[acc].name[char].leveling_box:setcell(i,5, thischar.levels[j].Ach_Points)
-- Do we have map data for this level?
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].levels[j].map ~= nil then
+ if thischar.levels[j].map ~= nil then
local thismap = ""
- for map, _ in pairs (History_SV["Default"][acc]["$AccountWide"]["data"][char].levels[j].map) do
- print("Map: " .. map .." " .. History_SV["Default"][acc]["$AccountWide"]["data"][char].levels[j].map[map])
+ for map, _ in pairs (thischar.levels[j].map) do
+ print("Map: " .. map .." " .. thischar.levels[j].map[map])
thismap = map
end
accounts[acc].name[char].leveling_box:setcell(i,6, thismap)
@@ -246,22 +247,22 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
-- set text to black if achievement found.
for id,_ in pairs (grp_dat) do
local colour
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].ach[id] ~= nil then
+ if thischar.ach[id] ~= nil then
colour = "FGCOLOR" .. grp_dat[id].L .. ":" .. grp_dat[id].C
iup.SetAttribute(accounts[acc].name[char].Grp_box, colour, Colour_Complete)
end
end
--Set background of heading if all done
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].ach[1073] ~= nil then --EP Vanquisher
+ if thischar.ach[1073] ~= nil then --EP Vanquisher
iup.SetAttribute(accounts[acc].name[char].Grp_box, "BGCOLOR0:1", Colour_Heading_Complete)
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].ach[1074] ~= nil then --DC Vanquisher
+ if thischar.ach[1074] ~= nil then --DC Vanquisher
iup.SetAttribute(accounts[acc].name[char].Grp_box, "BGCOLOR0:2", Colour_Heading_Complete)
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].ach[1075] ~= nil then --AD Vanquisher
+ if thischar.ach[1075] ~= nil then --AD Vanquisher
iup.SetAttribute(accounts[acc].name[char].Grp_box, "BGCOLOR0:3", Colour_Heading_Complete)
end
@@ -294,21 +295,21 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
iup.SetAttribute(accounts[acc].name[char].Pub_box, "FGCOLOR*:4", Colour_Not_Complete)
for id,_ in pairs (pub_dat) do
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].ach[id] ~= nil then
+ if thischar.ach[id] ~= nil then
local colour = "FGCOLOR" .. pub_dat[id].L .. ":" .. pub_dat[id].C
iup.SetAttribute(accounts[acc].name[char].Pub_box, colour, Colour_Complete)
end
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].ach[1068] ~= nil then --EP Conqueror
+ if thischar.ach[1068] ~= nil then --EP Conqueror
iup.SetAttribute(accounts[acc].name[char].Pub_box, "BGCOLOR0:1", Colour_Heading_Complete)
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].ach[1070] ~= nil then --DC Conqueror
+ if thischar.ach[1070] ~= nil then --DC Conqueror
iup.SetAttribute(accounts[acc].name[char].Pub_box, "BGCOLOR0:2", Colour_Heading_Complete)
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].ach[1069] ~= nil then --AD Conqueror
+ if thischar.ach[1069] ~= nil then --AD Conqueror
iup.SetAttribute(accounts[acc].name[char].Pub_box, "BGCOLOR0:3", Colour_Heading_Complete)
end
@@ -345,7 +346,7 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
for id,_ in pairs (vet_dat) do -- For Achievements we have..
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].ach[id] ~= nil then
+ if thischar.ach[id] ~= nil then
local L = vet_dat[id].L
local C = vet_dat[id].C
--Set colour of LC
@@ -358,11 +359,11 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
end
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].ach[1159] ~= nil then -- Coh All special.
+ if thischar.ach[1159] ~= nil then -- Coh All special.
iup.SetAttribute(accounts[acc].name[char].Vet_box, "FGCOLOR3:3", Colour_Heading_Complete)
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].ach[1139] ~= nil then -- Craglorn all special.
+ if thischar.ach[1139] ~= nil then -- Craglorn all special.
iup.SetAttribute(accounts[acc].name[char].Vet_box, "BGCOLOR0:5", Colour_Heading_Complete)
end
@@ -385,7 +386,7 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
iup.SetAttribute(accounts[acc].name[char].Map_box, "WIDTH0", "100")
local map_names = {}
- for map,_ in pairs(History_SV["Default"][acc]["$AccountWide"]["data"][char].maps) do
+ for map,_ in pairs(thischar.maps) do
table.insert(map_names,map)
end
@@ -396,29 +397,29 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
accounts[acc].name[char].Map_box:setcell( Line,0, map)
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].visit ~= nil then
- accounts[acc].name[char].Map_box:setcell( Line,1, History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].visit)
+ if thischar.maps[map].visit ~= nil then
+ accounts[acc].name[char].Map_box:setcell( Line,1, thischar.maps[map].visit)
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].firstvisited ~= nil then
- local firstvisit = os.date(dateformat,History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].firstvisited)
+ if thischar.maps[map].firstvisited ~= nil then
+ local firstvisit = os.date(dateformat,thischar.maps[map].firstvisitdate)
accounts[acc].name[char].Map_box:setcell( Line,2, firstvisit)
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].firstlevel ~= nil then
- accounts[acc].name[char].Map_box:setcell( Line,3, History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].firstlevel)
+ if thischar.maps[map].firstlevel ~= nil then
+ accounts[acc].name[char].Map_box:setcell( Line,3, thischar.maps[map].firstlevel)
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].timesleveled ~= nil then
- accounts[acc].name[char].Map_box:setcell( Line,4, History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].timesleveled)
+ if thischar.maps[map].timesleveled ~= nil then
+ accounts[acc].name[char].Map_box:setcell( Line,4, thischar.maps[map].timesleveled)
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].firstdeathlevel ~= nil then
- accounts[acc].name[char].Map_box:setcell( Line,5, History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].firstdeathlevel)
+ if thischar.maps[map].firstdeathlevel ~= nil then
+ accounts[acc].name[char].Map_box:setcell( Line,5, thischar.maps[map].firstdeathlevel)
end
- if History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].deaths ~= nil then
- accounts[acc].name[char].Map_box:setcell( Line,6, History_SV["Default"][acc]["$AccountWide"]["data"][char].maps[map].deaths )
+ if thischar.maps[map].deaths ~= nil then
+ accounts[acc].name[char].Map_box:setcell( Line,6, thischar.maps[map].deaths )
end
Line= Line +1
end
@@ -432,11 +433,11 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
iup.hbox{ --Top Information bar
Alignment = "ACENTER",
iup.label{title=accounts[acc].name[char].gender, FONT="Times,BOLD,10"},
- iup.label{title=History_SV["Default"][acc]["$AccountWide"]["data"][char].Race .." / ".. History_SV["Default"][acc]["$AccountWide"]["data"][char].Class, PADDING="10X0", FONT="Times,BOLD,10"},
- iup.label{title=History_SV["Default"][acc]["$AccountWide"]["data"][char].Alliance, PADDING="10X0"},
+ iup.label{title=thischar.Race .." / ".. thischar.Class, PADDING="10X0", FONT="Times,BOLD,10"},
+ iup.label{title=thischar.Alliance, PADDING="10X0"},
iup.label{title=L.Level .. ": ".. accounts[acc].name[char].levelstr, PADDING="10X0"},
- iup.label{title=L.Created .. os.date(dateformat,History_SV["Default"][acc]["$AccountWide"]["data"][char].Recorded), PADDING="10X0"},
- iup.label{title=L.LLog .. os.date(dateformat,History_SV["Default"][acc]["$AccountWide"]["data"][char].LoginTime), PADDING="10X0"},
+ iup.label{title=L.Created .. os.date(dateformat,thischar.Created), PADDING="10X0"},
+ iup.label{title=L.LLog .. os.date(dateformat,thischar.LoginTime), PADDING="10X0"},
iup.label{title=L.TPlayed .. accounts[acc].name[char].timeplayed .." " .. L.Hrs},
iup.fill{}
},
diff --git a/history.lua b/history.lua
index aa7d5c6..b65d5a5 100644
--- a/history.lua
+++ b/history.lua
@@ -45,14 +45,14 @@ local function get_start () -- get better start date from Achievements
earliest_time = GetTimeStamp()
end
- if hist.me.Recorded == nil then
- hist.me.Recorded = earliest_time
- elseif hist.me.Recorded > earliest_time then -- Quest was earlier, then reset to earlier
+ if hist.me.Created == nil then
+ hist.me.Created = earliest_time
+ elseif hist.me.Created > earliest_time then -- Quest was earlier, then reset to earlier
if hist.debug then
d("Start Time Reset for " .. hist.player)
end
log ("Start Time Reset.")
- hist.me.Recorded = earliest_time
+ hist.me.Created = earliest_time
end
end