Version 12, prerelease

His Dad [07-03-15 - 00:36]
Version 12, prerelease
Filename
HistOffline.lua
diff --git a/HistOffline.lua b/HistOffline.lua
index b380e93..ac45cf7 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -301,7 +301,7 @@ end
 		me.timeplayed = math.floor(thischar.levels[level].time/60)

 		-- Generate the leveling box.  ============================
---		local leveling_box = {}
+
 		me.leveling_box = iup.matrix {numcol=6, numcol_visible=6,  widthdef=60}
 		me.leveling_box:setcell(0,1, L.Level)
 		me.leveling_box:setcell(0,2, L.PTime)
@@ -391,7 +391,7 @@ end
 				me.Grp_box:setcell(L, C, grp_names[key])
 		end

-		me.Grp_box.Redraw= "ALL"
+--		me.Grp_box.Redraw= "ALL"

 		-- Create Pub Dungeon Achievements Box==========================
 		me.Pub_box = iup.matrix {numcol=4, numcol_visible=4,  numlin=5, widthdef=90}
@@ -514,7 +514,8 @@ 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,  -- number of Ach we have.
+									nAch = 0,	-- number of entries in Ach below
 									Ach = {}	-- Achievement IDs in form id=bool
 									}
 				me.Trials_box:setcell(line,0, trial_names[key])
@@ -524,6 +525,7 @@ end
 		for id,detail in pairs(trial_dat) do
 		    key = detail.key
 			Trials_Info[key].Ach[id]=false		-- set them all to not done
+			Trials_Info[key].nAch = Trials_Info[key].nAch + 1
 		end


@@ -541,23 +543,22 @@ end
 				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 ..")")
+				me.Trials_box:setcell(L,C, " (" .. Trials_Info[key].count .."/" .. Trials_Info[key].nAch ..")")

 				-- Trial Background to green for all achievements
-				if Trials_Info[key].count == #Trials_Info[key].Ach then   --invalid not array
+				if Trials_Info[key].count >= Trials_Info[key].nAch -2 then
 				iup.SetAttribute(me.Trials_box, bgcolour, BG_Colour_Complete)
 				end
-				print (#Trials_Info[key].Ach)
 				-- Add char to dungeon
 				dung.trials[key][char] = "Y"
 			end
 		end

-
+--[[
 		if thischar.ach[1139] ~= nil 	then -- Craglorn all special.
-			iup.SetAttribute(me.Trials_box, "BGCOLOR0:5", Colour_Heading_Complete)
+			iup.SetAttribute(me.Trials_box, "BGCOLOR0:5", Colour_Heading_Complete) -- not useful
 		end
-
+--]]
 -- Create Trials Achievements Detail Boxes=======================

 		me.Trials_Detail_box = {}
@@ -565,19 +566,17 @@ end

 		local name, link
 		for key, info in pairs(Trials_Info) do	-- for each trial
-			me.Trials_Detail_box[key]= iup.matrix {numcol=2, numcol_visible=1, numlin=0}
+			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)
-		--	me.Trials_Detail_box[key]:setcell(0,2, L.Link)
 			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], "ALIGNMENT2", "ALEFT")
 			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,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))
@@ -587,10 +586,10 @@ end
 				else
 					name = Ach_Detail[id].name
 				end
-			--	link = SQ_dat[id].link1
+
 				me.Trials_Detail_box[key]:setcell(Line,0, id)
 				me.Trials_Detail_box[key]:setcell(Line,1, name)
-			--	me.Trials_Detail_box[key]:setcell(Line,2, link)
+
 				-- Set Detail Colours on achievement
 				if done  then
 					iup.SetAttribute(me.Trials_Detail_box[key],"FGCOLOR" .. tostring(Line) .. ":*", FG_Colour_Complete)
@@ -599,16 +598,7 @@ end
 				end
 				Line= Line+1
 			end
-		-- Click on Link,
---[[		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
-				else
-					return IUP_IGNORE
-				end
-			end
---]]
+
 			iup.Append(me.Trials_Detail_Zbox, me.Trials_Detail_box[key])
 		end