Signed-off-by: His Dad <John@hisdad.org>

His Dad [09-26-16 - 05:18]
Signed-off-by: His Dad <John@hisdad.org>
Filename
HistOffline.lua
data/Public.lua
diff --git a/HistOffline.lua b/HistOffline.lua
index afa9435..2af8be7 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -330,8 +330,12 @@ end
 	end
   end

-  for _,i in ipairs(grp1tokey) do
-	  dung.pub[i] = {}
+  dung.pub = {}
+  dung.pub.box = {}
+  dung.pub.key = {}
+
+  for _,i in ipairs(Pub_Dat.key) do
+	  dung.pub.key[i] = {}
   end


@@ -470,13 +474,13 @@ end
 		iup.SetAttribute(me.Pub_box,  "FGCOLOR*:3", FG_Colour_Not_Complete)
 		iup.SetAttribute(me.Pub_box,  "FGCOLOR*:4", FG_Colour_Not_Complete)

-		for id,_ in pairs (pub_dat) do
+		for id,_ in pairs (Pub_Dat.dat) do
 			if thischar.ach[id] ~= nil then
-				local colour = "FGCOLOR" .. pub_dat[id].L .. ":" .. pub_dat[id].C
+				local colour = "FGCOLOR" .. Pub_Dat.dat[id].L .. ":" .. Pub_Dat.dat[id].C
 				iup.SetAttribute(me.Pub_box, colour, FG_Colour_Complete)
 				-- Add char to dungeon
-				local key = tostring(pub_dat[id].L .. pub_dat[id].C)
-				dung.pub[key][playerID] = "Y"
+				local key = tostring(Pub_Dat.dat[id].L .. Pub_Dat.dat[id].C)
+				dung.pub.key[key][playerID] = "Y"
 			end
 		end

@@ -492,9 +496,9 @@ end
 				iup.SetAttribute(me.Pub_box,  "BGCOLOR0:3", Colour_Heading_Complete)
 		end

-		for id,_ in pairs (pub_dat) do  -- Load text
-				local L = pub_dat[id].L
-				local C = pub_dat[id].C
+		for id,dat in pairs (Pub_Dat.dat) do  -- Load text
+				local L = dat.L
+				local C = dat.C
 				local key = tostring(tostring(L) .. tostring(C))	-- make name key
 				local dname = pub_names[key]
 					if dname == nil then
@@ -980,11 +984,11 @@ end

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

-		local panel =(#accounts[acc].playerIDs * 90)
+		local panel =((#accounts[acc].playerIDs * 100)+120)
 		if panel < 680  then
 			panel = 680
 		elseif panel >950 then
-			panel = 950
+		--	panel = 1600
 		end
 		accounts[acc].panelsize =  tostring(panel) ..  "x300"
 	end  -- Chars
@@ -997,32 +1001,31 @@ iup.Append(accounts[acc].char_tabs, accounts[acc].log_tab)

 	-- Create Pub Dungeon Character Box=========================

-	dung.Pub_box = {}
-	dung.Pub_box = iup.matrix {numcol=#accounts[acc].playerIDs,  numlin=#grp2tokey, widthdef=100}
+	dung.pub.box = iup.matrix {numcol=#accounts[acc].playerIDs,  numlin=#Pub_Dat.key, widthdef=100}
 	--Set Line titles
-	for i,key in ipairs(grp2tokey) do
-		dung.Pub_box:setcell(i, 0, pub_names[key])
+	for line,key in ipairs(Pub_Dat.key) do
+		dung.pub.box:setcell(line, 0, pub_names[key])
 	end
 	--set lines
-	dung.Pub_box:setcell(0,0, L.Location)
+	dung.pub.box:setcell(0,0, L.Location)

 	--Create Columns for Chars
-	for i ,playerID in ipairs(accounts[acc].playerIDs) do
-		dung.Pub_box:setcell(0, i, playerNames[playerID])
+	for col ,playerID in ipairs(accounts[acc].playerIDs) do
+		dung.pub.box:setcell(0, col, playerNames[playerID])
 	end

-	iup.SetAttribute(dung.Pub_box, "READONLY", "YES")
+	iup.SetAttribute(dung.pub.box, "READONLY", "YES")

 	-- Populate with character data ============================
-	for line,key in ipairs(grp2tokey) do		-- over each dungeon
+	for line,key in ipairs(Pub_Dat.key) do		-- over each dungeon
 	    -- does that char exist in the table.
-		for i,playerID in ipairs(accounts[acc].playerIDs) do	-- over each char in order
-			if dung.pub[key][playerID] == nil then
-				dung.Pub_box:setcell(line,i, "N")
-				iup.SetAttribute(dung.Pub_box,"BGCOLOR" .. tostring(line) .. ":" .. tostring(i), BG_Colour_Not_Complete)
+		for col,playerID in ipairs(accounts[acc].playerIDs) do	-- over each char in order
+			if dung.pub.key[key][playerID] == nil then
+				dung.pub.box:setcell(line,col, "N")
+				iup.SetAttribute(dung.pub.box,"BGCOLOR" .. tostring(line) .. ":" .. tostring(col), BG_Colour_Not_Complete)
 			else
-				dung.Pub_box:setcell(line,i, "Y")
-				iup.SetAttribute(dung.Pub_box,"BGCOLOR" .. tostring(line) .. ":" .. tostring(i), BG_Colour_Complete)
+				dung.pub.box:setcell(line,col, "Y")
+				iup.SetAttribute(dung.pub.box,"BGCOLOR" .. tostring(line) .. ":" .. tostring(col), BG_Colour_Complete)
 			end
 		end
 	end
@@ -1030,7 +1033,7 @@ iup.Append(accounts[acc].char_tabs, accounts[acc].log_tab)

 	dung.Pub_tab = iup.vbox {
 						["tabtitle"] =L.Pub,
-						dung.Pub_box,
+						dung.pub.box,
 						iup.fill{},
 				}

diff --git a/data/Public.lua b/data/Public.lua
index d953c8e..3d4b7d9 100644
--- a/data/Public.lua
+++ b/data/Public.lua
@@ -1,6 +1,7 @@

 -- key is Achievement ID, L,C are Line Column in Grid
-pub_dat = {
+Pub_Dat= {}
+Pub_Dat.dat = {
 [368]= {L=1, C=1 },		-- Crows Wood
 [370]= {L=2, C=1 },		-- Forgotten Crypts Conqueror",
 [300]= {L=3, C=1 },		-- Sanguine's Demesne Conqueror",
@@ -21,4 +22,6 @@ pub_dat = {

 [1056]= {L=5, C=4},		-- Village of the Lost Conqueror"
 }
+Pub_Dat.vet = false
+Pub_Dat.key=grp1tokey	-- from keys.lua file