diff --git a/HistOffline.lua b/HistOffline.lua
index 5510254..90b965b 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -67,13 +67,14 @@ function write_saved(o)
end
accounts = {}
+accounts_list = {} -- String list for selection dialog
naccounts = 0
for i,_ in pairs(History_SV["Default"]) do
accounts[i] = {}
accounts[i].names = {} -- intermediate table for sorting. WIP. Array formatted.
accounts[i].name = {}
- myaccount = i
naccounts = naccounts +1
+ table.insert(accounts_list, i)
end
function write_data()
@@ -122,7 +123,7 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
iup.SetAttribute(accounts[acc].logtable, "ALIGNMENT2", "ALEFT")
iup.SetAttribute(accounts[acc].logtable, "WIDTH0", 80)
iup.SetAttribute(accounts[acc].logtable, "WIDTH1", 85)
- iup.SetAttribute(accounts[acc].logtable, "WIDTH2", 200)
+ iup.SetAttribute(accounts[acc].logtable, "WIDTH2", 300)
-- Load log data
local Line=0
@@ -424,40 +425,48 @@ function btn_eraselog:action()
lbl_Status_bar.title = L.Erased
end
-options = {"@HisDad", "@Jerm01"}
-function select_account()
- selected = iup.ListDialog (1, "Select Account",
- 2, --Size
- options,
- 1, --Initial
- 1,naccounts --MaxCol MaxLine
- )
- print (selected)
+
+function select_account()
+ local selected
+ if naccounts > 1 then
+ selected = iup.ListDialog (1, L.SelectA,
+ 2, --Size
+ accounts_list,
+ 1, --Initial
+ 1,naccounts --MaxCol MaxLine
+ )
+
+ if selected <0 then
+ return nil -- Cancelled
+ else
+ return accounts_list[selected+1]
+ end
+ else
+ return accounts_list[1] -- only 1 account, no need for Dialog
+ end
end
-myaccount = "@Jerm01"
-if naccounts > 1 then -- Create dialog to choose account
+-- Create dialog to choose account
+myaccount=select_account()
+if myaccount ~=nil then
+ -- Create dialog if not canceled
+ dlg = iup.dialog{iup.vbox{accounts[myaccount].tabs,
+ iup.hbox{lbl_Status_bar, -- Bottom Status bar.
+ iup.fill{},
+ },
+ margin="5x5",
+ },
+ title=L.title .. myaccount,
+ size=accounts[myaccount].panelsize
+ }
-end
--- select_account()
-
--- Create dialog
-dlg = iup.dialog{iup.vbox{accounts[myaccount].tabs,
- iup.hbox{lbl_Status_bar, -- Bottom Status bar.
- iup.fill{},
- },
- margin="5x5",
- },
- title=L.title .. myaccount,
- size=accounts[myaccount].panelsize
- }
-
--- Shows dialog in the center of the screen
-dlg:showxy(iup.CENTER, iup.CENTER)
-
-if (iup.MainLoopLevel()==0) then
- iup.MainLoop()
+ -- Shows dialog in the center of the screen
+ dlg:showxy(iup.CENTER, iup.CENTER)
+
+ if (iup.MainLoopLevel()==0) then
+ iup.MainLoop()
+ end
end
diff --git a/en.lua b/en.lua
index 710b792..2d716c5 100644
--- a/en.lua
+++ b/en.lua
@@ -41,7 +41,8 @@ Area_names = {
EraseWarning = "Do not Erase the log while a Character is logged in to ESO. Your changes will be overwritten.",
Welcome = "Welcome to HisDad\'s offline history viewer.",
Erased = "The Log has been erased.",
- FirstDeath = "First Death"
+ FirstDeath = "First Death",
+ SelectA = "Select Account"
}
diff --git a/history.lua b/history.lua
index 638d7af..c4c60a6 100644
--- a/history.lua
+++ b/history.lua
@@ -28,6 +28,25 @@ local function log(text)
["Char"] = hist.player,
})
end
+
+local function get_start () -- get better start date from Ach 993 (First main line quest out of training)
+ _,_,_,_,completed,adate,atime= GetAchievementInfo(993)
+ if completed then
+ local quest_time =(luatz_esodate(adate .. " " .. atime)+ hist.tz_offset)
+ if hist.me.Recorded == nil then -- starting but complete
+ hist.me.Recorded = quest_time
+ elseif hist.me.Recorded > quest_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. " .. adate .. " " .. atime )
+ hist.me.Recorded = quest_time
+ end
+ else -- Not Completed, early start on new char
+ hist.me. Recorded = GetTimeStamp()
+ end
+end
+
local function Achievement(_, name, points, id, link)
local description
local category_id = GetCategoryInfoFromAchievementId(id)
@@ -167,7 +186,8 @@ local function setup_char()
hist.SV.data[hist.player] = {} -- initialise data for current char
hist.me = hist.SV.data[hist.player]
- hist.me.Recorded = GetTimeStamp()
+-- hist.me.Recorded = GetTimeStamp()
+ get_start() -- Set Recorded
hist.me.Class = GetUnitClass("player")
hist.me.Race = GetUnitRace("player")
hist.me.Gender = gendertext()
@@ -283,7 +303,11 @@ function hist.Initialise(_, addOnName)
hist.SV.data[hist.player].OverWrite = true
end
end
- log_truncate(20)
+ if hist.debug then
+ log_truncate(50)
+ else
+ log_truncate(20)
+ end
hist.me["LoginTime"] = GetTimeStamp()
@@ -302,5 +326,6 @@ end
SLASH_COMMANDS["/histload"] = load_history
SLASH_COMMANDS["/histfix"] = fix
SLASH_COMMANDS["/histclear"] = log_clear
+SLASH_COMMANDS["/histstart"] = get_start
EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_ADD_ON_LOADED, hist.Initialise)