refeactored-busted

His Dad [06-26-15 - 02:47]
refeactored-busted
Filename
HistOffline.lua
diff --git a/HistOffline.lua b/HistOffline.lua
index 5c94ccf..f58a31c 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -111,6 +111,7 @@ naccounts = 0
 for i,_ in pairs(History_SV["Default"]) do
 	accounts[i] = {}
 	accounts[i].names = {}	-- intermediate table for sorting. WIP. Array formatted.
+	accounts[i].names_vet= {}	--subset of names which are >L50
 	accounts[i].name = {}
 	naccounts = naccounts +1
 	table.insert(accounts_list, i)
@@ -288,8 +289,11 @@ end
 		me.level = level
 		if (level <=50) then
 			me.levelstr = tostring(level)
+			me.isvet = false
 		else
 			me.levelstr = "V" .. tostring(level -50)
+			me.isvet = true
+			table.insert(accounts[acc].names_vet,char)
 		end
 		-- == Cumulative TimePlayed
 		me.timeplayed = math.floor(thischar.levels[level].time/60)
@@ -767,50 +771,56 @@ end
 							iup.label{title=L.TPlayed .. me.timeplayed .." " .. L.Hrs},
 							iup.fill{}
 							},
-					iup.label{SEPARATOR="HORIZONTAL"},
-					iup.vbox {		--Data tabs for Char
-						iup.tabs { iup.vbox {	["tabtitle"] =L.GrpDungeon,
+					iup.label{SEPARATOR="HORIZONTAL"}
+					}
+
+		me.data_tabs = iup.vbox{} --Data tabs for Char
+		iup.Append(me.data_tabs, iup.hbox {	["tabtitle"] =L.GrpDungeon,
 												iup.label{title=L.GrpLab,expand="HORIZONTAL"},
 												me.Grp_box,
 												iup.fill{}
-											},
-									iup.vbox {	["tabtitle"] =L.PubDungeon,
+											})
+
+		iup.Append(me.data_tabs,	iup.vbox {	["tabtitle"] =L.PubDungeon,
 												iup.label{title=L.PubLab,expand="HORIZONTAL"},
 												me.Pub_box,
 												iup.fill{}
-											},
-									iup.vbox {	["tabtitle"] =L.VetDungeon,
+											})
+
+		iup.Append(me.data_tabs, iup.vbox {	["tabtitle"] =L.VetDungeon,
 												iup.label{title=L.VetLab,expand="HORIZONTAL"},
 												me.Vet_box,
 												iup.fill{}
-											},
+											})

-									iup.vbox {	["tabtitle"] =L.Leveling,
+		iup.Append(me.data_tabs, iup.vbox {	["tabtitle"] =L.Leveling,
 										--		iup.label{title="LevLabel",expand="HORIZONTAL"},
 												me.leveling_box,
 												iup.fill{}
-											},
-									iup.vbox {	["tabtitle"] =L.Locations,
+											})
+
+		iup.Append(me.data_tabs, iup.vbox {	["tabtitle"] =L.Locations,
 											--	iup.label{title="LevLabel",expand="HORIZONTAL"},
 												me.Map_box,
 												iup.fill{}
-											},
-									iup.vbox {	["tabtitle"] =L.WBosses,
+											})
+
+		iup.Append(me.data_tabs, iup.vbox {	["tabtitle"] =L.WBosses,
 												iup.label{title=L.WBLab,expand="HORIZONTAL"},
 												me.WB_box,
 												iup.fill{}
-											},
-									iup.vbox {	["tabtitle"] =L.SkillQuests,
+											})
+
+		iup.Append(me.data_tabs, iup.vbox {	["tabtitle"] =L.SkillQuests,
 												iup.label{title=L.SkillLab,expand="HORIZONTAL"},
 												me.SQ_box,
 												iup.label{title=L.Detail},
 												me.SQ_Detail_Zbox,
 												iup.fill{}
-											},
+											})

-								},	-- end of tabs for dungeons
-							},
-					}  -- end of tabs for characters vbox
+
+		iup.Append(me.tab,me.data_tabs)

 		iup.Append(accounts[acc].char_tabs,me.tab)

@@ -834,15 +844,15 @@ iup.Append(accounts[acc].char_tabs, accounts[acc].log_tab)
 	dung.Pub_box = {}
 	dung.Pub_box = iup.matrix {numcol=#accounts[acc].names,  numlin=#grp2key, widthdef=90}
 	--Set Line titles
-	for i=1, #grp2key do
-		dung.Pub_box:setcell(i, 0, pub_names[grp2key[i]])
+	for i,key in ipairs(grp2key) do
+		dung.Pub_box:setcell(i, 0, pub_names[key])
 	end
 	--set lines
 	dung.Pub_box:setcell(0,0, L.Location)

 	--Create Columns for Chars
-	for i =1, #accounts[acc].names do
-		dung.Pub_box:setcell(0, i, accounts[acc].names[i])
+	for i ,char in ipairs(accounts[acc].names) do
+		dung.Pub_box:setcell(0, i, char)
 	end

 	iup.SetAttribute(dung.Pub_box, "READONLY", "YES")
@@ -850,8 +860,7 @@ iup.Append(accounts[acc].char_tabs, accounts[acc].log_tab)
 	-- Populate with character data ============================
 	for line,key in ipairs(grp2key) do		-- over each dungeon
 	    -- does that char exist in the table.
-		for i =1, #accounts[acc].names do	-- over each char in order
-		    local char = accounts[acc].names[i]
+		for i,char in ipairs(accounts[acc].names) do	-- over each char in order
 			if dung.pub[key][char] == nil then
 				dung.Pub_box:setcell(line,i, "N")
 			else
@@ -889,8 +898,7 @@ iup.Append(accounts[acc].char_tabs, accounts[acc].log_tab)
 	-- Populate with character data ============================
 	for line,key in ipairs(grp2key) do		-- over each dungeon
 	    -- does that char exist in the table.
-		for i =1, #accounts[acc].names do	-- over each char in order
-		    local char = accounts[acc].names[i]
+		for i,char in ipairs(accounts[acc].names) do	-- over each char in order
 			if dung.grp[key][char] == nil then
 				dung.Grp_box:setcell(line,i, "N")
 			else
@@ -908,55 +916,62 @@ iup.Append(accounts[acc].char_tabs, accounts[acc].log_tab)
 	iup.Append(accounts[acc].dung_tabs, dung.Grp_tab)

 	-- Create Vet Grp Dungeon Character Box=======================
+	if #accounts[acc].names_vet > 0  then
+		dung.Vet_box = {}
+		dung.Vet_box = iup.matrix {numcol=#accounts[acc].names_vet,  numlin=#vet2key, widthdef=90}
+		--Set Line titles
+		for i,key in ipairs(vet2key) do
+			dung.Vet_box:setcell(i, 0, grp_names[key])
+		end
+		--set lines
+		dung.Vet_box:setcell(0,0, L.Location)
+		--Create Columns for Chars

-	dung.Vet_box = {}
-	dung.Vet_box = iup.matrix {numcol=#accounts[acc].names,  numlin=#vet2key, widthdef=90}
-	--Set Line titles
-	for i=1, #vet2key do
-		dung.Vet_box:setcell(i, 0, grp_names[vet2key[i]])
-	end
-	--set lines
-	dung.Vet_box:setcell(0,0, L.Location)
-	--Create Columns for Chars
-	for i =1, #accounts[acc].names do
-		dung.Vet_box:setcell(0, i, accounts[acc].names[i])
-	end
+		for line,char in ipairs(accounts[acc].names_vet) do

-	iup.SetAttribute(dung.Vet_box, "READONLY", "YES")
+				dung.Vet_box:setcell(0, line, char)
+				--Done it??
+				if dung.vet[key] == nil then
+				print (key)
+				end
+			--[[	if dung.vet[key][char] == nil then
+						dung.Vet_box:setcell(line,col, "N")
+				else
+						dung.Vet_box:setcell(line,col, "Y")
+				end --]]

-	-- Populate with character data ============================
-	for line,key in ipairs(vet2key) do		-- over each dungeon
-	    -- does that char exist in the table.
-		for i =1, #accounts[acc].names do	-- over each char in order
-		    local char = accounts[acc].names[i]
-			if dung.vet[key][char] == nil then
-				dung.Vet_box:setcell(line,i, "N")
-			else
-				dung.Vet_box:setcell(line,i, "Y")
-			end
-		end
+
+		end --]]
+
+		iup.SetAttribute(dung.Vet_box, "READONLY", "YES")
+
+
+		-- Create Vet Dungeon Tab ==================================
+		dung.Vet_tab = iup.vbox {
+							["tabtitle"] =L.Vet,
+							dung.Vet_box,
+							iup.fill{},
+					}
+
+		iup.Append(accounts[acc].dung_tabs, dung.Vet_tab)
 	end
-	-- Create Vet Dungeon Tab ==================================
-	dung.Vet_tab = iup.vbox {
-						["tabtitle"] =L.Vet,
-						dung.Vet_box,
-						iup.fill{},
-				}
-	iup.Append(accounts[acc].dung_tabs, dung.Vet_tab)

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

 	dung.Trial_box = {}
-	dung.Trial_box = iup.matrix {numcol=#accounts[acc].names,  numlin=#trial2key, widthdef=90}
+	dung.Trial_box = iup.matrix {numcol=0,  numlin=#trial2key, widthdef=90}
 	--Set Line titles
-	for i=1, #trial2key do
-		dung.Trial_box:setcell(i, 0, grp_names[trial2key[i]])
+	for line=1, #trial2key do
+		dung.Trial_box:setcell(line, 0, grp_names[trial2key[line]])
 	end
 	--set lines
 	dung.Trial_box:setcell(0,0, L.Location)
+	local col = 0
 	--Create Columns for Chars
-	for i =1, #accounts[acc].names do
-		dung.Trial_box:setcell(0, i, accounts[acc].names[i])
+	for line,char  in ipairs(accounts[acc].names_vet) do
+		col = col +1
+		dung.Trial_box.numcol = col
+		dung.Trial_box:setcell(0, line, char)
 	end

 	iup.SetAttribute(dung.Trial_box, "READONLY", "YES")
@@ -967,7 +982,9 @@ iup.Append(accounts[acc].char_tabs, accounts[acc].log_tab)
 						dung.Trial_box,
 						iup.fill{},
 				}
-	iup.Append(accounts[acc].dung_tabs, dung.Trial_tab)
+	if col > 0  then
+		iup.Append(accounts[acc].dung_tabs, dung.Trial_tab)
+	end


 end -- Accounts