Trials detal WIP

His Dad [07-02-15 - 09:06]
Trials detal WIP
Filename
HistOffline.lua
data/data.lua
diff --git a/HistOffline.lua b/HistOffline.lua
index df4bd7c..15217d2 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -514,11 +514,18 @@ end
 		Trials_Info={}

 		for line,key in ipairs (trial2key) do  -- Load Dungeons Name. Info LC is the Dungeon Identifier
-				Trials_Info[key] = {count = 0}
+				Trials_Info[key] = {count = 0,
+									Ach = {}	-- Achievement IDs in form id=bool
+									}
 				me.Trials_box:setcell(line,0, trial_names[key])
 				me.Trials_box:setcell(line,1, "0") -- know column is always 1
 		end

+		for id,detail in pairs(trial_dat) do
+		    key = detail.key
+			Trials_Info[key].Ach[id]=false		-- set them all to not done
+		end
+

 		for id,_ in pairs (trial_dat) do  -- For Achievements we have..
 			if thischar.ach[id] ~= nil then
@@ -528,8 +535,9 @@ end
 				local colour = "FGCOLOR" .. L .. ":" .. C
 				iup.SetAttribute(me.Trials_box, colour, FG_Colour_Complete)

-				key = tostring(L) .. tostring(C)	-- make name key
+				key = trial_dat[id].key
 				dname = trial_names[key]
+				Trials_Info[key].Ach[id]=true		-- Mark as known
 				-- Increment count and display
 				Trials_Info[key].count = Trials_Info[key].count+1
 				me.Trials_box:setcell(L,C, " (" .. Trials_Info[key].count ..")")
@@ -550,8 +558,7 @@ end
 		me.Trials_Detail_Zbox = iup.zbox{}

 		local name, link
-		for key, info in pairs(Trials_Info) do	-- for each zone
-		--	print ("LAng: "..lang .. "  " ..key, dump(info))
+		for key, info in pairs(Trials_Info) do	-- for each trial
 			me.Trials_Detail_box[key]= iup.matrix {numcol=2, numcol_visible=2,  numlin=0}

 			local Line = 1
@@ -566,7 +573,7 @@ end
 			iup.SetAttribute(me.Trials_Detail_box[key],"WIDTH0", "30")
 			iup.SetAttribute(me.Trials_Detail_box[key],"WIDTH1", "150")
 			iup.SetAttribute(me.Trials_Detail_box[key],"WIDTH2", "250")
-			for _, id in ipairs (info.quests) do	-- get the quests of the zone
+			for id,done in ipairs (info) do	-- get the achicements of the trial
 				me.Trials_Detail_box[key].numlin = Line
 				me.Trials_Detail_box[key]:setcell(Line,0, tostring(id))

@@ -575,18 +582,17 @@ end
 				else
 					name = Ach_Detail[id].name
 				end
-				link = SQ_dat[id].link1
+			--	link = SQ_dat[id].link1
 				me.Trials_Detail_box[key]:setcell(Line,1, name)
-				me.Trials_Detail_box[key]:setcell(Line,2, link)
+			--	me.Trials_Detail_box[key]:setcell(Line,2, link)
 				-- Set Detail Colours on achievement
-				if thischar.ach[id] == nil  then
-					iup.SetAttribute(me.Trials_Detail_box[key],"FGCOLOR" .. tostring(Line) .. ":*", FG_Colour_Not_Complete)	-- Nope
+				if done  then
+					iup.SetAttribute(me.Trials_Detail_box[key],"FGCOLOR" .. tostring(Line) .. ":*", FG_Colour_Complete)
 				end
-
 				Line= Line+1
 			end
 		-- Click on Link,
-		local thisTrialsDetail = me.Trials_Detail_box[key]	-- The function def below doesn't like the [key]
+--[[		local thisTrialsDetail = me.Trials_Detail_box[key]	-- The function def below doesn't like the [key]
 		function thisTrialsDetail:click_cb(L,C)
 				if C == 2 then
 					iup.Help(self:getcell(L,C))		-- Launch Browser
@@ -594,7 +600,7 @@ end
 					return IUP_IGNORE
 				end
 			end
-
+--]]
 			iup.Append(me.Trials_Detail_Zbox, me.Trials_Detail_box[key])
 		end

diff --git a/data/data.lua b/data/data.lua
index 1581857..cdfee64 100644
--- a/data/data.lua
+++ b/data/data.lua
@@ -107,25 +107,25 @@
 }
 	trial_dat = {
 --Hel Ra Citadel
-    [870] = {L=1, C=1},
-	[991] = {L=1, C=1},
-	[1136] = {L=1, C=1},
-	[1080] = {L=1, C=1},
+    [870] = {L=1, C=1, key ="11"},
+	[991] = {L=1, C=1,key ="11"},
+	[1136] = {L=1, C=1, key ="11"},
+	[1080] = {L=1, C=1, key ="11"},

 --Aetherian Archive
-	[990] = {L=2, C=1},
-	[1137] = {L=2, C=1},
-	[1081] = {L=2, C=1},
+	[990] = {L=2, C=1, key ="21"},
+	[1137] = {L=2, C=1, key ="21"},
+	[1081] = {L=2, C=1, key ="21"},
 --Sanctum Ophidia

-	[1123] = {L=3, C=1},
-	[1124] = {L=3, C=1},
-	[1138] = {L=3, C=1},
+	[1123] = {L=3, C=1, key ="31"},
+	[1124] = {L=3, C=1, key ="31"},
+	[1138] = {L=3, C=1, key ="31"},
 -- Craglorn Trials
-	[1139] = {L=3, C=1},
+--	[1139] = {L=3, C=1, key ="31"},
 --Dragonstar Arena
-	[992] = {L=4, C=1},
-	[1140] = {L=4, C=1},
+	[992] = {L=4, C=1, key ="41"},
+	[1140] = {L=4, C=1, key ="41"},
 }

 WB_dat = {		--World Boss Achievements