Rename map to maps and other minor stuff

His Dad [04-24-15 - 08:11]
Rename map to maps and other minor stuff
Filename
HistOffline.lua
history.lua
diff --git a/HistOffline.lua b/HistOffline.lua
index 90b965b..0577986 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -74,7 +74,7 @@ for i,_ in pairs(History_SV["Default"]) do
 	accounts[i].names = {}	-- intermediate table for sorting. WIP. Array formatted.
 	accounts[i].name = {}
 	naccounts = naccounts +1
-	table.insert(accounts_list, i)
+	table.insert(accounts_list, i)
 end

 function write_data()
@@ -213,7 +213,7 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
 					print("Map: " .. map .."  " .. History_SV["Default"][acc]["$AccountWide"]["data"][char].levels[j].map[map])
 					thismap = map
 				end
-				accounts[acc].name[char].leveling_box:setcell(i,6, thismap)
+				accounts[acc].name[char].leveling_box:setcell(i,6, thismap)
 			end
 		end

@@ -436,7 +436,7 @@ function select_account()
 					1, --Initial
 					1,naccounts	--MaxCol MaxLine
 					)
-
+
 			if selected <0 then
 				return nil		-- Cancelled
 			else
diff --git a/history.lua b/history.lua
index c4c60a6..f6e4c4f 100644
--- a/history.lua
+++ b/history.lua
@@ -120,6 +120,14 @@ end

 local function Activated()
 	hist.me.levels[hist.me.level].time = math.floor(GetSecondsPlayed() /60)
+	map = GetMapName()
+	if hist.me.maps[map] == nil then
+		hist.me.maps[map] = {}
+		hist.me.maps[map].visit = 1
+	else
+	hist.me.maps[map].visit = hist.me.maps[map].visit +1
+	end
+
 end


@@ -148,15 +156,15 @@ local function levelup(eventCode, unitTag,_)
 		hist.me.levels[hist.me.level].map[map] = hist.me.levels[hist.me.level].map[map] +1
 	end
 	-- Update Map data with level
-	if hist.me.map[map] == nil then
-		hist.me.map[map] = {}
+	if hist.me.maps[map] == nil then
+		hist.me.maps[map] = {}
 	end
 	-- Duplication of info, but easier to work with
-	if hist.me.map[map].timeslevel == nil then
-		hist.me.map[map].timeslevel = 1
-		hist.me.map[map].firstlevel = hist.me.level
+	if hist.me.maps[map].timeslevel == nil then
+		hist.me.maps[map].timeslevel = 1
+		hist.me.maps[map].firstlevel = hist.me.level
 	else
-		hist.me.map[map].timeslevel = hist.me.map[map].timeslevel + 1
+		hist.me.maps[map].timeslevel = hist.me.maps[map].timeslevel + 1
 	end

     if hist.debug then
@@ -194,7 +202,7 @@ local function setup_char()
 		hist.me.level = GetUnitLevel("player") + GetUnitVeteranRank("player")
 		hist.me.Alliance = GetAllianceName(GetUnitAlliance("player"))
 		hist.me.ach={}
-		hist.me.map={}
+		hist.me.maps={}
 		hist.me.levels = {}
 		hist.me.levels[hist.me.level] = {
 			begin = GetTimeStamp(),
@@ -211,22 +219,32 @@ local function Dead()
 	hist.me.levels[hist.me.level].deaths = hist.me.levels[hist.me.level].deaths +1
 	-- Per Map
 	local map = GetMapName()
-	if hist.me.map[map] == nil then
-		hist.me.map[map] = {}
+	if hist.me.maps[map] == nil then
+		hist.me.maps[map] = {}
 	end
 	--Update map data with Deaths
-	if hist.me.map[map].deaths == nil then
-		hist.me.map[map].deaths = 0
-		hist.me.map[map].firstdeathlevel = hist.me.level
+	if hist.me.maps[map].deaths == nil then
+		hist.me.maps[map].deaths = 0
+		hist.me.maps[map].firstdeathlevel = hist.me.level
 		local msg = "First Death in map " .. map
 		log (msg)
 		if hist.debug then
 		d("First Death in map " ..map)
 		end
 	end
-	hist.me.map[map].deaths = hist.me.map[map].deaths +1
+	hist.me.maps[map].deaths = hist.me.maps[map].deaths +1
+end

+local function newzone (_, zoneName,SubZoneName,isnew)
+--EVENT_ZONE_CHANGED (integer eventCode, string zoneName, string subZoneName, bool newSubzone)
+	d("Zone:  " .. zoneName .. "  SubZone: " ..SubZoneName)
+	if (isnew ==true) then
+	d("new")
+	else d("old")
+	end
 end
+
+
 function hist.Initialise(_, addOnName)
 	if (hist.name ~= addOnName) then return end

@@ -272,8 +290,8 @@ function hist.Initialise(_, addOnName)
 		if 	hist.me.levels == nil then
 		hist.me.levels = {}
 		end
-		if hist.me.map == nil then
-			hist.me.map = {}
+		if hist.me.maps == nil then
+			hist.me.maps = {}
 		end
 		if hist.me.ach_updates ~= nil then
 			hist.me.ach_updates = nil
@@ -318,6 +336,7 @@ function hist.Initialise(_, addOnName)
 	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)
+	--EVENT_MANAGER:RegisterForEvent(hist.name, EVENT_ZONE_CHANGED, newzone)
 	hist.initialised = true
 end