SQ Detail working

His Dad [05-12-15 - 10:41]
SQ Detail working
Filename
HistOffline.lua
data/de.lua
data/en.lua
diff --git a/HistOffline.lua b/HistOffline.lua
index f36c916..3693b90 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -55,7 +55,7 @@ end


 function write_saved(o)
-	local escaped
+--	local escaped
    if type(o) == 'table' then
       local s = '{\n'
       for k,v in pairs(o) do
@@ -89,29 +89,17 @@ function load_lang(lang)
 	lingua[lang].grp_names = grp_names
 	lingua[lang].Ach_Detail = Ach_Detail
 end
---[[
-load_lang("en")
-load_lang("de")
-print(dump(lingua["de"].Ach_Detail))
---]]
-
---[[ Load Skill Giving Quest boxes. These are the same for all users, we just change the highlighting
-	This is not account dependent.

---]]
 --SQ_Dat loaded  from data.lua
-
 SQ_Info= {} -- keyed by "LC" string as the  ZONE Identifier
 for id,_ in pairs (SQ_dat) do  -- Load all Quest Data by Achievement ID
 		local L = SQ_dat[id].L
 		local C = SQ_dat[id].C
-		key = tostring(L) .. tostring(C)	-- make name key
+		local key = tostring(L) .. tostring(C)	-- make name key

 		if SQ_Info[key] == nil then
 			SQ_Info[key] = {}
 			SQ_Info[key].quests = {}
-			SQ_Info[key].L = L	-- Save separating it out from key later
-			SQ_Info[key].C = C
 		end
 		table.insert(SQ_Info[key].quests,id)
 end
@@ -157,7 +145,6 @@ end

 -- set up some static data

-btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}

 --[[ ==========================================
 	Iterate over all accounts and chars creating display items
@@ -194,7 +181,7 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
 	local Line=0
 	local TimeStr = ""
 	accounts[acc].logtable.numlin = Line
-	for i,j in ipairs (History_SV["Default"][acc]["$AccountWide"]["log"]) do
+	for _,j in ipairs (History_SV["Default"][acc]["$AccountWide"]["log"]) do
 		Line= Line +1
 		accounts[acc].logtable.numlin = Line
 		TimeStr = os.date(dateformat_log,j["TimeStamp"])
@@ -240,7 +227,7 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
 		me.timeplayed = math.floor(thischar.levels[level].time/60)

 		-- Generate the leveling box.  ============================
-		local 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)
@@ -533,15 +520,14 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
 				local C = WB_dat[id].C
 				key = tostring(L) .. tostring(C)	-- make name key
 				dname = Locations[key]				-- Zone Locations
-					if dname == nil then
-				dname = "key " .. key .." not found"
+				if dname == nil then
+					dname = "key " .. key .." not found"
 				end
 				WB_Info[key] = {count = 0}
 				WB_Area[C] =0
 				me.WB_box:setcell(L,C,dname .. " (0)")
 		end

-
 		for id,_ in pairs (WB_dat) do  -- For Achievements we have..
 			if thischar.ach[id] ~= nil then
 				local L = WB_dat[id].L
@@ -567,9 +553,9 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
 		end
 		--Set Column Colours if 30 done.
 		for i,j in pairs (WB_Area) do
-		if j > 29 then
-			iup.SetAttribute(me.WB_box,  "BGCOLOR0:".. tostring(i), Colour_Heading_Complete)
-		end
+			if j > 29 then
+				iup.SetAttribute(me.WB_box,  "BGCOLOR0:".. tostring(i), Colour_Heading_Complete)
+			end
 		end

 -- Create SkillQuest Achievements Box==========================
@@ -595,8 +581,6 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
 		iup.SetAttribute(me.SQ_box,  "FGCOLOR*:5", Colour_Not_Complete)

 		-- Need to keep track of multiple achievements for SQ in Zones. Index them by zone LineColumn.
---		thisSQ_Info = me.SQ_Info
-		SQ_Faction={}

 		local ccount, count
 		-- Set up box with default data, and adjust
@@ -619,9 +603,9 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
 				ccount = ccount + count		-- Track the faction (Column)
 				me.SQ_box:setcell(L,C,dname .. " (" .. tostring(count) .. ")")

-				local colour_cell = "FGCOLOR" .. L .. ":" .. C
+				local colour = "FGCOLOR" .. L .. ":" .. C
 				if count == #SQ_Info[key].quests then		-- Got them all??
-					iup.SetAttribute(me.SQ_box, colour_cell , Colour_Complete)  -- Yup
+					iup.SetAttribute(me.SQ_box, colour , Colour_Complete)  -- Yup
 				end
 			end   -- L

@@ -635,9 +619,8 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}

 		me.SQ_Detail_box = {}
 		me.SQ_Detail_Zbox = iup.zbox{}
-	--		me.SQ_Frame = iup.frame{title = "Quest Details"} -- Panel for details

-		local info, name, link
+		local name, link
 		for key, info in pairs(SQ_Info) do	-- for each zone
 		--	print ("LAng: "..lang .. "  " ..key, dump(info))
 			me.SQ_Detail_box[key]= iup.matrix {numcol=2, numcol_visible=2,  numlin=0}
@@ -648,13 +631,13 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
 			me.SQ_Detail_box[key]:setcell(0,2, L.Link)
 			iup.SetAttribute(me.SQ_Detail_box[key], "READONLY", "YES")
 			iup.SetAttribute(me.SQ_Detail_box[key], "ALIGNMENT0", "ACENTER")
+			iup.SetAttribute(me.SQ_Detail_box[key], "ALIGNMENTLIN0", "ALEFT")
 			iup.SetAttribute(me.SQ_Detail_box[key], "ALIGNMENT1", "ALEFT")
 			iup.SetAttribute(me.SQ_Detail_box[key], "ALIGNMENT2", "ALEFT")
 			iup.SetAttribute(me.SQ_Detail_box[key],"WIDTH0", "30")
 			iup.SetAttribute(me.SQ_Detail_box[key],"WIDTH1", "150")
 			iup.SetAttribute(me.SQ_Detail_box[key],"WIDTH2", "250")
 			for _, id in ipairs (info.quests) do	-- get the quests of the zone
-			--	print (dump(id))
 				me.SQ_Detail_box[key].numlin = Line
 				me.SQ_Detail_box[key]:setcell(Line,0, tostring(id))

@@ -666,15 +649,31 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
 				link = SQ_dat[id].link1
 				me.SQ_Detail_box[key]:setcell(Line,1, name)
 				me.SQ_Detail_box[key]:setcell(Line,2, link)
-				--print(name, link)
+				-- Set Detail Colours on achievement
+				if thischar.ach[id] == nil  then
+					iup.SetAttribute(me.SQ_Detail_box[key],"FGCOLOR" .. tostring(Line) .. ":*", Colour_Not_Complete)	-- Nope
+				end
+
 				Line= Line+1
 			end
+	--[[		-- Click on Link,
+			function me.SQ_Detail_box[key]:click_cb(L,C)
+				if C == 2 then
+				--iup.help{self:getcell,L,C}
+				--	print(self:getcell(L,C))
+				else
+					return IUP_IGNORE
+				end
+			end
+			--]]
 			iup.Append(me.SQ_Detail_Zbox, me.SQ_Detail_box[key])
 		end

+		function me.SQ_box:enteritem_cb(L,C)
+			me.SQ_Detail_Zbox.value = me.SQ_Detail_box[tostring(L) .. tostring(C)]
+		end


---]]
 	 -- ====================================
 	--  == Prepare for the user display tabs
 		me.tab = iup.vbox{
@@ -727,8 +726,7 @@ btn_archive = iup.button{title="Archive", FGCOLOR = "#FF0000"}
 									iup.vbox {	["tabtitle"] =L.SkillQuests,
 												iup.label{title=L.SkillLab,expand="HORIZONTAL"},
 												me.SQ_box,
-												iup.label{title="Detail"},
-
+												iup.label{title=L.Detail},
 												me.SQ_Detail_Zbox,
 												iup.fill{}
 											},
diff --git a/data/de.lua b/data/de.lua
index f674871..bcb2000 100644
--- a/data/de.lua
+++ b/data/de.lua
@@ -53,10 +53,11 @@ Area_names = {
 		WBosses = "World Bosses",
 		Zone = "Zone",
 		SkillQuests = "SkillQuests",
-		SkillLab = "Quests mit Skillpunkt-Belohnung",
+		SkillLab = "Quests mit Skillpunkt-Belohnung Click for detail.",
 		Ach_ID = "Ach ID",
 		Name = "Name",
 		Link = "Link",
+		Detail = "Detail",
 	}

 pub_names = {
diff --git a/data/en.lua b/data/en.lua
index 6519de2..a43feaa 100644
--- a/data/en.lua
+++ b/data/en.lua
@@ -51,10 +51,11 @@ Area_names = {
 		WBosses = "World Bosses",
 		Zone = "Zone",
 		SkillQuests = "SkillQuests",
-		SkillLab = "Quests Awarding a Skill Point",
+		SkillLab = "Quests Awarding a Skill Point. Click for Detail",
 		Ach_ID = "Ach ID",
 		Name = "Name",
 		Link = "Link",
+		Detail = "Detail",
 	}

 pub_names = {