diff --git a/CraftResearchTimer.txt b/CraftResearchTimer.txt index 2886ca7..0ce3591 100644 --- a/CraftResearchTimer.txt +++ b/CraftResearchTimer.txt @@ -5,7 +5,7 @@ ## Author: @aTo (EU) + Patch by @GarulfoX lib\LibStub.lua -lib\LibAddonMenu-1.0.lua + lua\CORE.lua lua\ALERT.lua diff --git a/lua/ALERT.lua b/lua/ALERT.lua index 5f44032..f5412cc 100644 --- a/lua/ALERT.lua +++ b/lua/ALERT.lua @@ -80,13 +80,13 @@ function CRT_ALERT_Update(timestamp) local meta = getmetatable(CRT.SV.Craft_data) for k, _ in pairs(meta.__index) do - if (k ~= "version" and CRT.SV.Craft_data[CRT_Current_Playername]["Start"] == true) then + if (k ~= "version" and CRT.SV.Craft_data[CRT.playername]["Start"] == true) then local CRT_Current_PlayerPosition = GetMapPlayerPosition("player") if (CRT_Current_PlayerPosition ~= CRT_Start_PlayerPosition) then - CRT.SV.Craft_data[CRT_Current_Playername]["Start"] = false - CRT_Research_Alert(CRT_Current_Playername, nil, nil, true) + CRT.SV.Craft_data[CRT.playername]["Start"] = false + CRT_Research_Alert(CRT.playername, nil, nil, true) for k, _ in pairs(meta.__index) do - if ((k ~= "version" and k ~= CRT_Current_Playername) and (CRT.SV.Craft_data[k][0]["Simu_craft"] ~= 0 or CRT.SV.Craft_data[k][1]["Simu_craft"] ~= 0 or CRT.SV.Craft_data[k][2]["Simu_craft"] ~= 0)) then + if ((k ~= "version" and k ~= CRT.playername) and (CRT.SV.Craft_data[k][0]["Simu_craft"] ~= 0 or CRT.SV.Craft_data[k][1]["Simu_craft"] ~= 0 or CRT.SV.Craft_data[k][2]["Simu_craft"] ~= 0)) then CRT_Research_Alert(k, nil, nil, true) end end diff --git a/lua/CRAFT.lua b/lua/CRAFT.lua index f4b9cd8..28feb6b 100644 --- a/lua/CRAFT.lua +++ b/lua/CRAFT.lua @@ -109,8 +109,8 @@ function CRT_CRAFT_Create() CRT_CRAFT_WD[id_craft][simcraft]["item_icon"]:SetAlpha(1) CRT_CRAFT_WD[id_craft][simcraft]["item_icon"]:SetAnchor(TOPLEFT,CRT_CRAFT_TLW[id_craft],TOPLEFT,0,x) CRT_CRAFT_WD[id_craft][simcraft]["item_icon"]:SetMouseEnabled(true) - if(CRT.SV.Craft_data[CRT_Current_Playername][id_craft][simcraft] ~= nil) then - local tooltip = CRT.SV.Craft_data[CRT_Current_Playername][id_craft][simcraft]["Item_name"].." - ".. CRT.SV.Craft_data[CRT_Current_Playername][id_craft][simcraft]["Trait_description"] + if(CRT.SV.Craft_data[CRT.playername][id_craft][simcraft] ~= nil) then + local tooltip = CRT.SV.Craft_data[CRT.playername][id_craft][simcraft]["Item_name"].." - ".. CRT.SV.Craft_data[CRT.playername][id_craft][simcraft]["Trait_description"] CRT_CRAFT_WD[id_craft][simcraft]["item_icon"]:SetHandler("OnMouseEnter", function (self) ZO_Tooltips_ShowTextTooltip(self, TOP, tooltip) end) CRT_CRAFT_WD[id_craft][simcraft]["item_icon"]:SetHandler("OnMouseExit", function (self) ZO_Tooltips_HideTextTooltip() end) end @@ -130,9 +130,9 @@ function CRT_CRAFT_Create() CRT_CRAFT_WD[id_craft][simcraft]["text"]:SetColor(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 if (CRT.SV.Settings.mode == "Text") then - if(CRT.SV.Craft_data[CRT_Current_Playername][id_craft][simcraft] ~= nil) then + if(CRT.SV.Craft_data[CRT.playername][id_craft][simcraft] ~= nil) then CRT_CRAFT_WD[id_craft][simcraft]["text"]:SetMouseEnabled(true) - local tooltip = CRT.SV.Craft_data[CRT_Current_Playername][id_craft][simcraft]["Item_name"].." - ".. CRT.SV.Craft_data[CRT_Current_Playername][id_craft][simcraft]["Trait_description"] + local tooltip = CRT.SV.Craft_data[CRT.playername][id_craft][simcraft]["Item_name"].." - ".. CRT.SV.Craft_data[CRT.playername][id_craft][simcraft]["Trait_description"] CRT_CRAFT_WD[id_craft][simcraft]["text"]:SetHandler("OnMouseEnter", function (self) ZO_Tooltips_ShowTextTooltip(self, TOP, tooltip) end) CRT_CRAFT_WD[id_craft][simcraft]["text"]:SetHandler("OnMouseExit", function (self) ZO_Tooltips_HideTextTooltip() end) end @@ -144,8 +144,8 @@ end function CRT_CRAFT_Update(timestamp) for id_craft = 0, 2,1 do - local MaxResearch = CRT.SV.Craft_data[CRT_Current_Playername][id_craft]["MaxResearch"] - local Simu_craft = CRT.SV.Craft_data[CRT_Current_Playername][id_craft]["Simu_craft"] + local MaxResearch = CRT.SV.Craft_data[CRT.playername][id_craft]["MaxResearch"] + local Simu_craft = CRT.SV.Craft_data[CRT.playername][id_craft]["Simu_craft"] local title = "error" if (CRT.SV.Settings.mode == "Text" and id_craft == 0) then @@ -162,18 +162,18 @@ function CRT_CRAFT_Update(timestamp) for simcraft = 1, 3,1 do - if (CRT.SV.Craft_data[CRT_Current_Playername][id_craft][simcraft] ~= nil)then + if (CRT.SV.Craft_data[CRT.playername][id_craft][simcraft] ~= nil)then - local currenttimer = CRT.SV.Craft_data[CRT_Current_Playername][id_craft][simcraft]["EndTimeStamp"] - timestamp - 1 + local currenttimer = CRT.SV.Craft_data[CRT.playername][id_craft][simcraft]["EndTimeStamp"] - timestamp - 1 local human_timer = CRT_Converthms(currenttimer) local msg = "error" if (CRT.SV.Settings.mode == "Icon") then CRT_CRAFT_WD[id_craft][simcraft]["item_icon"]:SetHidden(false) - CRT_CRAFT_WD[id_craft][simcraft]["item_icon"]:SetTexture(CRT.SV.Craft_data[CRT_Current_Playername][id_craft][simcraft]["Item_icon"]) + CRT_CRAFT_WD[id_craft][simcraft]["item_icon"]:SetTexture(CRT.SV.Craft_data[CRT.playername][id_craft][simcraft]["Item_icon"]) msg = human_timer elseif (CRT.SV.Settings.mode == "Text") then - local Item_name = CRT.SV.Craft_data[CRT_Current_Playername][id_craft][simcraft]["Item_name"] + local Item_name = CRT.SV.Craft_data[CRT.playername][id_craft][simcraft]["Item_name"] msg = Item_name.." - "..human_timer end diff --git a/lua/CraftResearchTimer.lua b/lua/CraftResearchTimer.lua index a169258..22f47c4 100644 --- a/lua/CraftResearchTimer.lua +++ b/lua/CraftResearchTimer.lua @@ -390,7 +390,6 @@ function CRT_Init(eventCode, addOnName) LAM:RegisterAddonPanel("CRT_OptionsPanel", panelData); LAM:RegisterOptionControls("CRT_OptionsPanel", optionsTable); - CRT_Current_Playername = GetUnitName("player") CRT_Start_PlayerPosition = GetMapPlayerPosition("player") local timestamp = GetTimeStamp() @@ -400,10 +399,10 @@ function CRT_Init(eventCode, addOnName) --CRT_Alert_Check(playername,timestamp) -- erase data for this character - CRT.SV.Craft_data[CRT_Current_Playername] = {} - CRT.SV.Craft_data[CRT_Current_Playername]["Start"] = true + CRT.SV.Craft_data[CRT.playername] = {} + CRT.SV.Craft_data[CRT.playername]["Start"] = true -- collect data - CRT_Collect_Data(CRT_Current_Playername) + CRT_Collect_Data(CRT.playername) -- Create GRID CRT_GRID_Create() @@ -521,7 +520,7 @@ function CRT_toggleGUI() hide0[2] = CRT.SV.Settings.WO.Hide_0 - if (hide0[id_craft] == true and hidemenu[id_craft] ~= "Toggle keybind" and CRT.SV.Craft_data[CRT_Current_Playername][id_craft]["Simu_craft"] == 0) then + if (hide0[id_craft] == true and hidemenu[id_craft] ~= "Toggle keybind" and CRT.SV.Craft_data[CRT.playername][id_craft]["Simu_craft"] == 0) then CRT_CRAFT_TLW[id_craft]:SetHidden(true) end end