35 wip

His Dad [01-09-17 - 19:25]
35 wip
Filename
Doc/Changelog.txt
HistOffline.lua
data/Trial.lua
data/en/en.lua
data/keys.lua
diff --git a/Doc/Changelog.txt b/Doc/Changelog.txt
index 2e9d019..e1a8325 100644
--- a/Doc/Changelog.txt
+++ b/Doc/Changelog.txt
@@ -1,7 +1,7 @@
 2017-01-06 version 34
 	API Update
 	Achievement text hoverover (WIP)
-	Fixed: Fungall grotto VH wrong
+	Fixed: Fungal Grotto VH wrong
 	Fixed: Maelstrom vet/normal was reversed

 2017-01-01 version 33
diff --git a/HistOffline.lua b/HistOffline.lua
index de9de02..43a574e 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -14,7 +14,7 @@ local Colour_Heading_Complete = "#58FA58"

 --iup.SetGlobal("UTF8MODE","YES")
 -- ========================
-version= "34"
+version= "35"
 require( "iuplua" )
 require( "iupluacontrols" )
 dofile "../../SavedVariables/History.lua"
@@ -29,6 +29,10 @@ Grp2_Order={"2N","2V","2VH"}
 for _,i in ipairs(Grp_Order) do
 	Grp_Dat[i]={}
 end
+for _,i in ipairs(Craglorn_Order) do
+	Craglorn_Dat[i]={}
+end
+
 dofile "./data/Keys.lua"		--Linking tables, must do first
 dofile "./data/DLC.lua"			--Achievement to Grid lookup, language independent
 dofile "./data/Group1.lua"		-- Grp Mode 1 data, N, V, VH
@@ -45,6 +49,10 @@ for _,i in ipairs(Grp_Order) do
 	Grp_Dat[i].reverse_id = reverse_id(Grp_Dat[i].id)
 end

+for _,i in ipairs(Craglorn_Order) do
+	Craglorn_Dat[i].reverse_id = reverse_id(Craglorn_Dat[i].id)
+end
+
 Pub_Dat.reverse_id = reverse_id(Pub_Dat.id)
 Trial_Dat.reverse_id = reverse_id(Trial_Dat.id)
 DLC_Dat.reverse_id = reverse_id(DLC_Dat.id)
@@ -290,9 +298,10 @@ end
   dung.DLC.box = {}
   dung.DLC.key = {}

-  dung.Grp = {}		-- this one is indexed.
-
+  dung.Grp = {}		-- these ones are indexed.
+  dung.Craglorn = {}

+  -- Set up dungeon mode Group Dungeons
   for _,i in ipairs(Grp_Order) do
 	dung.Grp[i]= {}
 	dung.Grp[i].key ={}   -- key lookup
@@ -303,7 +312,7 @@ end
 						iup.fill{},
 					}

-
+-- Mouseover
     matrix = dung.Grp[i].box
 	function matrix:mousemove_cb(l, c) 	-- odd issue with [] in function
 		if l == 0 or c == 0 then
@@ -333,8 +342,6 @@ end
 	end


-
-
 	--set lines Heading
 	dung.Grp[i].box:setcell(0,0, L.Location)
 	--Set Line titles
@@ -368,7 +375,71 @@ end
 	  end
 	end
   end
+
+  -- Set up dungeon mode Craglorn Trials
+  for _,i in ipairs(Craglorn_Order) do
+		dung.Craglorn[i]= {}
+		dung.Craglorn[i].key ={}   -- key lookup
+		dung.Craglorn[i].box = iup.matrix {numcol=#accounts[acc].playerIDs,  numlin=_size(Craglorn_Dat[i].id), widthdef=100}
+		dung.Craglorn[i].tab = iup.vbox {
+							["tabtitle"] =L.Crag_TabName[i],
+							dung.Craglorn[i].box,
+							iup.fill{},
+						}
+
+    matrix = dung.Craglorn[i].box
+	function matrix:mousemove_cb(l, c) 	-- odd issue with [] in function
+		if l == 0 or c == 0 then
+			detail.title = ""
+			return
+		end
+
+		local key = Craglorn_Dat[i].key[l]
+		if key == nil then
+			detail.title= "key is nil"
+			return
+		end
+
+		local ach = Craglorn_Dat[i].reverse_id[key]
+
+		if ach == nil then
+			detail.title = "No reverse lookup on " .. key
+			return
+		end
+		if Ach_Detail[ach] == nil then
+			detail.title = "No Achievement for " .. ach
+			print (detail.title)
+			return
+		end
+		detail.title = Ach_Detail[ach].description

+	end
+
+	--set lines Heading
+	dung.Craglorn[i].box:setcell(0,0, L.Location)
+	--Set Line titles
+	for line,key in ipairs(Craglorn_Dat[i].key) do
+		dung.Craglorn[i].box:setcell(line, 0, Craglorn_Names[key])
+	end
+
+	--Create Columns for Chars
+	for col ,playerID in ipairs(accounts[acc].playerIDs) do
+		dung.Craglorn[i].box:setcell(0, col, playerNames[playerID])
+	end
+
+	iup.SetAttribute(dung.Craglorn[i].box, "READONLY", "YES")
+
+    -- a table for each dungeon to which we add characters
+	for _,key in ipairs(Craglorn2key[i]) do
+	  dung.Craglorn[i].key[key] = {}
+	  for _,playerID in ipairs(accounts[acc].playerIDs) do
+		dung.Craglorn[i].key[key][playerID] = false
+	  end
+	end
+
+  end
+
+


   for _,i in ipairs(Pub_Dat.key) do
@@ -489,6 +560,7 @@ end
 			end
 		end

+
 		-- Create Pub Dungeon Achievements Box==========================
 		me.Pub_box = iup.matrix {numcol=4, numcol_visible=4,  numlin=5, widthdef=100}
 		for i=1, 4 do  -- Load text
@@ -598,54 +670,6 @@ end
 			iup.SetAttribute(me.Trials_box, "BGCOLOR0:5", Colour_Heading_Complete) -- not useful
 		end
 --]]
--- Create Trials Achievements Detail Boxes=======================
-
-		me.Trials_Detail_box = {}
-		me.Trials_Detail_Zbox = iup.zbox{}
-
-		local name
-		for key, info in pairs(Trials_Info) do	-- for each trial
-			me.Trials_Detail_box[key]= iup.matrix {numcol=1, numcol_visible=1, numlin=0}
-			local Line = 1
-			me.Trials_Detail_box[key]:setcell(0,0, L.Ach_ID)
-			me.Trials_Detail_box[key]:setcell(0,1, L.Name)
-			iup.SetAttribute(me.Trials_Detail_box[key], "READONLY", "YES")
-			iup.SetAttribute(me.Trials_Detail_box[key], "ALIGNMENT0", "ACENTER")
-			iup.SetAttribute(me.Trials_Detail_box[key], "ALIGNMENTLIN0", "ALEFT")
-			iup.SetAttribute(me.Trials_Detail_box[key], "ALIGNMENT1", "ALEFT")
-			iup.SetAttribute(me.Trials_Detail_box[key],"WIDTH0", "30")
-			iup.SetAttribute(me.Trials_Detail_box[key],"WIDTH1", "150")
-
-			for id,done in pairs (info.Ach) do	-- get the achievements of the trial
-			 	me.Trials_Detail_box[key].numlin = Line
-				me.Trials_Detail_box[key]:setcell(Line,0, tostring(id))
-
-				if Ach_Detail[id] == nil then
-					name = "UNKN"
-				else
-					name = Ach_Detail[id].name
-				end
-
-				me.Trials_Detail_box[key]:setcell(Line,0, id)
-				me.Trials_Detail_box[key]:setcell(Line,1, name)
-
-				-- Set Detail Colours on achievement
-				if done  then
-					iup.SetAttribute(me.Trials_Detail_box[key],"FGCOLOR" .. tostring(Line) .. ":*", FG_Colour_Complete)
-				else
-					iup.SetAttribute(me.Trials_Detail_box[key],"FGCOLOR" .. tostring(Line) .. ":*", FG_Colour_Not_Complete)
-				end
-				Line= Line+1
-			end
-
-			iup.Append(me.Trials_Detail_Zbox, me.Trials_Detail_box[key])
-		end
-
-		function me.Trials_box:enteritem_cb(L,C)
-			me.Trials_Detail_Zbox.value = me.Trials_Detail_box[tostring(L) .. tostring(C)]
-		end
-
-
 		-- Create Locations Box==============================================
 		me.Map_box= iup.matrix {numcol=6, numcol_visible=6,  numlin=0, widthdef=70}

@@ -1187,7 +1211,7 @@ iup.Append(accounts[acc].char_tabs, accounts[acc].log_tab)

 	-- Create Trials  Character Box=======================

-
+
 		dung.Trials.box = iup.matrix {numcol=0,  numlin=#trial2key, widthdef=100}

 		function dung.Trials.box:mousemove_cb(l, c)
@@ -1257,6 +1281,12 @@ iup.Append(accounts[acc].char_tabs, accounts[acc].log_tab)

 		iup.Append(accounts[acc].dung_tabs, dung.Trials.tab)

+		-- Create Craglorn  Tab ============================================
+		for _,i in ipairs (Craglorn_Order) do
+			iup.Append(accounts[acc].dung_tabs, dung.Craglorn[i].tab)
+			-- Populate with character data ============================
+			populate(dung.Craglorn[i], Craglorn_Dat[i].key)
+		end
 	end -- has vet chars

 end -- Accounts
diff --git a/data/Trial.lua b/data/Trial.lua
index a7e24c9..51dd71e 100644
--- a/data/Trial.lua
+++ b/data/Trial.lua
@@ -23,6 +23,7 @@ Trial_Dat.id = {
 [1140] = {L=4, C=1, key ="41"},
 }

+Trial_Dat.vet = true
 Trial_Dat.key = trial2key


@@ -30,14 +31,14 @@ Trial_Dat.key = trial2key

 Craglorn_Conqueror = "" -- [1139] = "Craglorn Trials Conqueror" "Complete Hel Ra Citadel, Aetherian Archive, and Sanctum Ophidia at their highest difficulties.",

-Craglorn_Dat["N"] = {}
 Craglorn_Dat["N"].id = {
 [1474] = {L=1, C=1, key ="11"},		-- "Hel Ra Citadel Conqueror",
 [1503] = {L=2, C=1, key ="21"},		-- "Aetherian Archive Conqueror" Defeat the Celestial Mage in Veteran Aetherian Archive, while the Trial is scaled to Champion 160.",
 [1462] = {L=3, C=1, key ="31"},		-- "Sanctum Ophidia Conqueror",
 }
+Craglorn_Dat["N"].vet = false
+Craglorn_Dat["N"].key = Craglorn2key["N"]

-Craglorn_Dat["V"] = {}
 Craglorn_Dat["V"].id = {
 [991] = {L=1, C=1, key ="11"},		-- "Hel Ra Citadel Completed",  "Defeat the Celestial Warrior, freeing him from the Serpent's control."
 [870] = {L=2, C=1, key ="21"},		-- "Hel Ra Citadel: The War Horn", "Sound the war horn in Veteran Hel Ra Citadel and defeat the ancient warriors who answer.",
@@ -48,8 +49,9 @@ Craglorn_Dat["V"].id = {
 [1124] = {L=7, C=1, key ="71"},     -- "Time Trial: Sanctum Ophidia", "Completed the Sanctum Ophidia within a time limit of 33 minutes.",
 [992] = {L=8, C=1, key ="81"},		-- "Dragonstar Arena Champion",  "Conquer all challengers and earn the title of Dragonstar Arena Champion!",
 }
+Craglorn_Dat["V"].vet = true
+Craglorn_Dat["V"].key = Craglorn2key["V"]

-Craglorn_Dat["VH"] = {}
 Craglorn_Dat["VH"].id = {
 [1136] = {L=1, C=1, key ="11"},		-- "Hel Ra Citadel Difficult Mode","Defeat the Celestial Warrior after enraging him through the destruction of his statue army.",
 [1137] = {L=2, C=1, key ="21"},		-- "Aetherian Archive Difficult Mode" "Defeat the Celestial Mage after taunting her by smashing the Aetherial Orbs."
@@ -57,4 +59,5 @@ Craglorn_Dat["VH"].id = {
 [1140] = {L=4, C=1, key ="41"},		-- "Dragonstar Arena Conqueror", "Conquer all challengers on the increased difficulty version of Dragonstar Arena.",
 }

-
+Craglorn_Dat["VH"].vet = true
+Craglorn_Dat["VH"].key = Craglorn2key["VH"]
diff --git a/data/en/en.lua b/data/en/en.lua
index f7aa802..92bde0f 100644
--- a/data/en/en.lua
+++ b/data/en/en.lua
@@ -72,6 +72,7 @@ DLC_names = {
 		Dungeons = "Dungeons",
 		Mode = "Showing",
 		Grp_TabName={},
+		Crag_TabName={},
 		Pub = "Public",
 		Vet = "Veteran",
 		Trials = "Trials",
@@ -100,6 +101,9 @@ L.Grp_TabName["2N"] = "Mode 2N"
 L.Grp_TabName["2V"] = "Mode 2V"
 L.Grp_TabName["2VH"] = "Mode 2VH"

+L.Crag_TabName["N"] = "N"
+L.Crag_TabName["V"] = "Vet"
+L.Crag_TabName["VH"] = "Hard"

 pub_names = {
 --EP
diff --git a/data/keys.lua b/data/keys.lua
index 13ac2e2..62cea60 100644
--- a/data/keys.lua
+++ b/data/keys.lua
@@ -54,4 +54,24 @@ trial2key = {
 "31",	-- "Sanctum Ophidia",
 "41", 	-- "Dragonstar Arena",
 }
+--Craglorn Trials

+Craglorn2key= {}
+Craglorn2key["N"] = {
+"11",	-- "Hel Ra Citadel",
+"21",	-- "Aetherian Archive"
+"31",	-- "Sanctum Ophidia",
+}
+-- DA doesnt actually have a normal mode, but it does have  a hard mode
+Craglorn2key["V"] = {
+"11",	-- "Hel Ra Citadel",
+"21",	-- "Aetherian Archive"
+"31",	-- "Sanctum Ophidia",
+"41", 	-- "Dragonstar Arena",
+}
+Craglorn2key["VH"] = {
+"11",	-- "Hel Ra Citadel",
+"21",	-- "Aetherian Archive"
+"31",	-- "Sanctum Ophidia",
+"41", 	-- "Dragonstar Arena",
+}