version 14, try UTF8 and auto reload

His Dad [09-09-15 - 08:46]
version 14, try UTF8 and auto reload
Filename
Doc/Changelog.txt
HistOffline.lua
history.lua
history.txt
diff --git a/Doc/Changelog.txt b/Doc/Changelog.txt
index 93e88ba..219a085 100644
--- a/Doc/Changelog.txt
+++ b/Doc/Changelog.txt
@@ -1,3 +1,10 @@
+2015-09-10 version 14
+	Perform an achievement load on login, but not more often than every 8 hours.
+	This will help with people who do a dungeon then CTD on exit.
+
+	Try setting UTF8 mode
+
+
 2015-09-01 version 13
 	API bump

diff --git a/HistOffline.lua b/HistOffline.lua
index d8aa9e2..9498813 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -10,9 +10,9 @@ local BG_Colour_Not_Complete = "#FFB67D"
 local BG_Colour_Complete = "#A4FF5A"
 local Colour_Heading_Complete = "#58FA58"

-
+iup.SetGlobal("UTF8MODE","YES")
 -- ========================
-version= "12"
+version= "14"
 require( "iuplua" )
 require( "iupluacontrols" )
 dofile "../../SavedVariables/History.lua"
diff --git a/history.lua b/history.lua
index 32a7985..a72cd1a 100644
--- a/history.lua
+++ b/history.lua
@@ -1,6 +1,6 @@
 hist = {
 	name = "history",
-	version = "13",
+	version = "14",
 	initialised = false,
 	SV={},
 	L={},
@@ -233,6 +233,7 @@ local function setup_char()
 			deaths = 0

 		}  -- end of defaults
+		hist.me["LoadTime"] = GetTimeStamp()
 		load_history()
 		get_start()
 end
@@ -325,7 +326,6 @@ function hist.Initialise(_, addOnName)
 			hist.me.maps = {}
 		end

-
 		    if hist.debug then
 					log("Begin Duplicate tests, Saved  -- Calculated" )
 					log("Alliance test: " .. hist.me.Alliance .. " -- " .. zo_strformat("<<C:1>>",GetAllianceName(GetUnitAlliance("player"))))
@@ -364,12 +364,26 @@ function hist.Initialise(_, addOnName)
 	end

 	hist.SV.lang=GetCVar("language.2")	-- For offline use
-	hist.me["LoginTime"] = GetTimeStamp()
+
 	if hist.me.logins == nil then
 		hist.me.logins = 0
 	end
 	hist.me.logins = hist.me.logins +1		-- count them.

+	hist.me["LoginTime"] = GetTimeStamp()
+
+	if hist.me["ReloadTime"] == nil then
+		hist.me["ReloadTime"] = GetTimeStamp()
+	end
+
+	if  hist.me["ReloadTime"] + 42880 <= GetTimeStamp() then	 --  8 hours or more have past
+		load_history()		-- pickup anything that might be missed
+		hist.me["ReloadTime"] = GetTimeStamp()
+		log ("Startup: Timed check on missed achievements.")
+	end
+
+
+
 	EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_ACHIEVEMENT_AWARDED, Achievement)
 	EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_LEVEL_UPDATE, levelup)
 	EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_VETERAN_RANK_UPDATE, levelup)
diff --git a/history.txt b/history.txt
index 1112ebd..2f9b581 100644
--- a/history.txt
+++ b/history.txt
@@ -1,6 +1,6 @@
 ## Title: Dad's History
 ## APIVersion: 100012
-## Version: 13
+## Version: 14
 ## Author: HisDad
 ## Description: Record progress of all characters for offline viewing.
 ## SavedVariables: History_SV