diff --git a/lua/CraftResearchTimer.lua b/lua/CraftResearchTimer.lua
index 2aa50b9..ad9e8aa 100644
--- a/lua/CraftResearchTimer.lua
+++ b/lua/CraftResearchTimer.lua
@@ -383,6 +383,7 @@ end
function CRT.toggleGRID()
if (CRT.UI.GRID_TLW:IsHidden() == true) then
+ CRT.GRID_Sort()
CRT.UI.GRID_TLW:SetHidden(false)
CRT.SV.Settings.GRID.hidden = false
else
diff --git a/lua/GRID.lua b/lua/GRID.lua
index c2b939e..9c9dbd1 100644
--- a/lua/GRID.lua
+++ b/lua/GRID.lua
@@ -5,7 +5,7 @@ local num_char --track character number drawing for, for positioning
local k,v
function CRT.GRID_Create()
-
+
-- Fenetre de base
CRT.UI.GRID_TLW= WINDOW_MANAGER:CreateTopLevelWindow("CRT_GRID_TLW")
CRT.UI.GRID_TLW:SetHidden(CRT.SV.Settings.GRID.hidden)
@@ -17,8 +17,8 @@ function CRT.GRID_Create()
CRT.UI.GRID_TLW:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, CRT.SV.Settings.GRID.offset.X, CRT.SV.Settings.GRID.offset.Y)
CRT.UI.GRID_TLW:SetHandler("OnMouseUp", function(self) CRT.Save_position("GRID")end)
CRT.UI.GRID_TLW:SetHidden(true)
-
-
+
+
--/background
CRT.UI.GRID_BD = WINDOW_MANAGER:CreateControlFromVirtual("CRT_GRID_BD",CRT.UI.GRID_TLW, "ZO_DefaultBackdrop")
CRT.UI.GRID_BD:SetAlpha(CRT.SV.Settings.GRID.BackdropAlpha)
@@ -33,30 +33,29 @@ function CRT.GRID_Create()
CRT.UI.GRID_BTN:SetMouseOverTexture("/esoui/art/buttons/decline_up.dds")
CRT.UI.GRID_BTN:SetHandler( "OnClicked" , function(self) CRT.UI.GRID_TLW:SetHidden(true); CRT.SV.Settings.GRID.hidden = true end )
- CRT.Char_sort()
- -- this loads up the grid in sorted order, but it doesn't stay sorted as research is completed and started.
- for _, v in ipairs(CRT.CharsInOrder) do
- CRT.GRID_Create_Character(v)
- end
+ for k, _ in pairs(CRT.SV.data.Craft) do
+ CRT.GRID_Create_Character(k)
+ end
end
function CRT.GRID_Create_Character(k)
local x, y
local width = 360
- local panelheight = 120 -- per character
-
+ local panelheight = 130 -- per character at 100%
+ local prevcontrol, ctl_headers
+ ctl_headers = {} -- controls at top of craft, indexed on craft
if (num_char == nil) then
num_char = 0
end
if ((CRT.SV.data.Craft[k][0]["Simu_craft"] ~= 0 or CRT.SV.data.Craft[k][1]["Simu_craft"] ~= 0 or CRT.SV.data.Craft[k][2]["Simu_craft"] ~= 0)) then
-
+
CRT.UI.GRID_WD[k] = {}
-- Containing window for character data. We can then move it as a group
CRT.UI.GRID_WD[k].panel = WINDOW_MANAGER:CreateTopLevelWindow("CRT_GRID_"..k.."_panel")
CRT.UI.GRID_WD[k].panel:SetParent(CRT.UI.GRID_TLW)
CRT.UI.GRID_WD[k].panel:SetAnchor(TOPRIGHT,CRT.UI.GRID_TLW,TOPRIGHT,0,panelheight*num_char)
CRT.UI.GRID_WD[k].panel:SetDimensions(width,panelheight)
-
+
-- label for character name
CRT.UI.GRID_WD[k].label = WINDOW_MANAGER:CreateControl("CRT_GRID_"..k.."_label",CRT.UI.GRID_WD[k].panel,CT_LABEL)
CRT.UI.GRID_WD[k].label:SetFont("ZoFontGame")
@@ -66,34 +65,30 @@ function CRT.GRID_Create_Character(k)
CRT.UI.GRID_WD[k].label:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k].panel,TOPLEFT,0,0)
CRT.UI.GRID_WD[k].label:SetHorizontalAlignment(1)
CRT.UI.GRID_WD[k].label:SetText(string.upper(k))
-
-
- if (num_char == 0) then
- x = 0
- y = 20
- else
- x = 0
- y = 20+num_char*120 -- tab down 120
- end
+
+ prevcontrol = CRT.UI.GRID_WD[k].label -- use this to anchor the next control, in this case the row of skill headers
+
+
-- Create section headers with dummy text for each skill
- --blacksmithing
+ --blacksmithing
CRT.UI.GRID_WD[k][0] = {}
CRT.UI.GRID_WD[k][0][0] = {}
CRT.UI.GRID_WD[k][0][0]["BS_Icon"] = WINDOW_MANAGER:CreateControl("CRT_GRID_"..k.."_0_icon",CRT.UI.GRID_WD[k].panel,CT_TEXTURE)
CRT.UI.GRID_WD[k][0][0]["BS_Icon"]:SetHidden(false)
CRT.UI.GRID_WD[k][0][0]["BS_Icon"]:SetDimensions(20,20)
CRT.UI.GRID_WD[k][0][0]["BS_Icon"]:SetAlpha(1)
- CRT.UI.GRID_WD[k][0][0]["BS_Icon"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k].panel,TOPLEFT,0,20)
+ CRT.UI.GRID_WD[k][0][0]["BS_Icon"]:SetAnchor(TOPLEFT,prevcontrol,BOTTOMLEFT,0,5) -- below
CRT.UI.GRID_WD[k][0][0]["BS_Icon"]:SetTexture("/esoui/art/icons/ability_smith_007.dds")
-
+
CRT.UI.GRID_WD[k][0][0]["BS_Text"] = WINDOW_MANAGER:CreateControl("CRT_GRID_"..k.."_0_text",CRT.UI.GRID_WD[k].panel,CT_LABEL)
CRT.UI.GRID_WD[k][0][0]["BS_Text"]:SetHidden(false)
CRT.UI.GRID_WD[k][0][0]["BS_Text"]:SetFont("ZoFontGame")
- CRT.UI.GRID_WD[k][0][0]["BS_Text"]:SetDimensions(panelwidth,20)
+ CRT.UI.GRID_WD[k][0][0]["BS_Text"]:SetDimensions(width/3,20)
CRT.UI.GRID_WD[k][0][0]["BS_Text"]:SetColor(CRT.SV.Settings.GRID.Color.r, CRT.SV.Settings.GRID.Color.g, CRT.SV.Settings.GRID.Color.b, CRT.SV.Settings.GRID.Color.a)
CRT.UI.GRID_WD[k][0][0]["BS_Text"]:SetAlpha(1)
- CRT.UI.GRID_WD[k][0][0]["BS_Text"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k].panel,TOPLEFT,20,20)
+ CRT.UI.GRID_WD[k][0][0]["BS_Text"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k][0][0]["BS_Icon"],TOPRIGHT,0,0) -- Side by the previous
CRT.UI.GRID_WD[k][0][0]["BS_Text"]:SetText("Loading")
+ ctl_headers[0] = CRT.UI.GRID_WD[k][0][0]["BS_Icon"]
--Clothing
CRT.UI.GRID_WD[k][1] = {}
@@ -102,18 +97,19 @@ function CRT.GRID_Create_Character(k)
CRT.UI.GRID_WD[k][1][0]["CL_Icon"]:SetHidden(false)
CRT.UI.GRID_WD[k][1][0]["CL_Icon"]:SetDimensions(20,20)
CRT.UI.GRID_WD[k][1][0]["CL_Icon"]:SetAlpha(1)
- CRT.UI.GRID_WD[k][1][0]["CL_Icon"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k].panel,TOPLEFT,120,20)
+ CRT.UI.GRID_WD[k][1][0]["CL_Icon"]:SetAnchor(TOPLEFT,prevcontrol,BOTTOMLEFT,width/3,5)
CRT.UI.GRID_WD[k][1][0]["CL_Icon"]:SetTexture("/esoui/art/icons/ability_tradecraft_008.dds")
-
+
CRT.UI.GRID_WD[k][1][0]["CL_Text"] = WINDOW_MANAGER:CreateControl("CRT_GRID_"..k.."_1_text",CRT.UI.GRID_WD[k].panel,CT_LABEL)
CRT.UI.GRID_WD[k][1][0]["CL_Text"]:SetHidden(false)
CRT.UI.GRID_WD[k][1][0]["CL_Text"]:SetFont("ZoFontGame")
- CRT.UI.GRID_WD[k][1][0]["CL_Text"]:SetDimensions(panelwidth,20)
+ CRT.UI.GRID_WD[k][1][0]["CL_Text"]:SetDimensions(width/3,20)
CRT.UI.GRID_WD[k][1][0]["CL_Text"]:SetColor(CRT.SV.Settings.GRID.Color.r, CRT.SV.Settings.GRID.Color.g, CRT.SV.Settings.GRID.Color.b, CRT.SV.Settings.GRID.Color.a)
CRT.UI.GRID_WD[k][1][0]["CL_Text"]:SetAlpha(1)
- CRT.UI.GRID_WD[k][1][0]["CL_Text"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k].panel,TOPLEFT,140,20)
+ CRT.UI.GRID_WD[k][1][0]["CL_Text"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k][1][0]["CL_Icon"],TOPRIGHT,0,0)
CRT.UI.GRID_WD[k][1][0]["CL_Text"]:SetText("Loading")
-
+ ctl_headers[1] = CRT.UI.GRID_WD[k][1][0]["CL_Icon"]
+
--Woodworking
CRT.UI.GRID_WD[k][2] = {}
CRT.UI.GRID_WD[k][2][0] = {}
@@ -121,28 +117,23 @@ function CRT.GRID_Create_Character(k)
CRT.UI.GRID_WD[k][2][0]["WO_Icon"]:SetHidden(false)
CRT.UI.GRID_WD[k][2][0]["WO_Icon"]:SetDimensions(20,20)
CRT.UI.GRID_WD[k][2][0]["WO_Icon"]:SetAlpha(1)
- CRT.UI.GRID_WD[k][2][0]["WO_Icon"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k].panel,TOPLEFT,240,20)
+ CRT.UI.GRID_WD[k][2][0]["WO_Icon"]:SetAnchor(TOPLEFT,prevcontrol,BOTTOMLEFT,(width*2/3),5)
CRT.UI.GRID_WD[k][2][0]["WO_Icon"]:SetTexture("/esoui/art/icons/ability_tradecraft_009.dds")
-
+
CRT.UI.GRID_WD[k][2][0]["WO_Text"] = WINDOW_MANAGER:CreateControl("CRT_GRID_"..k.."_2_text",CRT.UI.GRID_WD[k].panel,CT_LABEL)
CRT.UI.GRID_WD[k][2][0]["WO_Text"]:SetHidden(false)
CRT.UI.GRID_WD[k][2][0]["WO_Text"]:SetFont("ZoFontGame")
CRT.UI.GRID_WD[k][2][0]["WO_Text"]:SetDimensions(width,20)
CRT.UI.GRID_WD[k][2][0]["WO_Text"]:SetColor(CRT.SV.Settings.GRID.Color.r, CRT.SV.Settings.GRID.Color.g, CRT.SV.Settings.GRID.Color.b, CRT.SV.Settings.GRID.Color.a)
CRT.UI.GRID_WD[k][2][0]["WO_Text"]:SetAlpha(1)
- CRT.UI.GRID_WD[k][2][0]["WO_Text"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k].panel,TOPLEFT,260,20)
+ CRT.UI.GRID_WD[k][2][0]["WO_Text"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k][2][0]["WO_Icon"],TOPRIGHT,0,0)
CRT.UI.GRID_WD[k][2][0]["WO_Text"]:SetText("Loading")
-
- for id_craft = 0, 2,1 do
+ ctl_headers[2] = CRT.UI.GRID_WD[k][2][0]["WO_Icon"]
+
+ for id_craft = 0, 2,1 do -- column
+ prevcontrol=ctl_headers[id_craft] -- line up under this column
+
for simcraft = 1, 3,1 do
-
- -- if (num_char == 0) then
- x = (120*id_craft)+20
- y = 20+(20*simcraft)
- -- else
- -- x = (120*id_craft)+20
- -- y = 20+num_char*panelheight+(20*simcraft)
- -- end
CRT.UI.GRID_WD[k][id_craft][simcraft] = {}
-- item icon
@@ -150,30 +141,32 @@ function CRT.GRID_Create_Character(k)
CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetHidden(true)
CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetDimensions(20,20)
CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetAlpha(1)
- CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k].panel,TOPLEFT,x-20,y)
- CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetMouseEnabled(true)
+ CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetAnchor(TOPLEFT,prevcontrol,BOTTOMLEFT,0,0) --below
+ CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetMouseEnabled(true)
CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetHandler("OnMouseEnter", function (self)
ZO_Tooltips_ShowTextTooltip(self, TOP, CRT.SV.data.Craft[k][id_craft][simcraft]["Item_name"])
end)
CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetHandler("OnMouseExit", function (self)
ZO_Tooltips_HideTextTooltip()
- end)
-
-
-
+ end)
+ prevcontrol= CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]
+
+
-- trait icon
CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"] = WINDOW_MANAGER:CreateControl("CRT_GRID_"..k.."_"..id_craft.."_"..simcraft.."_trait",CRT.UI.GRID_WD[k].panel,CT_TEXTURE)
CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetHidden(true)
CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetDimensions(20,20)
CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetAlpha(1)
- CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k].panel,TOPLEFT,x,y)
- CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetMouseEnabled(true)
+ CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetAnchor(TOPLEFT,prevcontrol,TOPRIGHT,0,0) --to right
+ CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetMouseEnabled(true)
CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetHandler("OnMouseEnter", function (self)
ZO_Tooltips_ShowTextTooltip(self, TOP, CRT.SV.data.Craft[k][id_craft][simcraft]["Trait_description"])
end)
CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetHandler("OnMouseExit", function (self)
ZO_Tooltips_HideTextTooltip()
- end)
+ end)
+ prevcontrol=CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]
+
-- text
CRT.UI.GRID_WD[k][id_craft][simcraft]["text"] = WINDOW_MANAGER:CreateControl("CRT_GRID_"..k.."_"..id_craft.."_"..simcraft.."_text",CRT.UI.GRID_WD[k].panel,CT_LABEL)
CRT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetHidden(true)
@@ -181,48 +174,58 @@ function CRT.GRID_Create_Character(k)
CRT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetDimensions(360,20)
CRT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetColor(CRT.SV.Settings.GRID.Color.r, CRT.SV.Settings.GRID.Color.g, CRT.SV.Settings.GRID.Color.b, CRT.SV.Settings.GRID.Color.a)
CRT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetAlpha(1)
- CRT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetAnchor(TOPLEFT,CRT.UI.GRID_WD[k].panel,TOPLEFT,x+20,y)
-
-
+ CRT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetAnchor(TOPLEFT,prevcontrol,TOPRIGHT,0,0) --to right
+
+ prevcontrol=CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"] -- set back to beginning of line
+
+
end
end
num_char = num_char+1
- CRT.UI.GRID_TLW:SetDimensions(width,panelheight*num_char)
+ CRT.UI.GRID_TLW:SetDimensions(width,CRT.UI.GRID_WD[k].panel:GetHeight()*num_char)
end
end
function CRT.GRID_Update(timestamp)
-
- for k, _ in pairs(CRT.SV.data.Craft) do
+ local emp_start, em_finish
+ for k, _ in pairs(CRT.SV.data.Craft) do
if ( (CRT.SV.data.Craft[k][0]["Simu_craft"] ~= 0 or CRT.SV.data.Craft[k][1]["Simu_craft"] ~= 0 or CRT.SV.data.Craft[k][2]["Simu_craft"] ~= 0)) then
for id_craft = 0, 2,1 do
if (CRT.SV.data.Craft[k][id_craft]["MaxResearch"] ~= nil ) then
local MaxResearch = CRT.SV.data.Craft[k][id_craft]["MaxResearch"]
local Simu_craft = CRT.SV.data.Craft[k][id_craft]["Simu_craft"]
+ if Simu_craft == MaxResearch then
+ emp_start = "" --no highlighting
+ em_finish = ""
+ else
+ emp_start = "|cFF0000"
+ em_finish = "|r"
+ end
if (id_craft == 0) then
- CRT.UI.GRID_WD[k][id_craft][0]["BS_Text"]:SetText(" "..Simu_craft.." / "..MaxResearch)
-
+ CRT.UI.GRID_WD[k][id_craft][0]["BS_Text"]:SetText(" "..emp_start .. Simu_craft.." / "..MaxResearch .. em_finish)
+
elseif(id_craft == 1) then
- CRT.UI.GRID_WD[k][id_craft][0]["CL_Text"]:SetText(" "..Simu_craft.." / "..MaxResearch)
+
+ CRT.UI.GRID_WD[k][id_craft][0]["CL_Text"]:SetText(" "..emp_start .. Simu_craft.." / "..MaxResearch .. em_finish)
elseif(id_craft == 2) then
- CRT.UI.GRID_WD[k][id_craft][0]["WO_Text"]:SetText(" "..Simu_craft.." / "..MaxResearch)
- end
+ CRT.UI.GRID_WD[k][id_craft][0]["WO_Text"]:SetText(" "..emp_start .. Simu_craft.." / "..MaxResearch .. em_finish)
+ end
+
+ end
+
- end
-
-
for simcraft = 1, 3,1 do
-
+
if (CRT.SV.data.Craft[k][id_craft][simcraft] ~= nil)then
-
-
+
+
CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetHidden(false)
CRT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetTexture(CRT.SV.data.Craft[k][id_craft][simcraft]["Item_icon"])
-
+
CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetHidden(false)
CRT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetTexture(CRT.SV.data.Craft[k][id_craft][simcraft]["Trait_icon"])
-
+
local currenttimer = CRT.SV.data.Craft[k][id_craft][simcraft]["EndTimeStamp"] - timestamp - 1
if (currenttimer > 0) then
@@ -231,6 +234,7 @@ function CRT.GRID_Update(timestamp)
elseif (currenttimer <= 0) then
CRT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetHidden(false)
CRT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetText("|cFF0000Finished|r")
+ CRT.UI.GRID_WD[k].label:SetText("|cFF0000" .. string.upper(k) .."|r" )
end
end
end
@@ -241,10 +245,10 @@ end
-- move characters in grid
function CRT.GRID_Sort()
-
- CRT.Char_sort()
-
- for k, v in ipairs(CRT.CharsInOrder) do
- CRT.UI.GRID_WD[v].panel:SetAnchor(TOPLEFT,CRT.UI.GRID_TLW,TOPLEFT,0,120*(k-1))
+ local panel
+ CRT.Char_sort()
+ panelheight = CRT.UI.GRID_WD[CRT.CharsInOrder[1]].panel:GetHeight()
+ for k, v in ipairs(CRT.CharsInOrder) do
+ CRT.UI.GRID_WD[v].panel:SetAnchor(TOPLEFT,CRT.UI.GRID_TLW,TOPLEFT,0,panelheight*(k-1))
end
- end
+ end