Update to v58 and ID File versioning for quicker loading on changes

His Dad [01-25-19 - 20:35]
Update to v58 and ID File versioning for quicker loading on changes
Non release


Signed-off-by: His Dad <John@hisdad.org>
Filename
data/ids.lua
history.lua
diff --git a/data/ids.lua b/data/ids.lua
index 8c82828..7abd86f 100644
--- a/data/ids.lua
+++ b/data/ids.lua
@@ -1,103 +1,113 @@
+hist.IDVersion="58-Beta-02"
 hist.IDs = {
--- GRP 1N
+--  Group 1N
+[1073] = true,
+[1074] = true,
+[1075] = true,
+[294] = true,
+[78] = true,
 [272] = true,
-[81] = true,
-[570] = true,
-[417] = true,
-[551] = true,
 [357] = true,
-[294] = true,
-[391] = true,
-[325] = true,
 [393] = true,
-[410] = true,
-[11] = true,
-[80] = true,
 [301] = true,
-[78] = true,
 [79] = true,
--- GRP 1V
-[1653] = true,
-[1617] = true,
-[1597] = true,
-[1635] = true,
+[80] = true,
+[391] = true,
+[410] = true,
+[325] = true,
+[11] = true,
+[551] = true,
+[81] = true,
+[417] = true,
+[570] = true,
+--  Group 1V
 [1556] = true,
-[1589] = true,
-[1573] = true,
+[1581] = true,
+[1604] = true,
 [1623] = true,
-[1549] = true,
 [1641] = true,
+[1565] = true,
+[1589] = true,
 [1610] = true,
-[1604] = true,
 [1629] = true,
-[1581] = true,
-[1565] = true,
 [1647] = true,
--- GRP 1VH
-[1658] = true,
+[1549] = true,
+[1573] = true,
+[1597] = true,
+[1617] = true,
+[1635] = true,
+[1653] = true,
+--  Group 1VH
+[1561] = true,
 [1586] = true,
-[1640] = true,
-[1652] = true,
-[1602] = true,
-[1578] = true,
-[1554] = true,
 [1608] = true,
-[1561] = true,
-[1594] = true,
-[1634] = true,
 [1628] = true,
-[1570] = true,
 [1646] = true,
+[1570] = true,
+[1594] = true,
 [1615] = true,
--- GRP 2N
-[1616] = true,
-[1603] = true,
+[1634] = true,
+[1652] = true,
+[1554] = true,
+[1578] = true,
+[1602] = true,
+[1640] = true,
+[1658] = true,
+--  Group 2N
 [1562] = true,
 [1587] = true,
-[1579] = true,
-[1555] = true,
-[1595] = true,
 [1571] = true,
--- GRP 2V
+[1595] = true,
+[1616] = true,
+[1555] = true,
+[1579] = true,
+[1603] = true,
+--  Group 2V
+[343] = true,
 [464] = true,
-[545] = true,
-[878] = true,
-[459] = true,
-[876] = true,
 [421] = true,
 [678] = true,
-[343] = true,
--- GRP 2VH
+[876] = true,
+[545] = true,
+[459] = true,
+[878] = true,
+--  Group 2VH
+[342] = true,
+[467] = true,
 [448] = true,
 [681] = true,
-[1114] = true,
-[467] = true,
 [1084] = true,
 [451] = true,
-[342] = true,
 [463] = true,
--- Trial N
+[1114] = true,
+-- Trial Trials Norm
+[991] = true,
+[990] = true,
+[1123] = true,
 [992] = true,
-[2076] = true,
+[1808] = true,
 [1343] = true,
-[1123] = true,
 [2132] = true,
-[1808] = true,
-[990] = true,
-[991] = true,
--- Trial V
-[1368] = true,
+[2076] = true,
+-- Trial Trials Vet
 [1474] = true,
-[2077] = true,
+[870] = true,
+[1080] = true,
+[1503] = true,
+[1081] = true,
+[1462] = true,
+[1113] = true,
+[1124] = true,
 [1810] = true,
+[1368] = true,
 [2133] = true,
-[1462] = true,
-[1503] = true,
--- Trial VH
+[2077] = true,
+-- Trial Trials Hard
+[1139] = true,
 [1136] = true,
 [1137] = true,
 [1138] = true,
-[1139] = true,
+[1140] = true,
 [1829] = true,
 [1344] = true,
 -- DLC
@@ -212,26 +222,51 @@ hist.IDs = {
 [510] = true,
 [511] = true,
 -- Pub
-[1056] = true,
-[1857] = true,
-[390] = true,
-[300] = true,
-[2093] = true,
-[2094] = true,
+[1068] = true,
+[1069] = true,
+[1070] = true,
 [368] = true,
+[379] = true,
 [370] = true,
-[1854] = true,
-[396] = true,
-[374] = true,
-[1050] = true,
+[388] = true,
+[300] = true,
+[372] = true,
 [376] = true,
-[1049] = true,
-[378] = true,
-[1051] = true,
-[1052] = true,
+[381] = true,
+[374] = true,
+[371] = true,
 [1053] = true,
+[380] = true,
 [1054] = true,
+[714] = true,
+[378] = true,
+[713] = true,
+[396] = true,
+[707] = true,
 [1055] = true,
+[708] = true,
+[390] = true,
+[468] = true,
+[1049] = true,
+[470] = true,
+[1050] = true,
+[445] = true,
+[1051] = true,
+[460] = true,
+[1052] = true,
+[469] = true,
+[1056] = true,
+[874] = true,
+[1857] = true,
+[1855] = true,
+[1854] = true,
+[1846] = true,
+[2094] = true,
+[2096] = true,
+[2093] = true,
+[2095] = true,
+[1235] = true,
+[1238] = true,
 -- WB
 [384] = true,
 [257] = true,
@@ -358,12 +393,6 @@ hist.IDs = {
 [383] = true,
 -- Specials
 [1248] = true,
-[1073] = true,
-[1074] = true,
-[1075] = true,
-[1068] = true,
-[1069] = true,
-[1070] = true,
 -- DLC2
 -- DLC2 Thieves Guild
 [1377] = true,
@@ -407,10 +436,8 @@ hist.IDs = {
 [1257] = true,
 [1331] = true,
 [1237] = true,
-[1235] = true,
 [1247] = true,
 [1240] = true,
-[1238] = true,
 [1330] = true,
 [1260] = true,
 [1249] = true,
@@ -546,7 +573,6 @@ hist.IDs = {
 [1832] = true,
 [1874] = true,
 [1853] = true,
-[1846] = true,
 [1875] = true,
 [1838] = true,
 [1872] = true,
@@ -554,7 +580,6 @@ hist.IDs = {
 [1873] = true,
 [1851] = true,
 [1856] = true,
-[1855] = true,
 [1833] = true,
 [1877] = true,
 [1836] = true,
@@ -576,7 +601,6 @@ hist.IDs = {
 [2205] = true,
 [2138] = true,
 [2182] = true,
-[2095] = true,
 [2137] = true,
 [2244] = true,
 [2237] = true,
@@ -599,7 +623,6 @@ hist.IDs = {
 [2232] = true,
 [2211] = true,
 [2181] = true,
-[2096] = true,
 [2222] = true,
 [2201] = true,
 [2233] = true,
diff --git a/history.lua b/history.lua
index 73445a8..12672be 100644
--- a/history.lua
+++ b/history.lua
@@ -1,6 +1,6 @@
 hist = {
 	name = "history",
-	version = 57,
+	version = 58,
 	initialised = false,
 	SV={},
 	L={},
@@ -118,6 +118,7 @@ function load_history()
 			local name,description,points,_,completed,adate,atime= GetAchievementInfo(i)
 			if completed then
 					if hist.me.ach[i] == nil then
+
 						hist.me.ach[i] = {}
 						hist.me.ach[i].name =name
 						hist.me.ach[i].description=description
@@ -450,6 +451,9 @@ if (hist.name ~= addOnName) then return end
 	hist.me.log = {}
 	end

+	if hist.me.IDVersion == nil then
+		hist.me.IDVersion = ""
+	end

 	if hist.debug then
 	log_truncate(500)
@@ -460,38 +464,46 @@ if (hist.name ~= addOnName) then return end
 	hist.SV.lang=GetCVar("language.2")	-- For offline use

 	if hist.me.logins == nil then
-	hist.me.logins = 0
+		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()
+		hist.me["ReloadTime"] = GetTimeStamp()
 	end

 	if  hist.me["ReloadTime"] + 80080 <= GetTimeStamp() then	 --  23 hours or more have past
-	load_history()		-- pickup anything that might be missed
-	hist.me["ReloadTime"] = GetTimeStamp()
-	log ("Startup: Timed check on missed achievements.")
+		load_history()		-- pickup anything that might be missed
+		hist.me["ReloadTime"] = GetTimeStamp()
+		log ("Startup: Timed check on missed achievements.")
 	end

+
+	if hist.me.IDVersion ~= hist.IDVersion then
+		log ("ID file version changed, loading")
+		hist.me.IDVersion = hist.IDVersion
+		load_history()
+	end
+
+
 	if hist.me.name ~= hist.playerName then
-	log("Changed Name, Was " ..  hist.me.name)
-	log_me("Changed Name, Was " ..  hist.me.name)
-	hist.me.name = hist.playerName
+		log("Changed Name, Was " ..  hist.me.name)
+		log_me("Changed Name, Was " ..  hist.me.name)
+		hist.me.name = hist.playerName
 	end

 	if 	hist.me.Race ~= zo_strformat("<<C:1>>",GetUnitRace("player")) then
-	log("Changed Race, Was " .. hist.me.Race)
-	log_me("Changed Race, Was " .. hist.me.Race)
-	hist.me.Race = zo_strformat("<<C:1>>",GetUnitRace("player"))
+		log("Changed Race, Was " .. hist.me.Race)
+		log_me("Changed Race, Was " .. hist.me.Race)
+		hist.me.Race = zo_strformat("<<C:1>>",GetUnitRace("player"))
 	end

 	if 	hist.me.Gender ~= gendertext() then
-	log("Changed Gender, Was " .. hist.me.Gender)
-	log_me("Changed Gender, Was " .. hist.me.Gender)
-	hist.me.Gender = gendertext()
+		log("Changed Gender, Was " .. hist.me.Gender)
+		log_me("Changed Gender, Was " .. hist.me.Gender)
+		hist.me.Gender = gendertext()
 	end

 	if (hist.SV.this_version == nil) then hist.SV.this_version = 0 end