diff --git a/Doc/Changelog.txt b/Doc/Changelog.txt
index dbfa53b..b7817ff 100644
--- a/Doc/Changelog.txt
+++ b/Doc/Changelog.txt
@@ -1,3 +1,11 @@
+2016-11-26 version 27
+ Internal changes. Unused acheivement catgories not saved.
+ Level records without maps are probably duplicates arising out of the way CP leveling works.
+ Consolidate and delete.
+ The saveedvariables files should be smaller.
+ We now account for characters in different servers.
+ Fixes for some dungeon acheivments
+
2016-10-12 version 25
Sorts characters names
Doesn't log messages about levelling while history not working. As CP are levelling and are global, this is inevitable.
diff --git a/HistOffline.lua b/HistOffline.lua
index 713b970..20d2f5f 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -14,7 +14,7 @@ local Colour_Heading_Complete = "#58FA58"
--iup.SetGlobal("UTF8MODE","YES")
-- ========================
-version= "25"
+version= "27"
require( "iuplua" )
require( "iupluacontrols" )
dofile "../../SavedVariables/History.lua"
@@ -253,7 +253,7 @@ end
accounts[acc].char_tabs = iup.tabs{} -- Top level of Char_Tabs, Character Info in Here
accounts[acc].dung_tabs = iup.tabs{} -- Top level of Dung_Tabs, Dungeon Info in Here
- accounts[acc].Status_bar = iup.label{title=L.Welcome, expand = "HORIZONTAL"}
+ accounts[acc].Status_bar = iup.label{title=L.Welcome .. " " .. L.Version .. " " .. version .. ".", expand = "HORIZONTAL"}
iup.Append(accounts[acc].mode_zbox, accounts[acc].char_tabs)
iup.Append(accounts[acc].mode_zbox, accounts[acc].dung_tabs)
@@ -918,6 +918,7 @@ end
iup.hbox{ --Top Information bar
Alignment = "ACENTER",
+ iup.label{title=thischar.world,PADDING="10X0"},
iup.label{title=me.gender, FONT="Times,BOLD,10"},
iup.label{title=thischar.Race .." / ".. thischar.Class, PADDING="10X0", FONT="Times,BOLD,10"},
iup.label{title=thischar.Alliance, PADDING="10X0"},
@@ -1197,7 +1198,7 @@ if myaccount ~=nil then
margin="5x5",
ngap="3",
},
- title=L.title .. myaccount,
+ title=L.title .. myaccount ,
size=accounts[myaccount].panelsize,
}
-- Shows dialog in the centre of the screen
diff --git a/data/de/de.lua b/data/de/de.lua
index 9010fef..4c73d34 100644
--- a/data/de/de.lua
+++ b/data/de/de.lua
@@ -90,6 +90,7 @@ DLC_names = {
ChooseChartoDelete = "Choose Character to Delete",
YesLabel = "Y",
NoLabel = "N",
+ Version = "Version",
}
L.Grp_TabName["1N"] = "Mode 1N"
L.Grp_TabName["1V"] = "Mode 1V"
diff --git a/data/en/en.lua b/data/en/en.lua
index b7b7157..4b2919f 100644
--- a/data/en/en.lua
+++ b/data/en/en.lua
@@ -87,6 +87,7 @@ DLC_names = {
ChooseChartoDelete = "Choose Character to Delete",
YesLabel = "Y",
NoLabel = "N",
+ Version = "Version",
}
L.Grp_TabName["1N"] = "Mode 1N"
L.Grp_TabName["1V"] = "Mode 1V"
diff --git a/data/fr/fr.lua b/data/fr/fr.lua
index a041484..fef4f0c 100644
--- a/data/fr/fr.lua
+++ b/data/fr/fr.lua
@@ -86,6 +86,7 @@ DLC_names = {
ChooseChartoDelete = "Choose Character to Delete",
YesLabel = "O",
NoLabel = "N",
+ Version = "Version",
}
L.Grp_TabName["1N"] = "Mode 1N"
L.Grp_TabName["1V"] = "Mode 1V"
diff --git a/history.lua b/history.lua
index 1d8b215..719358b 100644
--- a/history.lua
+++ b/history.lua
@@ -1,6 +1,6 @@
hist = {
name = "history",
- version = "26",
+ version = "27",
initialised = false,
SV={},
L={},
@@ -10,7 +10,7 @@ hist = {
tz_offset =0,
debug = true
}
-
+--GetWorldName()
local function log_truncate(max)
--Limit log to max
for _ = max, (#hist.SV.log-1) do
@@ -28,6 +28,7 @@ local function log(text)
["text"] = text,
["Char"] = hist.playerName,
["CharID"] = hist.playerID,
+ ["world"] = GetWorldName(),
})
end
@@ -182,8 +183,8 @@ local function Activated()
hist.me.levels[hist.me.level].time = hist.me.timeplayed
end
- if hist.SV.CP_Level > 0 and hist.SV.CP[hist.SV.CP_Level] ~= nil then
- hist.SV.CP[hist.SV.CP_Level].time = hist.SV.CP[hist.SV.CP_Level].time + hist.me.timeplayed - hist.me.timeplayed_last
+ if hist.world.CP_Level > 0 and hist.world.CP[hist.world.CP_Level] ~= nil then
+ hist.world.CP[hist.world.CP_Level].time = hist.world.CP[hist.world.CP_Level].time + hist.me.timeplayed - hist.me.timeplayed_last
end
local map = new_map()
@@ -238,26 +239,26 @@ local function levelup(_, unitTag,_)
end
-local function CP_Levelup(_,unitTag, old, new)
+local function CP_Levelup(_,unitTag, _, _)
if unitTag ~= "player" then
return
end
- hist.SV.CP_Level=tonumber(new) -- unclear of type, coerce
- log("CP Gained was " .. old .. ", now " .. new)
+ hist.world.CP_Level=GetPlayerChampionPointsEarned()
+
- hist.SV.CP[hist.SV.CP_Level] = {}
- hist.SV.CP[hist.SV.CP_Level].begin= GetTimeStamp()
- hist.SV.CP[hist.SV.CP_Level].playerID = hist.playerID
- hist.SV.CP[hist.SV.CP_Level].map = map
- hist.SV.CP[hist.SV.CP_Level].deaths =0
- hist.SV.CP[hist.SV.CP_Level].time=0
+ hist.world.CP[hist.world.CP_Level] = {}
+ hist.world.CP[hist.world.CP_Level].begin= GetTimeStamp()
+ hist.world.CP[hist.world.CP_Level].playerID = hist.playerID
+ hist.world.CP[hist.world.CP_Level].map = new_map()
+ hist.world.CP[hist.world.CP_Level].deaths =0
+ hist.world.CP[hist.world.CP_Level].time=0
hist.me.base_level = GetUnitLevel("player")
hist.me.veteran_level = GetUnitVeteranRank("player")
hist.me.level = hist.me.base_level + hist.me.veteran_level
- log("CP_Level up to " .. new)
+ log("CP_Level up to " .. hist.world.CP_Level)
end
@@ -288,6 +289,7 @@ local function setup_char()
hist.me.base_level = GetUnitLevel("player")
hist.me.veteran_level = GetUnitVeteranRank("player")
hist.me.level = hist.me.base_level + hist.me.veteran_level
+ hist.me.world = GetWorldName()
hist.me.Alliance = zo_strformat("<<C:1>>",GetAllianceName(GetUnitAlliance("player")))
hist.me.ach={}
hist.me.maps={}
@@ -334,16 +336,27 @@ local function Dead()
hist.me.maps[map].firstdeathdate = GetTimeStamp()
end
- if hist.SV.CP[hist.SV.CP_Level] ~= nil then
- hist.SV.CP[hist.SV.CP_Level].deaths = hist.SV.CP[hist.SV.CP_Level].deaths +1
+ if hist.world.CP_Level == 0 then return
+ end
+
+
+
+ if hist.world.CP[hist.world.CP_Level] ~= nil then
+ hist.world.CP[hist.world.CP_Level].deaths = hist.world.CP[hist.world.CP_Level].deaths +1
+ else
+ local msg = "Died but CP entry for " .. tostring(hist.world.CP_Level) .. " was nil."
+ log (msg)
+ if hist.debug then
+ d(msg)
+ end
end
end
del_old_categories = function()
local count = 0
- log("Unwanted Category information Purged for all chars.")
for playerID, player in pairs (hist.SV.data) do
+ log("Deleting old categories for " .. player.name)
for ID, ach in pairs (player.ach) do
if not (Keep_Achievement (ach["Category_ID"])) then
player.ach[ID] = nil
@@ -351,10 +364,38 @@ del_old_categories = function()
end
end
end
- local msg = count .. " achievement records deleted."
+ local msg = count .. " obsolete achievement records deleted."
log(msg)
- if hist.debug then
- d(msg)
+end
+
+del_old_levels = function ()
+ for playerID, player in pairs (hist.SV.data) do
+ -- remove levels without maps- these are probably CP and dud anyway.
+ log("Deleting old levels for " .. player.name)
+ local dud = 0
+ for key,L in pairs (player.levels) do
+ if L.map == nil then
+ dud = dud +1
+ player.levels[key] = nil
+ else
+
+ if key > 66 then -- is CP move to accountwide if not already there
+ local cpkey = key-50 -- max level now set to 50, so everything beyon
+ if hist.world.CP[cpkey] == nil then
+ hist.world.CP[cpkey] = {}
+ hist.world.CP[cpkey].begin = L.begin
+ hist.world.CP[cpkey].map = L.map
+ hist.world.CP[cpkey].deaths = L.deaths
+ hist.world.CP[cpkey].playerID = hist.playerID
+ hist.world.CP[cpkey].time = L.time
+ log(cpkey .. " moved to CP")
+ player.levels[key] = nil -- and delete old
+ else
+ log(key .. " not moved to CP")
+ end
+ end
+ end
+ end
end
end
@@ -374,26 +415,32 @@ function hist.Initialise(_, addOnName)
-- Load the saved variables
hist.SV = ZO_SavedVars:NewAccountWide("History_SV", 1, nil, nil)
- --remove old achievement categories
-
- if hist.SV.catcleaned == nil then
- del_old_categories()
- hist.SV.catcleaned = 1
- end
if hist.SV.log == nil then
hist.SV.log = {}
log("hist.SV.log created")
end
- if hist.SV.CP == nil then
- hist.SV.CP = {}
+ if hist.SV.worlds == nil then
+ hist.SV.worlds = {}
+ end
+
+ if hist.SV.worlds[GetWorldName()] == nil then
+ hist.SV.worlds[GetWorldName()] = {}
end
+
+ hist.world = hist.SV.worlds[GetWorldName()]
- if hist.SV.CP_Level == nil then
- hist.SV.CP_Level = 0
+ if hist.world.CP == nil then
+ hist.world.CP = {}
end
+
+
+-- if hist.SV.CP == nil then
+-- hist.SV.CP = {}
+-- end
+ hist.world.CP_Level = GetPlayerChampionPointsEarned()
if (hist.SV.data == nil ) then
hist.SV.data = {}
@@ -403,13 +450,30 @@ function hist.Initialise(_, addOnName)
hist.SV.old = nil
end
+ hist.SV.CP_Level = nil
+
+ -- once only move of CP data to new location.
+ if hist.SV.CP ~= nil then
+ hist.world.CP = hist.SV.CP
+ hist.SV.CP = nil
+ end
+
+
+ --remove old achievement categories
+
+ if hist.SV.cleaned1 == nil then
+ del_old_categories()
+ del_old_levels()
+ hist.SV.cleaned1 = 1
+ end
+
if (hist.SV.start_version == nil ) then
hist.SV.start_version = hist.version
end
hist.SV.this_version = hist.version
- --- hist.SV.version -- Used by ZOS System
+ --- hist.SV.version -- Used by ZOS System, dont touch
if hist.SV.data[hist.playerID] == nil then
if debug then
@@ -439,8 +503,9 @@ function hist.Initialise(_, addOnName)
hist.me.base_level = GetUnitLevel("player")
hist.me.veteran_level = GetUnitVeteranRank("player")
hist.me.level = hist.me.base_level + hist.me.veteran_level
+ hist.me.world = GetWorldName()
+
- hist.SV.CP_Level = GetPlayerChampionPointsEarned()
if hist.me.levels == nil then
@@ -499,54 +564,11 @@ function hist.Initialise(_, addOnName)
hist.me.Gender = gendertext()
end
- --[[
- -- remove levels without maps- these are probably CP and dud anyway.
- local dud = 0
- for key,L in pairs (hist.me.levels) do
- if L.map == nil then
- dud = dud +1
- hist.me.levels[key] = nil
- else
-
- if key > 66 then -- is CP move to accountwide if not already there
- local cpkey = key-50 -- max level now set to 50, so everything beyon
- if hist.SV.CP[cpkey] == nil then
- hist.SV.CP[cpkey] = {}
- hist.SV.CP[cpkey].begin = L.begin
- hist.SV.CP[cpkey].map = L.map
- hist.SV.CP[cpkey].deaths = L.deaths
- hist.SV.CP[cpkey].playerID = hist.playerID
- hist.SV.CP[cpkey].time = L.time
- log(cpkey .. " moved to CP")
- hist.me.levels[key] = nil -- and delete old
- else
- log(key .. " not moved to CP")
- end
- end
- end
- end
- --]]
-
- --[[
- hist.me.levels[hist.me.level] = {
- begin = GetTimeStamp(),
- time = 0, -- Accumulated time in Minutes
- Ach_Points = GetEarnedAchievementPoints(),
- deaths = 0
- }
-
- hist.SV.CP[new].begin= GetTimeStamp()
- hist.SV.CP[new].playerID = hist.playerID
- hist.SV.CP[new].map = map
- hist.SV.CP[new].deaths =0
- hist.SV.CP[new].time=0
-
- --]]
EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_ACHIEVEMENT_AWARDED, Achievement)
EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_LEVEL_UPDATE, levelup)
EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_CHAMPION_POINT_UPDATE, CP_Levelup)
EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_CHAMPION_LEVEL_ACHIEVED , CP_Achieved)
- EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_VETERAN_RANK_UPDATE, levelup)
+-- EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_VETERAN_RANK_UPDATE, levelup)
EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_PLAYER_ACTIVATED, Activated)
-- EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_PLAYER_DEACTIVATED, Activated)
EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_PLAYER_DEAD, Dead)
@@ -560,6 +582,5 @@ SLASH_COMMANDS["/histload"] = load_history
SLASH_COMMANDS["/histfix"] = fix
SLASH_COMMANDS["/histclear"] = log_clear
SLASH_COMMANDS["/histstart"] = get_start
-SLASH_COMMANDS["/histcleancat"] = del_old_categories
EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_ADD_ON_LOADED, hist.Initialise)
diff --git a/history.txt b/history.txt
index 037195a..b9fa5e0 100644
--- a/history.txt
+++ b/history.txt
@@ -1,6 +1,6 @@
## Title: Dad's History
## APIVersion: 100017
-## Version: 25
+## Version: 27
## Author: HisDad
## Description: Record progress of all characters for offline viewing.
## SavedVariables: History_SV