diff --git a/ResearchTimer.txt b/ResearchTimer.txt index 20d6c8d..6258c37 100644 --- a/ResearchTimer.txt +++ b/ResearchTimer.txt @@ -5,8 +5,8 @@ ## Author: Hisdad -lua\CORE.lua -lua\GRID.lua +lua\core.lua +lua\grid.lua lua\ResearchTimer.lua diff --git a/lua/CORE.lua b/lua/CORE.lua index 696dee4..79cc891 100644 --- a/lua/CORE.lua +++ b/lua/CORE.lua @@ -4,10 +4,8 @@ RT = { name = "ResearchTimer", font = "ZoFontGame", cmdsetup = "/rt", - svName = "ResearchTimer", version = "v1", playername = "", - font = "ZoFontGame", interval = 20, width = 100, height = 80, @@ -21,7 +19,7 @@ RT.UI.GRID_TLW = {} RT.UI.GRID_BD = {} RT.UI.GRID_WD = {} RT.UI.GRID_BTN = {} - +RT.SV.data = {} function RT.Collect_Data() RT.Info_Research(CRAFTING_TYPE_BLACKSMITHING, 0) @@ -50,8 +48,6 @@ 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]["Alert"] = true diff --git a/lua/GRID.lua b/lua/GRID.lua index 012c76c..e538279 100644 --- a/lua/GRID.lua +++ b/lua/GRID.lua @@ -243,4 +243,4 @@ function RT.GRID_Sort() end -- We shouldn't have to manually set the height of the TLW and scale it, but we do. Bug perhaps?? RT.UI.GRID_TLW:SetHeight(table.getn(RT.CharsInOrder) * panelheight / RT.UI.GRID_TLW:GetScale()) - end + end diff --git a/lua/ResearchTimer.lua b/lua/ResearchTimer.lua index 027e3aa..f4b1a30 100644 --- a/lua/ResearchTimer.lua +++ b/lua/ResearchTimer.lua @@ -2,7 +2,6 @@ -- v1 - local function SortTimeA (a,b) return RT.SV.data.Craft[a].shortest < RT.SV.data.Craft[b].shortest end @@ -14,19 +13,22 @@ function RT.Init(eventCode, addOnName) RT.playername = GetUnitName("player") -- SavedVariables - RT.SV.data = ZO_SavedVars:NewAccountWide(RT.svName, 1, nil, nil,nil ) - RT.GRID_Remove_Expired() - + RT.SV.data = ZO_SavedVars:NewAccountWide(RT.name, 1, nil, nil ) + if RT.SV.data.Craft == nil + then RT.SV.data.Craft = {} + RT.SV.data.Craft[RT.playername]= {} + else RT.GRID_Remove_Expired() + end RT.InitialiseLanguage() -- Slash commands - SLASH_COMMANDS[RT.cmdsetup] = RT.CommandText_setup + SLASH_COMMANDS[RT.cmdsetup] = RT.CommandText_setup -- Default sort RT.SortFunction = SortTimeA -- Create Keybinds - ZO_CreateStringId("SI_BINDING_NAME_RT_toggleGRID", "|c96FF00Toggle GRID|r") + ZO_CreateStringId("SI_BINDING_NAME_RT_toggleGRID", "|c96FF00Toggle GRID|r") local timestamp = GetTimeStamp() @@ -42,12 +44,12 @@ function RT.Init(eventCode, addOnName) end function RT.toggleGRID() - if (RT.UI.GRID_TLW:IsHidden() == true) then - RT.GRID_Sort() - RT.UI.GRID_TLW:SetHidden(false) - else - RT.UI.GRID_TLW:SetHidden(true) - end + if (RT.UI.GRID_TLW:IsHidden() == true) then + RT.GRID_Sort() + RT.UI.GRID_TLW:SetHidden(false) + else + RT.UI.GRID_TLW:SetHidden(true) + end end function RT.Converthms(timesec) @@ -76,17 +78,12 @@ function RT.Converthms(timesec) end return humanDuration - end - - - function RT.CommandText_setup() RT.toggleGRID() end EVENT_MANAGER:RegisterForEvent(RT.name, EVENT_ADD_ON_LOADED, RT.Init) -