diff --git a/CraftResearchTimer.txt b/CraftResearchTimer.txt
index 477d4f8..dc8b3a5 100644
--- a/CraftResearchTimer.txt
+++ b/CraftResearchTimer.txt
@@ -6,6 +6,7 @@
lib\LibStub.lua
+lua\header.lua
lua\CORE.lua
lua\ALERT.lua
lua\GRID.lua
diff --git a/lua/ALERT.lua b/lua/ALERT.lua
index fb961d9..6c82b52 100644
--- a/lua/ALERT.lua
+++ b/lua/ALERT.lua
@@ -2,7 +2,7 @@
-- v0.4.8
-function CRT_Research_Alert(k, id_craft, simcraft, start)
+function CRT.Research_Alert(k, id_craft, simcraft, start)
if (start == true) then
for i = 0, 2, 1 do
local MaxResearch = CRT.SV.data.Craft[k][i]["MaxResearch"]
@@ -44,7 +44,7 @@ function CRT_Research_Alert(k, id_craft, simcraft, start)
end
end
-function CRT_Alert_Create()
+function CRT.Alert_Create()
CRT.UI.ALERT_TLW = WINDOW_MANAGER:CreateTopLevelWindow("CRT_ALERT_TLW")
CRT.UI.ALERT_TLW:SetDimensions(800,300)
CRT.UI.ALERT_TLW:SetHidden(not CRT.SV.Settings.ALERT.hidden)
@@ -54,7 +54,7 @@ function CRT_Alert_Create()
CRT.UI.ALERT_TLW:SetDrawLayer(0)
CRT.UI.ALERT_TLW:SetScale(1)
CRT.UI.ALERT_TLW:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, CRT.SV.Settings.ALERT.offset.X, CRT.SV.Settings.ALERT.offset.Y)
- CRT.UI.ALERT_TLW:SetHandler("OnMouseUp", function(self) CRT_Save_position("ALERT")end)
+ CRT.UI.ALERT_TLW:SetHandler("OnMouseUp", function(self) CRT.Save_position("ALERT")end)
--Text Buffer
CRT.UI.ALERT_WD = WINDOW_MANAGER:CreateControl("CRT_ALERT_WB",CRT.UI.ALERT_TLW,CT_TEXTBUFFER)
@@ -76,17 +76,17 @@ function CRT_Alert_Create()
CRT.UI.ALERT_BD:SetAnchor(TOPLEFT,lsSum,TOPLEFT,0,0)
end
-function CRT_ALERT_Update(timestamp)
+function CRT.ALERT_Update(timestamp)
local k,j
for k, _ in pairs(CRT.SV.data.Craft) do
if (CRT.SV.data.Craft[CRT.playername]["Start"] == true) then
local CRT_Current_PlayerPosition = GetMapPlayerPosition("player")
if (CRT_Current_PlayerPosition ~= CRT_Start_PlayerPosition) then
CRT.SV.data.Craft[CRT.playername]["Start"] = false
- CRT_Research_Alert(CRT.playername, nil, nil, true)
+ CRT.Research_Alert(CRT.playername, nil, nil, true)
for j, _ in pairs(CRT.SV.data.Craft) do
if ((k ~= CRT.playername) and (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_Research_Alert(k, nil, nil, true)
+ CRT.Research_Alert(k, nil, nil, true)
end
end
end
@@ -101,7 +101,7 @@ function CRT_ALERT_Update(timestamp)
if (CRT.SV.data.Craft[k][id_craft][simcraft]["Alert"] == true) then
CRT.SV.data.Craft[k][id_craft][simcraft]["Alert"] = false
- CRT_Research_Alert(k, id_craft, simcraft, false)
+ CRT.Research_Alert(k, id_craft, simcraft, false)
end
end
end
diff --git a/lua/CORE.lua b/lua/CORE.lua
index 06dad56..7f53e6a 100644
--- a/lua/CORE.lua
+++ b/lua/CORE.lua
@@ -2,22 +2,22 @@
-- v0.4.11
-function CRT_Collect_Data()
+function CRT.Collect_Data()
CRT.SV.data.Craft[CRT.playername].shortest = 99999999 -- for this player find next due.
- CRT_Info_Research(CRAFTING_TYPE_BLACKSMITHING, 0)
- CRT_Info_Research(CRAFTING_TYPE_CLOTHIER, 1)
- CRT_Info_Research(CRAFTING_TYPE_WOODWORKING, 2)
+ CRT.Info_Research(CRAFTING_TYPE_BLACKSMITHING, 0)
+ CRT.Info_Research(CRAFTING_TYPE_CLOTHIER, 1)
+ CRT.Info_Research(CRAFTING_TYPE_WOODWORKING, 2)
end
-function CRT_Info_Research(craft_type,id_craft)
+function CRT.Info_Research(craft_type,id_craft)
local Simu_craft = 0
+ local ResearchLines, ResearchTrait
local MaxResearch = GetMaxSimultaneousSmithingResearch(craft_type)
local nbtype = GetNumSmithingResearchLines(craft_type) --Nombre de item craftable pour un craft(ex couture: jambe/robe/ect)
CRT.SV.data.Craft[CRT.playername][id_craft] = {}
-
for ResearchLines = 1, nbtype, 1 do
local item_name, item_icon, numTraits, timeRequiredForNextResearchSecs = GetSmithingResearchLineInfo(craft_type, ResearchLines)
for ResearchTrait = 1, numTraits, 1 do
@@ -54,14 +54,14 @@ function CRT_Info_Research(craft_type,id_craft)
CRT.SV.data.Craft[CRT.playername][id_craft]["Simu_craft"] = Simu_craft
end
-function CRT_Research_started()
+function CRT.Research_started()
-- erase all data for this character
CRT.SV.data.Craft[CRT.playername] = {}
-- Collect new data
- CRT_Collect_Data()
+ CRT.Collect_Data()
if (CRT.UI.GRID_WD[CRT.playername] == nil) then
- CRT_GRID_Create_Character(CRT.playername)
+ CRT.GRID_Create_Character(CRT.playername)
end
end
\ No newline at end of file
diff --git a/lua/CRAFT.lua b/lua/CRAFT.lua
index 53432b7..5b34900 100644
--- a/lua/CRAFT.lua
+++ b/lua/CRAFT.lua
@@ -1,16 +1,16 @@
-- Craft Research Timer (CRT) by @aTo (EU)
-- v0.4.8
-function CRT_CRAFT_Create()
+function CRT.CRAFT_Create()
if (CRT.SV.Settings.mode == "Icon") then
- CRT_mode_width = CRT.SV.Settings.icon_width
- CRT_mode_height = CRT.SV.Settings.icon_height
- CRT_vertical_move = 30
+ CRT.mode_width = CRT.SV.Settings.icon_width
+ CRT.mode_height = CRT.SV.Settings.icon_height
+ CRT.vertical_move = 30
elseif (CRT.SV.Settings.mode == "Text") then
- CRT_mode_width = CRT.SV.Settings.text_width
- CRT_mode_height = CRT.SV.Settings.text_height
- CRT_vertical_move = 0
+ CRT.mode_width = CRT.SV.Settings.text_width
+ CRT.mode_height = CRT.SV.Settings.text_height
+ CRT.vertical_move = 0
end
--- MAIN WINDOW ---
@@ -26,7 +26,7 @@ function CRT_CRAFT_Create()
for id_craft = 0, 2, 1 do
CRT.UI.CRAFT_TLW[id_craft] = WINDOW_MANAGER:CreateTopLevelWindow("CRT_CRAFT_TLW_"..id_craft)
- CRT.UI.CRAFT_TLW[id_craft]:SetDimensions(CRT_mode_width,CRT_mode_height)
+ CRT.UI.CRAFT_TLW[id_craft]:SetDimensions(CRT.mode_width,CRT.mode_height)
CRT.UI.CRAFT_TLW[id_craft]:SetHidden(false)
CRT.UI.CRAFT_TLW[id_craft]:SetClampedToScreen(false)
CRT.UI.CRAFT_TLW[id_craft]:SetMovable(CRT.SV.Settings.lock)
@@ -37,15 +37,15 @@ function CRT_CRAFT_Create()
if (id_craft == 0) then
CRT.UI.CRAFT_TLW[id_craft]:SetHidden(not CRT.SV.Settings.BS.craft)
CRT.UI.CRAFT_TLW[id_craft]:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, CRT.SV.Settings.BS.offset.X, CRT.SV.Settings.BS.offset.Y)
- CRT.UI.CRAFT_TLW[id_craft]:SetHandler("OnMouseUp", function(self) CRT_Save_position(id_craft)end)
+ CRT.UI.CRAFT_TLW[id_craft]:SetHandler("OnMouseUp", function(self) CRT.Save_position(id_craft)end)
elseif(id_craft == 1) then
CRT.UI.CRAFT_TLW[id_craft]:SetHidden(not CRT.SV.Settings.CL.craft)
CRT.UI.CRAFT_TLW[id_craft]:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, CRT.SV.Settings.CL.offset.X, CRT.SV.Settings.CL.offset.Y)
- CRT.UI.CRAFT_TLW[id_craft]:SetHandler("OnMouseUp", function(self) CRT_Save_position(id_craft)end)
+ CRT.UI.CRAFT_TLW[id_craft]:SetHandler("OnMouseUp", function(self) CRT.Save_position(id_craft)end)
elseif(id_craft == 2) then
CRT.UI.CRAFT_TLW[id_craft]:SetHidden(not CRT.SV.Settings.WO.craft)
CRT.UI.CRAFT_TLW[id_craft]:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, CRT.SV.Settings.WO.offset.X, CRT.SV.Settings.WO.offset.Y)
- CRT.UI.CRAFT_TLW[id_craft]:SetHandler("OnMouseUp", function(self) CRT_Save_position(id_craft)end)
+ CRT.UI.CRAFT_TLW[id_craft]:SetHandler("OnMouseUp", function(self) CRT.Save_position(id_craft)end)
end
CRT.UI.CRAFT_BD[id_craft] = WINDOW_MANAGER:CreateControlFromVirtual(CRT.name.."_Windows"..id_craft.."_BD",CRT.UI.CRAFT_TLW[id_craft], "ZO_DefaultBackdrop")
@@ -82,9 +82,9 @@ function CRT_CRAFT_Create()
CRT.UI.CRAFT_WD[id_craft][0]["Craft_Text"] = WINDOW_MANAGER:CreateControl("CRT_CRAFT_WD_"..id_craft.."_0_text",CRT.UI.CRAFT_TLW[id_craft],CT_LABEL)
CRT.UI.CRAFT_WD[id_craft][0]["Craft_Text"]:SetHidden(false)
CRT.UI.CRAFT_WD[id_craft][0]["Craft_Text"]:SetFont(CRT.font)
- CRT.UI.CRAFT_WD[id_craft][0]["Craft_Text"]:SetDimensions(CRT_mode_width,CRT_mode_height)
+ CRT.UI.CRAFT_WD[id_craft][0]["Craft_Text"]:SetDimensions(CRT.mode_width,CRT.mode_height)
CRT.UI.CRAFT_WD[id_craft][0]["Craft_Text"]:SetAlpha(1)
- CRT.UI.CRAFT_WD[id_craft][0]["Craft_Text"]:SetAnchor(TOPLEFT,CRT.UI.CRAFT_TLW[id_craft],TOPLEFT,CRT_vertical_move,0)
+ CRT.UI.CRAFT_WD[id_craft][0]["Craft_Text"]:SetAnchor(TOPLEFT,CRT.UI.CRAFT_TLW[id_craft],TOPLEFT,CRT.vertical_move,0)
CRT.UI.CRAFT_WD[id_craft][0]["Craft_Text"]:SetText("Loading")
if(id_craft == 0) then
CRT.UI.CRAFT_WD[id_craft][0]["Craft_Text"]:SetColor(CRT.SV.Settings.BS.Color.r, CRT.SV.Settings.BS.Color.g, CRT.SV.Settings.BS.Color.b, CRT.SV.Settings.BS.Color.a)
@@ -119,9 +119,9 @@ function CRT_CRAFT_Create()
CRT.UI.CRAFT_WD[id_craft][simcraft]["text"] = WINDOW_MANAGER:CreateControl("CRT_CRAFT_WD_"..id_craft.."_"..simcraft.."_text",CRT.UI.CRAFT_TLW[id_craft],CT_LABEL)
CRT.UI.CRAFT_WD[id_craft][simcraft]["text"]:SetHidden(true)
CRT.UI.CRAFT_WD[id_craft][simcraft]["text"]:SetFont(CRT.font)
- CRT.UI.CRAFT_WD[id_craft][simcraft]["text"]:SetDimensions(CRT_mode_width,CRT_mode_height)
+ CRT.UI.CRAFT_WD[id_craft][simcraft]["text"]:SetDimensions(CRT.mode_width,CRT.mode_height)
CRT.UI.CRAFT_WD[id_craft][simcraft]["text"]:SetAlpha(1)
- CRT.UI.CRAFT_WD[id_craft][simcraft]["text"]:SetAnchor(LEFT,CRT.UI.CRAFT_TLW[id_craft],LEFT,CRT_vertical_move,x)
+ CRT.UI.CRAFT_WD[id_craft][simcraft]["text"]:SetAnchor(LEFT,CRT.UI.CRAFT_TLW[id_craft],LEFT,CRT.vertical_move,x)
if(id_craft == 0) then
CRT.UI.CRAFT_WD[id_craft][simcraft]["text"]:SetColor(CRT.SV.Settings.BS.Color.r, CRT.SV.Settings.BS.Color.g, CRT.SV.Settings.BS.Color.b, CRT.SV.Settings.BS.Color.a)
elseif(id_craft == 1) then
@@ -141,7 +141,7 @@ function CRT_CRAFT_Create()
end
end
-function CRT_CRAFT_Update(timestamp)
+function CRT.CRAFT_Update(timestamp)
for id_craft = 0, 2,1 do
local MaxResearch = CRT.SV.data.Craft[CRT.playername][id_craft]["MaxResearch"]
@@ -165,7 +165,7 @@ function CRT_CRAFT_Update(timestamp)
if (CRT.SV.data.Craft[CRT.playername][id_craft][simcraft] ~= nil)then
local currenttimer = CRT.SV.data.Craft[CRT.playername][id_craft][simcraft]["EndTimeStamp"] - timestamp - 1
- local human_timer = CRT_Converthms(currenttimer)
+ local human_timer = CRT.Converthms(currenttimer)
local msg = "error"
if (CRT.SV.Settings.mode == "Icon") then
diff --git a/lua/CraftResearchTimer.lua b/lua/CraftResearchTimer.lua
index 5170d83..e9afadc 100644
--- a/lua/CraftResearchTimer.lua
+++ b/lua/CraftResearchTimer.lua
@@ -1,131 +1,9 @@
-- Craft Research Timer (CRT) by @aTo (EU)
-- v0.4.11
-CRT = {
- name = "CraftResearchTimer",
- font = "ZoFontGame",
- cmdsetup = "/crt",
- tic = 1,
- svName = "CraftResearchTimer_SavedVariables",
- svVersion = 0.4,
- version = "v0.4.11",
- playername = "",
- font = "ZoFontGame",
- interval = 20,
- width = 100,
- height = 80,
- UI = {},
- collect=0,
- data_defaults = {
- Craft = {}
- },
- svDefaults = {
- icon_width = 100,
- icon_height = 80,
- text_width = 200,
- text_height = 80,
- lock = true,
- mode = "Icon",
- timer_format = "smart",
- BS = {
- offset = {
- X = 950,
- Y = 540,
- },
- craft = true,
- Hide_0 = false,
- Hide_Type = "Menus only",
- BackdropAlpha = 0.5,
- Scale = 1,
- Color = {
- r = 1,
- g = 1,
- b = 1,
- a = 1 },
- },
- CL = {
- offset = {
- X = 1080,
- Y = 540,
- },
- craft = true,
- Hide_0 = false,
- Hide_Type = "Menus only",
- BackdropAlpha = 0.5,
- Scale = 1,
- Color = {
- r = 1,
- g = 1,
- b = 1,
- a = 1 },
- },
- WO = {
- offset = {
- X = 1210,
- Y = 540,
- },
- craft = true,
- Hide_0 = false,
- Hide_Type = "Menus only",
- BackdropAlpha = 0.5,
- Scale = 1,
- Color = {
- r = 1,
- g = 1,
- b = 1,
- a = 1 },
- },
- GRID = {
- hidden = true,
- offset = {
- X = 950,
- Y = 400,
- },
- Hide_Type = "Menus only",
- BackdropAlpha = 0.5,
- Scale = 1,
- Color = {
- r = 1,
- g = 1,
- b = 1,
- a = 1 },
- },
- ALERT = {
- hidden = true,
- preview = false,
- BS = true,
- CL = true,
- WO = true,
- offset = {
- X = 560,
- Y = 100,
- },
- Color = {
- r = 1,
- g = 0,
- b = 0,
- a = 1 },
-
- }
- }
-}
-
-CRT.SV={}
-CRT.UI.GRID_TLW = {}
-CRT.UI.GRID_BD = {}
-CRT.UI.GRID_WD = {}
-CRT.UI.GRID_BTN = {}
-
-CRT.UI.CRAFT_TLW = {}
-CRT.UI.CRAFT_BD = {}
-CRT.UI.CRAFT_WD = {}
-
-CRT.UI.ALERT_TLW = {}
-CRT.UI.ALERT_BD = {}
-CRT.UI.ALERT_WD = {}
-function CRT_Init(eventCode, addOnName)
+function CRT.Init(eventCode, addOnName)
if(addOnName == CRT.name) then
CRT.Init_done = false
@@ -140,7 +18,7 @@ function CRT_Init(eventCode, addOnName)
-- CRT.SV.Hireling_data.versionxx = nil
-- Slash commands
- SLASH_COMMANDS[CRT.cmdsetup] = CRT_CommandText_setup
+ SLASH_COMMANDS[CRT.cmdsetup] = CRT.CommandText_setup
-- Create Keybinds
ZO_CreateStringId("SI_BINDING_NAME_CRT_ToggleUI", "|c96FF00Toggle craft windows|r")
@@ -166,27 +44,27 @@ function CRT_Init(eventCode, addOnName)
name = "Unlock all windows",
tooltip = "Toggle lock on/off",
getFunc = function() return CRT.SV.Settings.lock end,
- setFunc = CRT_SetLock
+ setFunc = CRT.SetLock
}, {
type = "dropdown",
name = "Select Mode",
tooltip = "Display researched items as icon or text?",
choices = {"Icon", "Text"},
getFunc = function() return CRT.SV.Settings.mode end,
- setFunc = CRT_SetMode,
+ setFunc = CRT.SetMode,
warning = "Will need to reload the UI"
}, {
type = "dropdown",
name = "Timer format",
tooltip = "How to display remaining time?",
choices = {"smart", "fixed", "compact"},
- getFunc = CRT_Gettimer_format,
- setFunc = CRT_Settimer_format,
+ getFunc = CRT.Gettimer_format,
+ setFunc = CRT.Settimer_format,
}, {
type = "button",
name = "Reset to default",
tooltip = "Load default values",
- func = CRT_Reset,
+ func = CRT.Reset,
warning = "Will need to reload the UI"
},
@@ -199,37 +77,37 @@ function CRT_Init(eventCode, addOnName)
name = "Enable Alert window",
tooltip = "Enable Alert window",
getFunc = function() return CRT.SV.Settings.ALERT.hidden end,
- setFunc = CRT_SetAlert
+ setFunc = CRT.SetAlert
}, {
type = "checkbox",
name = "Preview Alert window",
tooltip = "Toggle preview on/off",
getFunc = function() return CRT.SV.Settings.ALERT.preview end,
- setFunc = CRT_SetPreview
+ setFunc = CRT.SetPreview
}, {
type = "colorpicker",
name = "Text Color",
tooltip = "Select the text color",
- getFunc = CRT_GetALERTColor,
- setFunc = CRT_SetALERTColor
+ getFunc = CRT.GetALERTColor,
+ setFunc = CRT.SetALERTColor
}, {
type = "checkbox",
name = "Enable Blacksmithing alert",
tooltip = "Enable Blacksmithing alert",
getFunc = function() return CRT.SV.Settings.ALERT.BS end,
- setFunc = CRT_SetALERTBS
+ setFunc = CRT.SetALERTBS
}, {
type = "checkbox",
name = "Enable Clothing alert",
tooltip = "Enable Clothing alert",
getFunc = function() return CRT.SV.Settings.ALERT.CL end,
- setFunc = CRT_SetALERTCL
+ setFunc = CRT.SetALERTCL
}, {
type = "checkbox",
name = "Enable Woodworking alert",
tooltip = "Enable Woodworking alert",
getFunc = function() return CRT.SV.Settings.ALERT.WO end,
- setFunc = CRT_SetALERTWO
+ setFunc = CRT.SetALERTWO
},
-- Grid
@@ -243,8 +121,8 @@ function CRT_Init(eventCode, addOnName)
min = 0,
max = 100,
step = 1,
- getFunc = CRT_GetGRIDBackdropAlpha,
- setFunc = CRT_SetGRIDBackdropAlpha
+ getFunc = CRT.GetGRIDBackdropAlpha,
+ setFunc = CRT.SetGRIDBackdropAlpha
}, {
type = "slider",
name = "Scale",
@@ -252,14 +130,14 @@ function CRT_Init(eventCode, addOnName)
min = 0,
max = 200,
step = 1,
- getFunc = CRT_GetGRIDScale,
- setFunc = CRT_SetGRIDScale
+ getFunc = CRT.GetGRIDScale,
+ setFunc = CRT.SetGRIDScale
}, {
type = "colorpicker",
name = "Text Color",
tooltip = "Select the text color",
- getFunc = CRT_GetGRIDColor,
- setFunc = CRT_SetGRIDColor
+ getFunc = CRT.GetGRIDColor,
+ setFunc = CRT.SetGRIDColor
}, {
type = "button",
name = "Apply new colors",
@@ -270,7 +148,7 @@ function CRT_Init(eventCode, addOnName)
type = "button",
name = "Toggle grid view",
tooltip = "Display or hide the grid view",
- func = function() CRT_toggleGRID() end, true,
+ func = function() CRT.toggleGRID() end, true,
},
--Blacksmithing
@@ -282,20 +160,20 @@ function CRT_Init(eventCode, addOnName)
name = "Enable Blacksmithing Tracker",
tooltip = "Enable Blacksmithing Tracker",
getFunc = function() return CRT.SV.Settings.BS.craft end,
- setFunc = CRT_SetTrackerBS
+ setFunc = CRT.SetTrackerBS
}, {
type = "checkbox",
name = "Hide if no research",
tooltip = "Hide if no research",
getFunc = function() return CRT.SV.Settings.BS.Hide_0 end,
- setFunc = CRT_SetBSHide0
+ setFunc = CRT.SetBSHide0
}, {
type = "dropdown",
name = "Display when",
tooltip = "Display when",
choices = {"Always", "Hide in menus","Menus only", "Toggle keybind"},
getFunc = function() return CRT.SV.Settings.BS.Hide_Type end,
- setFunc = CRT_SetBSHideMenu
+ setFunc = CRT.SetBSHideMenu
}, {
type = "slider",
name = "Alpha",
@@ -303,8 +181,8 @@ function CRT_Init(eventCode, addOnName)
min = 0,
max = 100,
step = 1,
- getFunc = CRT_GetBSBackdropAlpha,
- setFunc = CRT_SetBSBackdropAlpha
+ getFunc = CRT.GetBSBackdropAlpha,
+ setFunc = CRT.SetBSBackdropAlpha
}, {
type = "slider",
name = "Scale",
@@ -312,8 +190,8 @@ function CRT_Init(eventCode, addOnName)
min = 0,
max = 200,
step = 1,
- getFunc = CRT_GetBSScale,
- setFunc = CRT_SetBSScale
+ getFunc = CRT.GetBSScale,
+ setFunc = CRT.SetBSScale
},
--Clothing
@@ -325,20 +203,20 @@ function CRT_Init(eventCode, addOnName)
name = "Enable Clothing Tracker",
tooltip = "Enable Clothing Tracker",
getFunc = function() return CRT.SV.Settings.CL.craft end,
- setFunc = CRT_SetTrackerCL
+ setFunc = CRT.SetTrackerCL
}, {
type = "checkbox",
name = "Hide if no research",
tooltip = "Hide if no research",
getFunc = function() return CRT.SV.Settings.CL.Hide_0 end,
- setFunc = CRT_SetCLHide0
+ setFunc = CRT.SetCLHide0
}, {
type = "dropdown",
name = "Display when",
tooltip = "Display when",
choices = {"Always", "Hide in menus","Menus only", "Toggle keybind"},
getFunc = function() return CRT.SV.Settings.CL.Hide_Type end,
- setFunc = CRT_SetCLHideMenu
+ setFunc = CRT.SetCLHideMenu
}, {
type = "slider",
name = "Alpha",
@@ -346,8 +224,8 @@ function CRT_Init(eventCode, addOnName)
min = 0,
max = 100,
step = 1,
- getFunc = CRT_GetCLBackdropAlpha,
- setFunc = CRT_SetCLBackdropAlpha
+ getFunc = CRT.GetCLBackdropAlpha,
+ setFunc = CRT.SetCLBackdropAlpha
}, {
type = "slider",
name = "Scale",
@@ -355,8 +233,8 @@ function CRT_Init(eventCode, addOnName)
min = 0,
max = 200,
step = 1,
- getFunc = CRT_GetCLScale,
- setFunc = CRT_SetCLScale
+ getFunc = CRT.GetCLScale,
+ setFunc = CRT.SetCLScale
},
--Woodworking
@@ -368,20 +246,20 @@ function CRT_Init(eventCode, addOnName)
name = "Enable Woodworking Tracker",
tooltip = "Enable Woodworking Tracker",
getFunc = function() return CRT.SV.Settings.WO.craft end,
- setFunc = CRT_SetTrackerWO
+ setFunc = CRT.SetTrackerWO
}, {
type = "checkbox",
name = "Hide if no research",
tooltip = "Hide if no research",
getFunc = function() return CRT.SV.Settings.WO.Hide_0 end,
- setFunc = CRT_SetWOHide0
+ setFunc = CRT.SetWOHide0
}, {
type = "dropdown",
name = "Display when",
tooltip = "Display when",
choices = {"Always", "Hide in menus","Menus only", "Toggle keybind"},
getFunc = function() return CRT.SV.Settings.WO.Hide_Type end,
- setFunc = CRT_SetWOHideMenu
+ setFunc = CRT.SetWOHideMenu
}, {
type = "slider",
name = "Alpha",
@@ -389,8 +267,8 @@ function CRT_Init(eventCode, addOnName)
min = 0,
max = 100,
step = 1,
- getFunc = CRT_GetWOBackdropAlpha,
- setFunc = CRT_SetWOBackdropAlpha
+ getFunc = CRT.GetWOBackdropAlpha,
+ setFunc = CRT.SetWOBackdropAlpha
}, {
type = "slider",
name = "Scale",
@@ -398,18 +276,18 @@ function CRT_Init(eventCode, addOnName)
min = 0,
max = 200,
step = 1,
- getFunc = CRT_GetWOScale,
- setFunc = CRT_SetWOScale
+ getFunc = CRT.GetWOScale,
+ setFunc = CRT.SetWOScale
}
}
LAM:RegisterAddonPanel("CRT_OptionsPanel", panelData);
LAM:RegisterOptionControls("CRT_OptionsPanel", optionsTable);
- CRT_Start_PlayerPosition = GetMapPlayerPosition("player")
+ CRT.Start_PlayerPosition = GetMapPlayerPosition("player")
local timestamp = GetTimeStamp()
- CRT_Alert_Create()
+ CRT.Alert_Create()
-- check if old alert before erase data
--CRT_Alert_Check(playername,timestamp)
@@ -421,25 +299,25 @@ function CRT_Init(eventCode, addOnName)
CRT.SV.data.Craft[CRT.playername] = {}
CRT.SV.data.Craft[CRT.playername]["Start"] = true
- CRT_Collect_Data()
+ CRT.Collect_Data()
-- Create GRID
- CRT_GRID_Create()
+ CRT.GRID_Create()
-- Create SOLO CRAFT
- CRT_CRAFT_Create()
+ CRT.CRAFT_Create()
CRT.Init_done = true
-- Only after initialised do we hook any other events.
- EVENT_MANAGER:RegisterForEvent(CRT.name, EVENT_SMITHING_TRAIT_RESEARCH_STARTED, CRT_Research_started)
+ EVENT_MANAGER:RegisterForEvent(CRT.name, EVENT_SMITHING_TRAIT_RESEARCH_STARTED, CRT.Research_started)
end
end
-function CRT_Update()
+function CRT.Update()
if not CRT.Init_done then return; end
if not BufferReached("Info_Research", CRT.tic) then return; end
local timestamp = GetTimeStamp()
- CRT_ALERT_Update(timestamp)
- CRT_GRID_Update(timestamp)
- CRT_CRAFT_Update(timestamp)
- CRT_toggleGUI()
+ CRT.ALERT_Update(timestamp)
+ CRT.GRID_Update(timestamp)
+ CRT.CRAFT_Update(timestamp)
+ CRT.toggleGUI()
end
local bt= {}
@@ -466,7 +344,7 @@ function BufferWait(BufferName, WaitTime)
end
-EVENT_MANAGER:RegisterForEvent(CRT.name, EVENT_ADD_ON_LOADED, CRT_Init)
+EVENT_MANAGER:RegisterForEvent(CRT.name, EVENT_ADD_ON_LOADED, CRT.Init)
--EVENT_MANAGER:RegisterForEvent(CRT.name, EVENT_MAIL_OPEN_MAILBOX, CRT_Force_read)
--EVENT_MANAGER:RegisterForEvent(CRT.name, EVENT_MAIL_NUM_UNREAD_CHANGED, CRT_mail_check)
@@ -474,7 +352,7 @@ EVENT_MANAGER:RegisterForEvent(CRT.name, EVENT_ADD_ON_LOADED, CRT_Init)
-function CRT_ToggleUI()
+function CRT.ToggleUI()
if (CRT.SV.Settings.BS.craft == true and CRT.SV.Settings.BS.Hide_Type == "Toggle keybind") then
if (CRT.UI.CRAFT_TLW[0]:IsHidden() == true) then
CRT.UI.CRAFT_TLW[0]:SetHidden(false)
@@ -498,7 +376,7 @@ function CRT_ToggleUI()
end
end
-function CRT_toggleGRID()
+function CRT.toggleGRID()
if (CRT.UI.GRID_TLW:IsHidden() == true) then
CRT.UI.GRID_TLW:SetHidden(false)
CRT.SV.Settings.GRID.hidden = false
@@ -508,7 +386,7 @@ function CRT_toggleGRID()
end
end
-function CRT_toggleGUI()
+function CRT.toggleGUI()
local checkUI = ZO_Compass:IsHidden()
local hidemenu ={}
@@ -546,7 +424,7 @@ function CRT_toggleGUI()
end
end
-function CRT_Converthms(timesec)
+function CRT.Converthms(timesec)
local showDays = false
local showSeconds = false
@@ -604,7 +482,7 @@ end
end
-function CRT_Save_position(id_craft)
+function CRT.Save_position(id_craft)
if (id_craft == 0) then
CRT.SV.Settings.BS.offset.X = math.floor(CRT.UI.CRAFT_TLW[id_craft]:GetLeft())
CRT.SV.Settings.BS.offset.Y = math.floor(CRT.UI.CRAFT_TLW[id_craft]:GetTop())
@@ -625,17 +503,17 @@ end
-function CRT_CommandText_setup(lparam)
+function CRT.CommandText_setup(lparam)
if (lparam == "info") then
d("Craft Research Timer (CRT) by @aTo (EU)")
d("Version " .. CRT.version)
d("The CRT have moved to the normal game settings")
d("Player: " .. CRT.playername)
- d("Shortest: " .. CRT_Converthms(CRT.SV.data.Craft[CRT.playername].shortest))
+ d("Shortest: " .. CRT.Converthms(CRT.SV.data.Craft[CRT.playername].shortest))
elseif (lparam == "grid") then
- CRT_toggleGRID()
+ CRT.toggleGRID()
else
- CRT_ToggleUI()
+ CRT.ToggleUI()
end
end
diff --git a/lua/GRID.lua b/lua/GRID.lua
index 8402e84..d6e50a9 100644
--- a/lua/GRID.lua
+++ b/lua/GRID.lua
@@ -3,8 +3,8 @@
local num_char --track character number drawing for, for positioning
-function CRT_GRID_Create()
-
+function CRT.GRID_Create()
+ local k
-- Fenetre de base
CRT.UI.GRID_TLW= WINDOW_MANAGER:CreateTopLevelWindow("CRT_GRID_TLW")
CRT.UI.GRID_TLW:SetHidden(CRT.SV.Settings.GRID.hidden)
@@ -14,7 +14,7 @@ function CRT_GRID_Create()
CRT.UI.GRID_TLW:SetDrawLayer(1)
CRT.UI.GRID_TLW:SetScale(CRT.SV.Settings.GRID.Scale)
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:SetHandler("OnMouseUp", function(self) CRT.Save_position("GRID")end)
CRT.UI.GRID_TLW:SetHidden(true)
@@ -33,11 +33,11 @@ function CRT_GRID_Create()
for k, _ in pairs(CRT.SV.data.Craft) do
- CRT_GRID_Create_Character(k)
+ CRT.GRID_Create_Character(k)
end
end
-function CRT_GRID_Create_Character(k)
+function CRT.GRID_Create_Character(k)
if (num_char == nil) then
num_char = 0
end
@@ -182,7 +182,7 @@ function CRT_GRID_Create_Character(k)
end
end
-function CRT_GRID_Update(timestamp)
+function CRT.GRID_Update(timestamp)
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
@@ -217,7 +217,7 @@ function CRT_GRID_Update(timestamp)
if (currenttimer > 0) then
CRT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetHidden(false)
- CRT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetText(CRT_Converthms(currenttimer))
+ CRT.UI.GRID_WD[k][id_craft][simcraft]["text"]:SetText(CRT.Converthms(currenttimer))
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")
diff --git a/lua/Menu-function.lua b/lua/Menu-function.lua
index e1fde2e..0f3c471 100644
--- a/lua/Menu-function.lua
+++ b/lua/Menu-function.lua
@@ -1,7 +1,7 @@
-- Craft Research Timer (CRT) by @aTo (EU)
-- v0.4.8
-function CRT_SetLock(Newlock)
+function CRT.SetLock(Newlock)
CRT.SV.Settings.lock = Newlock
if (CRT.UI.GRID_TLW~= nil) then
CRT.UI.GRID_TLW:SetMovable(Newlock)
@@ -17,16 +17,16 @@ function CRT_SetLock(Newlock)
end
end
-function CRT_SetMode(NewMode)
+function CRT.SetMode(NewMode)
CRT.SV.Settings.mode = NewMode
ReloadUI()
end
-function CRT_Settimer_format(Newtimer_format)
+function CRT.Settimer_format(Newtimer_format)
CRT.SV.Settings.timer_format = Newtimer_format
end
-function CRT_Gettimer_format()
+function CRT.Gettimer_format()
local format = CRT.SV.Settings.timer_format
if (string.match(format, ":")) then
format = "smart"
@@ -37,14 +37,14 @@ end
-------------------------ALERT Components---------------------------------------
-function CRT_SetAlert(NewAlert)
+function CRT.SetAlert(NewAlert)
CRT.SV.Settings.ALERT.hidden = NewAlert
if (CRT.UI.ALERT_TLW ~= nil) then
CRT.UI.ALERT_TLW:SetHidden(not NewAlert)
end
end
-function CRT_SetPreview(NewPreview)
+function CRT.SetPreview(NewPreview)
CRT.SV.Settings.ALERT.preview = NewPreview
CRT.UI.ALERT_BD:SetHidden(not NewPreview)
if (CRT.UI.ALERT_TLW ~= nil) then
@@ -52,11 +52,11 @@ function CRT_SetPreview(NewPreview)
end
end
-function CRT_GetALERTColor()
+function CRT.GetALERTColor()
return CRT.SV.Settings.ALERT.Color.r, CRT.SV.Settings.ALERT.Color.g, CRT.SV.Settings.ALERT.Color.b, CRT.SV.Settings.ALERT.Color.a
end
-function CRT_SetALERTColor(r, g, b, a)
+function CRT.SetALERTColor(r, g, b, a)
if (CRT.UI.ALERT_WD ~= nil) then
CRT.UI.ALERT_WD:AddMessage("New Alert Color", CRT.SV.Settings.ALERT.Color.r, CRT.SV.Settings.ALERT.Color.g, CRT.SV.Settings.ALERT.Color.b)
end
@@ -66,23 +66,23 @@ function CRT_SetALERTColor(r, g, b, a)
CRT.SV.Settings.ALERT.Color.a = a
end
-function CRT_SetALERTBS(Alertswitch)
+function CRT.SetALERTBS(Alertswitch)
CRT.SV.Settings.ALERT.BS = Alertswitch
end
-function CRT_SetALERTCL(Alertswitch)
+function CRT.SetALERTCL(Alertswitch)
CRT.SV.Settings.ALERT.CL = Alertswitch
end
-function CRT_SetALERTWO(Alertswitch)
+function CRT.SetALERTWO(Alertswitch)
CRT.SV.Settings.ALERT.WO = Alertswitch
end
-------------------------GRID Components---------------------------------------
-function CRT_GetGRIDBackdropAlpha()
+function CRT.GetGRIDBackdropAlpha()
local BackdropAlphaPercent = CRT.SV.Settings.GRID.BackdropAlpha * 100
return BackdropAlphaPercent
end
-function CRT_SetGRIDBackdropAlpha(NewGRIDBackdropAlphaPercent)
+function CRT.SetGRIDBackdropAlpha(NewGRIDBackdropAlphaPercent)
local NewGRIDBackdropAlpha = NewGRIDBackdropAlphaPercent / 100
if (CRT.UI.GRID_BD ~= nil) then
CRT.UI.GRID_BD:SetAlpha(NewGRIDBackdropAlpha)
@@ -90,11 +90,11 @@ function CRT_SetGRIDBackdropAlpha(NewGRIDBackdropAlphaPercent)
CRT.SV.Settings.GRID.BackdropAlpha = NewGRIDBackdropAlpha
end
-function CRT_GetGRIDScale()
+function CRT.GetGRIDScale()
local ScalePercent = CRT.SV.Settings.GRID.Scale * 100
return ScalePercent
end
-function CRT_SetGRIDScale(NewGRIDScalePercent)
+function CRT.SetGRIDScale(NewGRIDScalePercent)
local NewGRIDScale = NewGRIDScalePercent / 100
if (CRT.UI.GRID_TLW~= nil) then
CRT.UI.GRID_TLW:SetScale(NewGRIDScale)
@@ -102,11 +102,11 @@ function CRT_SetGRIDScale(NewGRIDScalePercent)
CRT.SV.Settings.GRID.Scale = NewGRIDScale
end
-function CRT_GetGRIDColor()
+function CRT.GetGRIDColor()
return CRT.SV.Settings.GRID.Color.r, CRT.SV.Settings.GRID.Color.g, CRT.SV.Settings.GRID.Color.b, CRT.SV.Settings.GRID.Color.a
end
-function CRT_SetGRIDColor(r, g, b, a)
+function CRT.SetGRIDColor(r, g, b, a)
CRT.SV.Settings.GRID.Color.r = r
CRT.SV.Settings.GRID.Color.g = g
CRT.SV.Settings.GRID.Color.b = b
@@ -115,14 +115,14 @@ end
-------------------------BS Components---------------------------------------
-function CRT_SetTrackerBS(state)
+function CRT.SetTrackerBS(state)
CRT.SV.Settings.BS.craft = state
if (CRT.UI.CRAFT_TLW[0] ~= nil) then
CRT.UI.CRAFT_TLW[0]:SetHidden(not state)
end
end
-function CRT_SetBSHide0(NewBSHide0)
+function CRT.SetBSHide0(NewBSHide0)
CRT.SV.Settings.BS.Hide_0 = NewBSHide0
if (CRT.UI.CRAFT_TLW[0] ~= nil and NewBSHide0 == false and CRT.SV.Settings.BS.Hide_Type ~= "Toggle keybind" and CRT.SV.Settings.BS.craft == true) then
CRT.UI.CRAFT_TLW[0]:SetHidden(false)
@@ -130,7 +130,7 @@ function CRT_SetBSHide0(NewBSHide0)
end
-function CRT_SetBSHideMenu(NewBSHideMenu)
+function CRT.SetBSHideMenu(NewBSHideMenu)
CRT.SV.Settings.BS.Hide_Type = NewBSHideMenu
if (NewBSHideMenu == "Toggle keybind") then
if (CRT.UI.CRAFT_TLW[0] ~= nil and CRT.SV.Settings.BS.craft == true) then
@@ -146,11 +146,11 @@ function CRT_SetBSHideMenu(NewBSHideMenu)
end
-function CRT_GetBSBackdropAlpha()
+function CRT.GetBSBackdropAlpha()
local BackdropAlphaPercent = CRT.SV.Settings.BS.BackdropAlpha * 100
return BackdropAlphaPercent
end
-function CRT_SetBSBackdropAlpha(NewBSBackdropAlphaPercent)
+function CRT.SetBSBackdropAlpha(NewBSBackdropAlphaPercent)
local NewBSBackdropAlpha = NewBSBackdropAlphaPercent / 100
if (CRT.UI.CRAFT_TLW[0] ~= nil) then
CRT.UI.CRAFT_BD[0]:SetAlpha(NewBSBackdropAlpha)
@@ -158,11 +158,11 @@ function CRT_SetBSBackdropAlpha(NewBSBackdropAlphaPercent)
CRT.SV.Settings.BS.BackdropAlpha = NewBSBackdropAlpha
end
-function CRT_GetBSScale()
+function CRT.GetBSScale()
local ScalePercent = CRT.SV.Settings.BS.Scale * 100
return ScalePercent
end
-function CRT_SetBSScale(NewBSScalePercent)
+function CRT.SetBSScale(NewBSScalePercent)
local NewBSScale = NewBSScalePercent / 100
if (CRT.UI.CRAFT_TLW[0] ~= nil) then
CRT.UI.CRAFT_TLW[0]:SetScale(NewBSScale)
@@ -170,11 +170,11 @@ function CRT_SetBSScale(NewBSScalePercent)
CRT.SV.Settings.BS.Scale = NewBSScale
end
-function CRT_GetBSColor()
+function CRT.GetBSColor()
return CRT.SV.Settings.BS.Color.r, CRT.SV.Settings.BS.Color.g, CRT.SV.Settings.BS.Color.b, CRT.SV.Settings.BS.Color.a
end
-function CRT_SetBSColor(r, g, b, a)
+function CRT.SetBSColor(r, g, b, a)
if (CRT.UI.CRAFT_TLW[0] ~= nil) then
CRT.UI.CRAFT_WD[0][0]["Craft_Text"]:SetColor(r,g,b,a)
for simcraft = 1, 3, 1 do
@@ -190,14 +190,14 @@ end
-------------------------CL Components---------------------------------------
-function CRT_SetTrackerCL(state)
+function CRT.SetTrackerCL(state)
CRT.SV.Settings.CL.craft = state
if (CRT.UI.CRAFT_TLW[1] ~= nil) then
CRT.UI.CRAFT_TLW[1]:SetHidden(not state)
end
end
-function CRT_SetCLHide0(NewCLHide0)
+function CRT.SetCLHide0(NewCLHide0)
CRT.SV.Settings.CL.Hide_0 = NewCLHide0
if (CRT.UI.CRAFT_TLW[1] ~= nil and NewCLHide0 == false and CRT.SV.Settings.CL.Hide_Type ~= "Toggle keybind" and CRT.SV.Settings.CL.craft == true) then
CRT.UI.CRAFT_TLW[1]:SetHidden(false)
@@ -205,7 +205,7 @@ function CRT_SetCLHide0(NewCLHide0)
end
-function CRT_SetCLHideMenu(NewCLHideMenu)
+function CRT.SetCLHideMenu(NewCLHideMenu)
CRT.SV.Settings.CL.Hide_Type = NewCLHideMenu
if (NewCLHideMenu == "Toggle keybind") then
if (CRT.UI.CRAFT_TLW[0] ~= nil and CRT.SV.Settings.BS.craft == true) then
@@ -220,11 +220,11 @@ function CRT_SetCLHideMenu(NewCLHideMenu)
end
end
-function CRT_GetCLBackdropAlpha()
+function CRT.GetCLBackdropAlpha()
local BackdropAlphaPercent = CRT.SV.Settings.CL.BackdropAlpha * 100
return BackdropAlphaPercent
end
-function CRT_SetCLBackdropAlpha(NewCLBackdropAlphaPercent)
+function CRT.SetCLBackdropAlpha(NewCLBackdropAlphaPercent)
local NewCLBackdropAlpha = NewCLBackdropAlphaPercent / 100
if (CRT.UI.CRAFT_BD[1] ~= nil) then
CRT.UI.CRAFT_BD[1]:SetAlpha(NewCLBackdropAlpha)
@@ -232,11 +232,11 @@ function CRT_SetCLBackdropAlpha(NewCLBackdropAlphaPercent)
CRT.SV.Settings.CL.BackdropAlpha = NewCLBackdropAlpha
end
-function CRT_GetCLScale()
+function CRT.GetCLScale()
local ScalePercent = CRT.SV.Settings.CL.Scale * 100
return ScalePercent
end
-function CRT_SetCLScale(NewCLScalePercent)
+function CRT.SetCLScale(NewCLScalePercent)
local NewCLScale = NewCLScalePercent / 100
if (CRT.UI.CRAFT_TLW[1] ~= nil) then
CRT.UI.CRAFT_TLW[1]:SetScale(NewCLScale)
@@ -244,11 +244,11 @@ function CRT_SetCLScale(NewCLScalePercent)
CRT.SV.Settings.CL.Scale = NewCLScale
end
-function CRT_GetCLColor()
+function CRT.GetCLColor()
return CRT.SV.Settings.CL.Color.r, CRT.SV.Settings.CL.Color.g, CRT.SV.Settings.CL.Color.b, CRT.SV.Settings.CL.Color.a
end
-function CRT_SetCLColor(r, g, b, a)
+function CRT.SetCLColor(r, g, b, a)
if (CRT.UI.CRAFT_TLW[1] ~= nil) then
CRT.UI.CRAFT_WD[1][0]["Craft_Text"]:SetColor(r,g,b,a)
for simcraft = 1, 3, 1 do
@@ -263,21 +263,21 @@ CRT.SV.Settings.CL.Color.a = a
end
-------------------------Woodworking Components---------------------------------------
-function CRT_SetTrackerWO(state)
+function CRT.SetTrackerWO(state)
CRT.SV.Settings.WO.craft = state
if (CRT.UI.CRAFT_TLW[2] ~= nil) then
CRT.UI.CRAFT_TLW[2]:SetHidden(not state)
end
end
-function CRT_SetWOHide0(NewWOHide0)
+function CRT.SetWOHide0(NewWOHide0)
CRT.SV.Settings.WO.Hide_0 = NewWOHide0
if (CRT.UI.CRAFT_TLW[2] ~= nil and NewWOHide0 == false and CRT.SV.Settings.WO.Hide_0 ~= "Toggle keybind" and CRT.SV.Settings.WO.craft == true) then
CRT.UI.CRAFT_TLW[2]:SetHidden(false)
end
end
-function CRT_SetWOHideMenu(NewWOHideMenu)
+function CRT.SetWOHideMenu(NewWOHideMenu)
CRT.SV.Settings.WO.Hide_Type = NewWOHideMenu
if (NewWOHideMenu == "Toggle keybind") then
if (CRT.UI.CRAFT_TLW[0] ~= nil and CRT.SV.Settings.BS.craft == true) then
@@ -292,12 +292,12 @@ function CRT_SetWOHideMenu(NewWOHideMenu)
end
end
-function CRT_GetWOBackdropAlpha()
+function CRT.GetWOBackdropAlpha()
local BackdropAlphaPercent = CRT.SV.Settings.WO.BackdropAlpha * 100
return BackdropAlphaPercent
end
-function CRT_SetWOBackdropAlpha(NewWOBackdropAlphaPercent)
+function CRT.SetWOBackdropAlpha(NewWOBackdropAlphaPercent)
local NewWOBackdropAlpha = NewWOBackdropAlphaPercent / 100
if (CRT.UI.CRAFT_BD[2] ~= nil) then
CRT.UI.CRAFT_BD[2]:SetAlpha(NewWOBackdropAlpha)
@@ -305,12 +305,12 @@ function CRT_SetWOBackdropAlpha(NewWOBackdropAlphaPercent)
CRT.SV.Settings.WO.BackdropAlpha = NewWOBackdropAlpha
end
-function CRT_GetWOScale()
+function CRT.GetWOScale()
local ScalePercent = CRT.SV.Settings.WO.Scale * 100
return ScalePercent
end
-function CRT_SetWOScale(NewWOScalePercent)
+function CRT.SetWOScale(NewWOScalePercent)
local NewWOScale = NewWOScalePercent / 100
if (CRT.UI.CRAFT_TLW[1] ~= nil) then
CRT.UI.CRAFT_TLW[2]:SetScale(NewWOScale)
@@ -318,11 +318,11 @@ function CRT_SetWOScale(NewWOScalePercent)
CRT.SV.Settings.WO.Scale = NewWOScale
end
-function CRT_GetWOColor()
+function CRT.GetWOColor()
return CRT.SV.Settings.WO.Color.r, CRT.SV.Settings.WO.Color.g, CRT.SV.Settings.WO.Color.b, CRT.SV.Settings.WO.Color.a
end
-function CRT_SetWOColor(r, g, b, a)
+function CRT.SetWOColor(r, g, b, a)
if (CRT.UI.CRAFT_TLW[2] ~= nil) then
CRT.UI.CRAFT_WD[2][0]["Craft_Text"]:SetColor(r,g,b,a)
for simcraft = 1, 3, 1 do
@@ -336,7 +336,7 @@ CRT.SV.Settings.WO.Color.b = b
CRT.SV.Settings.WO.Color.a = a
end
-function CRT_Reset()
+function CRT.Reset()
CRT.SV.Settings.icon_width = CRT.svDefaults.icon_width
CRT.SV.Settings.icon_height = CRT.svDefaults.icon_height
diff --git a/lua/header.lua b/lua/header.lua
new file mode 100644
index 0000000..554e157
--- /dev/null
+++ b/lua/header.lua
@@ -0,0 +1,128 @@
+-- Craft Research Timer (CRT) by @aTo (EU)
+-- v0.4.11
+
+-- Define the variables to start with.
+CRT = {
+ name = "CraftResearchTimer",
+ font = "ZoFontGame",
+ cmdsetup = "/crt",
+ tic = 1,
+ svName = "CraftResearchTimer_SavedVariables",
+ svVersion = 0.4,
+ version = "v0.4.11",
+ playername = "",
+ font = "ZoFontGame",
+ interval = 20,
+ width = 100,
+ height = 80,
+ UI = {},
+ collect=0,
+ data_defaults = {
+ Craft = {}
+ },
+ svDefaults = {
+ icon_width = 100,
+ icon_height = 80,
+ text_width = 200,
+ text_height = 80,
+ lock = true,
+ mode = "Icon",
+ timer_format = "smart",
+ BS = {
+ offset = {
+ X = 950,
+ Y = 540,
+ },
+ craft = true,
+ Hide_0 = false,
+ Hide_Type = "Menus only",
+ BackdropAlpha = 0.5,
+ Scale = 1,
+ Color = {
+ r = 1,
+ g = 1,
+ b = 1,
+ a = 1 },
+ },
+ CL = {
+ offset = {
+ X = 1080,
+ Y = 540,
+ },
+ craft = true,
+ Hide_0 = false,
+ Hide_Type = "Menus only",
+ BackdropAlpha = 0.5,
+ Scale = 1,
+ Color = {
+ r = 1,
+ g = 1,
+ b = 1,
+ a = 1 },
+ },
+ WO = {
+ offset = {
+ X = 1210,
+ Y = 540,
+ },
+ craft = true,
+ Hide_0 = false,
+ Hide_Type = "Menus only",
+ BackdropAlpha = 0.5,
+ Scale = 1,
+ Color = {
+ r = 1,
+ g = 1,
+ b = 1,
+ a = 1 },
+ },
+ GRID = {
+ hidden = true,
+ offset = {
+ X = 950,
+ Y = 400,
+ },
+ Hide_Type = "Menus only",
+ BackdropAlpha = 0.5,
+ Scale = 1,
+ Color = {
+ r = 1,
+ g = 1,
+ b = 1,
+ a = 1 },
+ },
+ ALERT = {
+ hidden = true,
+ preview = false,
+ BS = true,
+ CL = true,
+ WO = true,
+ offset = {
+ X = 560,
+ Y = 100,
+ },
+ Color = {
+ r = 1,
+ g = 0,
+ b = 0,
+ a = 1 },
+
+ }
+ }
+}
+
+CRT.SV={}
+CRT.UI.GRID_TLW = {}
+CRT.UI.GRID_BD = {}
+CRT.UI.GRID_WD = {}
+CRT.UI.GRID_BTN = {}
+
+CRT.UI.CRAFT_TLW = {}
+CRT.UI.CRAFT_BD = {}
+CRT.UI.CRAFT_WD = {}
+
+CRT.UI.ALERT_TLW = {}
+CRT.UI.ALERT_BD = {}
+CRT.UI.ALERT_WD = {}
+
+
diff --git a/xml/Bindings.xml b/xml/Bindings.xml
index 6915546..a9fcb02 100644
--- a/xml/Bindings.xml
+++ b/xml/Bindings.xml
@@ -2,10 +2,10 @@
<Layer name="SI_KEYBINDINGS_LAYER_GENERAL">
<Category name="|c96FF00Craft Research Timer|r">
<Action name="CRT_ToggleUI">
- <Down>CRT_ToggleUI()</Down>
+ <Down>CRT.ToggleUI()</Down>
</Action>
<Action name="CRT_toggleGRID">
- <Down>CRT_toggleGRID()</Down>
+ <Down>CRT.toggleGRID()</Down>
</Action>
</Category>
</Layer>
diff --git a/xml/CraftResearchTimer.xml b/xml/CraftResearchTimer.xml
index 1d135b4..d3aab36 100644
--- a/xml/CraftResearchTimer.xml
+++ b/xml/CraftResearchTimer.xml
@@ -2,7 +2,7 @@
<Controls>
<TopLevelControl name="CraftTimer" mouseEnabled="true" movable="true">
<OnUpdate>
- CRT_Update()
+ CRT.Update()
</OnUpdate>
</TopLevelControl>
</Controls>