diff --git a/lua/GRID.lua b/lua/GRID.lua
index 484c19f..976d2bd 100644
--- a/lua/GRID.lua
+++ b/lua/GRID.lua
@@ -1,5 +1,3 @@
--- Craft Research Timer (CRT) by @aTo (EU)
--- v0.4.8
local num_char --track character number drawing for, for positioning
local k,v
@@ -123,42 +121,42 @@ function RT.GRID_Create_Character(k)
RT.UI.GRID_WD[k][2][0]["WO_Text"]:SetText(RT.L["Loading"])
ctl_headers[2] = RT.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 craft_id = 0, 2,1 do -- column
+ prevcontrol=ctl_headers[craft_id] -- line up under this column
for simcraft = 1, 3,1 do
- RT.UI.GRID_WD[k][id_craft][simcraft] = {}
+ RT.UI.GRID_WD[k][craft_id][simcraft] = {}
-- item icon
- RT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"] = WINDOW_MANAGER:CreateControl("RT_GRID_"..k.."_"..id_craft.."_"..simcraft.."_icon",RT.UI.GRID_WD[k].panel,CT_TEXTURE)
- RT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetHidden(true)
- RT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetDimensions(20,20)
- RT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetAnchor(TOPLEFT,prevcontrol,BOTTOMLEFT,0,0) --below
- RT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetMouseEnabled(true)
- prevcontrol= RT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]
+ RT.UI.GRID_WD[k][craft_id][simcraft]["item_icon"] = WINDOW_MANAGER:CreateControl("RT_GRID_"..k.."_"..craft_id.."_"..simcraft.."_icon",RT.UI.GRID_WD[k].panel,CT_TEXTURE)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["item_icon"]:SetHidden(true)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["item_icon"]:SetDimensions(20,20)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["item_icon"]:SetAnchor(TOPLEFT,prevcontrol,BOTTOMLEFT,0,0) --below
+ RT.UI.GRID_WD[k][craft_id][simcraft]["item_icon"]:SetMouseEnabled(true)
+ prevcontrol= RT.UI.GRID_WD[k][craft_id][simcraft]["item_icon"]
-- trait icon
- RT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"] = WINDOW_MANAGER:CreateControl("RT_GRID_"..k.."_"..id_craft.."_"..simcraft.."_trait",RT.UI.GRID_WD[k].panel,CT_TEXTURE)
- RT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetHidden(true)
- RT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetDimensions(20,20)
- RT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetAnchor(TOPLEFT,prevcontrol,TOPRIGHT,0,0) --to right
- RT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetMouseEnabled(true)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["trait_icon"] = WINDOW_MANAGER:CreateControl("RT_GRID_"..k.."_"..craft_id.."_"..simcraft.."_trait",RT.UI.GRID_WD[k].panel,CT_TEXTURE)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["trait_icon"]:SetHidden(true)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["trait_icon"]:SetDimensions(20,20)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["trait_icon"]:SetAnchor(TOPLEFT,prevcontrol,TOPRIGHT,0,0) --to right
+ RT.UI.GRID_WD[k][craft_id][simcraft]["trait_icon"]:SetMouseEnabled(true)
- RT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetHandler("OnMouseExit", function (self)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["trait_icon"]:SetHandler("OnMouseExit", function (self)
ZO_Tooltips_HideTextTooltip()
end)
- prevcontrol=RT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]
+ prevcontrol=RT.UI.GRID_WD[k][craft_id][simcraft]["trait_icon"]
-- text
- RT.UI.GRID_WD[k][id_craft][simcraft]["text"] = WINDOW_MANAGER:CreateControl("RT_GRID_"..k.."_"..id_craft.."_"..simcraft.."_text",RT.UI.GRID_WD[k].panel,CT_LABEL)
- RT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetHidden(true)
- RT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetFont(RT.font)
- RT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetDimensions(360,20)
- RT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetAnchor(TOPLEFT,prevcontrol,TOPRIGHT,0,0) --to right
+ RT.UI.GRID_WD[k][craft_id][simcraft]["text"] = WINDOW_MANAGER:CreateControl("RT_GRID_"..k.."_"..craft_id.."_"..simcraft.."_text",RT.UI.GRID_WD[k].panel,CT_LABEL)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["text"]:SetHidden(true)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["text"]:SetFont(RT.font)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["text"]:SetDimensions(360,20)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["text"]:SetAnchor(TOPLEFT,prevcontrol,TOPRIGHT,0,0) --to right
- prevcontrol=RT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"] -- set back to beginning of line
+ prevcontrol=RT.UI.GRID_WD[k][craft_id][simcraft]["item_icon"] -- set back to beginning of line
end
end
num_char = num_char+1
@@ -169,10 +167,10 @@ function RT.GRID_Update(timestamp)
local emp_start, em_finish
for k, _ in pairs(RT.SV.data.Craft) do
if ( (RT.SV.data.Craft[k][0].Simu_craft ~= 0 or RT.SV.data.Craft[k][1].Simu_craft ~= 0 or RT.SV.data.Craft[k][2].Simu_craft ~= 0)) then
- for id_craft = 0, 2,1 do
- if (RT.SV.data.Craft[k][id_craft].MaxResearch ~= nil ) then
- local MaxResearch = RT.SV.data.Craft[k][id_craft].MaxResearch
- local Simu_craft = RT.SV.data.Craft[k][id_craft].Simu_craft
+ for craft_id = 0, 2,1 do
+ if (RT.SV.data.Craft[k][craft_id].MaxResearch ~= nil ) then
+ local MaxResearch = RT.SV.data.Craft[k][craft_id].MaxResearch
+ local Simu_craft = RT.SV.data.Craft[k][craft_id].Simu_craft
if Simu_craft == MaxResearch then
emp_start = "" --no highlighting
em_finish = ""
@@ -180,14 +178,14 @@ function RT.GRID_Update(timestamp)
emp_start = "|cFF0000"
em_finish = "|r"
end
- if (id_craft == 0) then
- RT.UI.GRID_WD[k][id_craft][0]["BS_Text"]:SetText(" "..emp_start .. Simu_craft.." / "..MaxResearch .. em_finish)
+ if (craft_id == 0) then
+ RT.UI.GRID_WD[k][craft_id][0]["BS_Text"]:SetText(" "..emp_start .. Simu_craft.." / "..MaxResearch .. em_finish)
- elseif(id_craft == 1) then
+ elseif(craft_id == 1) then
- RT.UI.GRID_WD[k][id_craft][0]["CL_Text"]:SetText(" "..emp_start .. Simu_craft.." / "..MaxResearch .. em_finish)
- elseif(id_craft == 2) then
- RT.UI.GRID_WD[k][id_craft][0]["WO_Text"]:SetText(" "..emp_start .. Simu_craft.." / "..MaxResearch .. em_finish)
+ RT.UI.GRID_WD[k][craft_id][0]["CL_Text"]:SetText(" "..emp_start .. Simu_craft.." / "..MaxResearch .. em_finish)
+ elseif(craft_id == 2) then
+ RT.UI.GRID_WD[k][craft_id][0]["WO_Text"]:SetText(" "..emp_start .. Simu_craft.." / "..MaxResearch .. em_finish)
end
end
@@ -195,21 +193,21 @@ function RT.GRID_Update(timestamp)
for simcraft = 1, 3,1 do
- if (RT.SV.data.Craft[k][id_craft].doing[simcraft] ~= nil)then
+ if (RT.SV.data.Craft[k][craft_id].doing[simcraft] ~= nil)then
- RT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetHidden(false)
- RT.UI.GRID_WD[k][id_craft][simcraft]["item_icon"]:SetTexture(RT.SV.data.Craft[k][id_craft].doing[simcraft]["Item_icon"])
+ RT.UI.GRID_WD[k][craft_id][simcraft]["item_icon"]:SetHidden(false)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["item_icon"]:SetTexture(RT.SV.data.Craft[k][craft_id].doing[simcraft]["Item_icon"])
- RT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetHidden(false)
- RT.UI.GRID_WD[k][id_craft][simcraft]["trait_icon"]:SetTexture(RT.SV.data.Craft[k][id_craft].doing[simcraft]["Trait_icon"])
+ RT.UI.GRID_WD[k][craft_id][simcraft]["trait_icon"]:SetHidden(false)
+ RT.UI.GRID_WD[k][craft_id][simcraft]["trait_icon"]:SetTexture(RT.SV.data.Craft[k][craft_id].doing[simcraft]["Trait_icon"])
- local currenttimer = RT.SV.data.Craft[k][id_craft].doing[simcraft]["EndTimeStamp"] - timestamp - 1
- RT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetHidden(false)
+ local currenttimer = RT.SV.data.Craft[k][craft_id].doing[simcraft]["EndTimeStamp"] - timestamp - 1
+ RT.UI.GRID_WD[k][craft_id][simcraft]["text"]:SetHidden(false)
if (currenttimer > 0) then
- RT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetText(RT.Converthms(currenttimer))
+ RT.UI.GRID_WD[k][craft_id][simcraft]["text"]:SetText(RT.Converthms(currenttimer))
else
- RT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetText(RT.L["Finished"])
+ RT.UI.GRID_WD[k][craft_id][simcraft]["text"]:SetText(RT.L["Finished"])
RT.UI.GRID_WD[k].label:SetText("|cFF0000" .. string.upper(k) .."|r" )
end
end
diff --git a/lua/ResearchTimer.lua b/lua/ResearchTimer.lua
index d5bc3cf..0f52ee0 100644
--- a/lua/ResearchTimer.lua
+++ b/lua/ResearchTimer.lua
@@ -7,12 +7,10 @@ RT = {
cmdsetup = "/rt",
version = "v1",
playername = "",
- interval = 20,
width = 100,
height = 80,
UI = {},
SV={}
--- collect=0
}
@@ -29,14 +27,14 @@ function RT.Collect_Data()
end
-function RT.Info_Research(craft_type,id_craft)
+function RT.Info_Research(craft_type,craft_id)
local Simu_craft = 0
local ResearchLines, ResearchTrait
local MaxResearch = GetMaxSimultaneousSmithingResearch(craft_type)
local nbtype = GetNumSmithingResearchLines(craft_type)
- RT.SV.data.Craft[RT.playername][id_craft] = {}
- RT.SV.data.Craft[RT.playername][id_craft].doing = {}
+ RT.SV.data.Craft[RT.playername][craft_id] = {}
+ RT.SV.data.Craft[RT.playername][craft_id].doing = {}
for ResearchLines = 1, nbtype, 1 do
local item_name, item_icon, numTraits, timeRequiredForNextResearchSecs = GetSmithingResearchLineInfo(craft_type, ResearchLines)
for ResearchTrait = 1, numTraits, 1 do
@@ -49,19 +47,19 @@ function RT.Info_Research(craft_type,id_craft)
local traitType, trait_description, _ = GetSmithingResearchLineTraitInfo(craft_type,ResearchLines,ResearchTrait)
local _, trait_name, trait_icon, _, _, _, _ = GetSmithingTraitItemInfo(traitType+1)
- RT.SV.data.Craft[RT.playername][id_craft].doing[Simu_craft] = {}
- RT.SV.data.Craft[RT.playername][id_craft].doing[Simu_craft]["PlayerName"] = RT.playername
- RT.SV.data.Craft[RT.playername][id_craft].doing[Simu_craft]["EndTimeStamp"] = GetTimeStamp() + timeRemaining
- RT.SV.data.Craft[RT.playername][id_craft].doing[Simu_craft]["Item_name"] = string.sub(item_name, 1, 18)
- RT.SV.data.Craft[RT.playername][id_craft].doing[Simu_craft]["Item_icon"] = item_icon
- RT.SV.data.Craft[RT.playername][id_craft].doing[Simu_craft]["Trait_name"] = trait_name
- RT.SV.data.Craft[RT.playername][id_craft].doing[Simu_craft]["Trait_icon"] = trait_icon
- RT.SV.data.Craft[RT.playername][id_craft].doing[Simu_craft]["Trait_description"] = trait_description
+ RT.SV.data.Craft[RT.playername][craft_id].doing[Simu_craft] = {}
+ -- RT.SV.data.Craft[RT.playername][craft_id].doing[Simu_craft]["PlayerName"] = RT.playername
+ RT.SV.data.Craft[RT.playername][craft_id].doing[Simu_craft]["EndTimeStamp"] = GetTimeStamp() + timeRemaining
+ RT.SV.data.Craft[RT.playername][craft_id].doing[Simu_craft]["Item_name"] = string.sub(item_name, 1, 18)
+ RT.SV.data.Craft[RT.playername][craft_id].doing[Simu_craft]["Item_icon"] = item_icon
+ RT.SV.data.Craft[RT.playername][craft_id].doing[Simu_craft]["Trait_name"] = trait_name
+ RT.SV.data.Craft[RT.playername][craft_id].doing[Simu_craft]["Trait_icon"] = trait_icon
+ RT.SV.data.Craft[RT.playername][craft_id].doing[Simu_craft]["Trait_description"] = trait_description
end
end
end
- RT.SV.data.Craft[RT.playername][id_craft].MaxResearch = MaxResearch
- RT.SV.data.Craft[RT.playername][id_craft].Simu_craft = Simu_craft
+ RT.SV.data.Craft[RT.playername][craft_id].MaxResearch = MaxResearch
+ RT.SV.data.Craft[RT.playername][craft_id].Simu_craft = Simu_craft
end
function RT.Char_sort() -- Produce a sorted list for display