diff --git a/Clock.lua b/Clock.lua index 068f14d..322408a 100644 --- a/Clock.lua +++ b/Clock.lua @@ -3,7 +3,7 @@ ------------------------------------------- cl = {} -cl.VERSION = "0.5.5" +cl.VERSION = "0.5.6" cl.SAV_VERSION = 0.552 ------------------------------------------- diff --git a/Clock.txt b/Clock.txt index 019d454..3114919 100644 --- a/Clock.txt +++ b/Clock.txt @@ -13,9 +13,9 @@ ################################### ## Title: Clock - By |c5175ea@Tyx|r -## Version 0.5.5 +## Version 0.5.6 ## Author: @Tyx -## APIVersion: 100007 +## APIVersion: 100008 ## SavedVariables: Clock_Settings ############### diff --git a/data/settings.lua b/data/settings.lua index eafff0e..6652b43 100644 --- a/data/settings.lua +++ b/data/settings.lua @@ -25,7 +25,7 @@ local defaults = { language = "en", time = { start = 1398044126, -- exact unix time at the calculated game time start in s - daytime = 20956, -- length of one day in s (default 5.75h right now) + daytime = 20955, -- length of one day in s (default 5.75h right now) night = 7200, -- time of only the night ins (2h) name = "noon", }, diff --git a/data/time.lua b/data/time.lua index 71918b7..c21c4fc 100644 --- a/data/time.lua +++ b/data/time.lua @@ -82,6 +82,16 @@ function tm.GetTST(osT) end ------------------ +-- returns table {h,m,s} in 24h format +-- IMPORTANT: Will work as a cross Addon function +------------------ +local function GetTST() + local osT = GetTimeStamp() + local tst = tm.GetTST(osT) + return tm.ChangeDoubletoHMS(tst) +end + +------------------ -- time calculator -- returns false if wrong name ------------------ @@ -111,9 +121,6 @@ local function CalcStartTime(gameStart) end function tm.GetLoreDate() - local lang = cl.st.GetLanguage() - local loc = cl.ln[lang].vi.date.lore - -- Eso Release 04.04.2014 UNIX: 1396569600 -- Lore Year 2E 582 -- Lore Month 4 Rain's Hand @@ -157,7 +164,7 @@ function tm.GetLoreDate() end end -- WEEK DAY - local day = math.floor(tSinceStart / length.day) + local day = math.ceil(tSinceStart / length.day) return year, month, day end diff --git a/libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua b/libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua index 6bb0147..64ef32e 100644 --- a/libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua +++ b/libs/LibAddonMenu-2.0/LibAddonMenu-2.0.lua @@ -7,7 +7,7 @@ --Register LAM with LibStub -local MAJOR, MINOR = "LibAddonMenu-2.0", 8 +local MAJOR, MINOR = "LibAddonMenu-2.0", 14 local lam, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not lam then return end --the same or newer version of this lib is already loaded into memory @@ -22,7 +22,8 @@ local _ local addonsForList = {} local addonToOptionsMap = {} local optionsCreated = {} -local widgets = {} +lam.widgets = lam.widgets or {} +local widgets = lam.widgets --METHOD: REGISTER WIDGET-- @@ -57,6 +58,10 @@ function lam:OpenToPanel(panel) ZO_GameMenu_InGame.gameMenu.headerControls[locSettings]:SetOpen(true) SCENE_MANAGER:AddFragment(OPTIONS_WINDOW_FRAGMENT) ZO_OptionsWindow_ChangePanels(lam.panelID) + if not lam.panelSubCategoryControl then + lam.panelSubCategoryControl = _G["ZO_GameMenu_InGameNavigationContainerScrollChildZO_GameMenu_SubCategory" .. (lam.panelID + 1)] + end + ZO_TreeEntry_OnMouseUp(lam.panelSubCategoryControl, true) panel:SetHidden(false) end, 200) end @@ -218,9 +223,11 @@ end local function CreateAddonSettingsPanel() if not LAMSettingsPanelCreated then local controlPanelID = "LAM_ADDON_SETTINGS_PANEL" - local controlPanelNames = { en = "Addon Settings", fr = "Extensions", de = "Erweiterungen" } + --Russian for TERAB1T's RuESO addon, which creates an "ru" locale + --game font does not support Cyrillic, so they are using custom fonts + extended latin charset + local controlPanelNames = { en = "Addon Settings", fr = "Extensions", de = "Erweiterungen", ru = "Îacòpoéêè äoïoìîeîèé" } - ZO_OptionsWindow_AddUserPanel(controlPanelID, controlPanelNames[GetCVar("Language.2")]) + ZO_OptionsWindow_AddUserPanel(controlPanelID, controlPanelNames[GetCVar("Language.2")] or controlPanelName["en"]) lam.panelID = _G[controlPanelID] @@ -235,14 +242,14 @@ end --adds each registered addon to the menu in LAM's panel local function CreateAddonButtons(list, addons) for i = 1, #addons do - local button = wm:CreateControlFromVirtual("LAMAddonMenuButton" .. i, list, "ZO_DefaultTextButton") + local button = wm:CreateControlFromVirtual("LAMAddonMenuButton" .. i, list.scrollChild, "ZO_DefaultTextButton") button.name = addons[i].name button.panel = _G[addons[i].panel] button:SetText(button.name) button:SetHorizontalAlignment(TEXT_ALIGN_LEFT) button:SetWidth(190) if i == 1 then - button:SetAnchor(TOPLEFT, list, TOPLEFT, 5, 5) + button:SetAnchor(TOPLEFT, list.scrollChild, TOPLEFT, 5, 5) else button:SetAnchor(TOPLEFT, _G["LAMAddonMenuButton" .. i - 1], BOTTOMLEFT) end @@ -268,6 +275,9 @@ local function CreateAddonList() bg:SetEdgeTexture("EsoUI\\Art\\miscellaneous\\borderedinsettransparent_edgefile.dds", 128, 16) bg:SetCenterColor(0, 0, 0, 0) + list.scrollChild = LAMAddonPanelsMenuScrollChild + list.scrollChild:SetResizeToFitPadding(0, 15) + local generatedButtons list:SetHandler("OnShow", function(self) if not generatedButtons and #addonsForList > 0 then diff --git a/libs/LibAddonMenu-2.0/controls/button.lua b/libs/LibAddonMenu-2.0/controls/button.lua index e5d60d4..edd7b3e 100644 --- a/libs/LibAddonMenu-2.0/controls/button.lua +++ b/libs/LibAddonMenu-2.0/controls/button.lua @@ -11,7 +11,7 @@ } ]] -local widgetVersion = 2 +local widgetVersion = 3 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("button", widgetVersion) then return end @@ -34,7 +34,7 @@ end --controlName is optional function LAMCreateControl.button(parent, buttonData, controlName) local control = wm:CreateTopLevelWindow(controlName or buttonData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = buttonData.width == "half" control:SetDimensions(isHalfWidth and 250 or 510, isHalfWidth and 55 or 28) diff --git a/libs/LibAddonMenu-2.0/controls/checkbox.lua b/libs/LibAddonMenu-2.0/controls/checkbox.lua index 5552640..bab3385 100644 --- a/libs/LibAddonMenu-2.0/controls/checkbox.lua +++ b/libs/LibAddonMenu-2.0/controls/checkbox.lua @@ -12,7 +12,7 @@ } ]] -local widgetVersion = 4 +local widgetVersion = 5 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("checkbox", widgetVersion) then return end @@ -105,7 +105,7 @@ end --controlName is optional function LAMCreateControl.checkbox(parent, checkboxData, controlName) local control = wm:CreateTopLevelWindow(controlName or checkboxData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) control:SetMouseEnabled(true) control.tooltipText = checkboxData.tooltip control:SetHandler("OnMouseEnter", OnMouseEnter) diff --git a/libs/LibAddonMenu-2.0/controls/colorpicker.lua b/libs/LibAddonMenu-2.0/controls/colorpicker.lua index 035197b..cb49b6c 100644 --- a/libs/LibAddonMenu-2.0/controls/colorpicker.lua +++ b/libs/LibAddonMenu-2.0/controls/colorpicker.lua @@ -12,7 +12,7 @@ } ]] -local widgetVersion = 2 +local widgetVersion = 3 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("colorpicker", widgetVersion) then return end @@ -59,7 +59,7 @@ end function LAMCreateControl.colorpicker(parent, colorpickerData, controlName) local control = wm:CreateTopLevelWindow(controlName or colorpickerData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) control:SetMouseEnabled(true) control.tooltipText = colorpickerData.tooltip control:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter) diff --git a/libs/LibAddonMenu-2.0/controls/custom.lua b/libs/LibAddonMenu-2.0/controls/custom.lua index ecea2e8..85d1b68 100644 --- a/libs/LibAddonMenu-2.0/controls/custom.lua +++ b/libs/LibAddonMenu-2.0/controls/custom.lua @@ -1,19 +1,27 @@ --[[customData = { type = "custom", - reference = "MyAddonCustomControl", --unique name for your control to use as reference + reference = "MyAddonCustomControl", --(optional) unique name for your control to use as reference + refreshFunc = function(customControl) end, --(optional) function to call when panel/controls refresh width = "full", --or "half" (optional) } ]] -local widgetVersion = 2 +local widgetVersion = 4 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("custom", widgetVersion) then return end local wm = WINDOW_MANAGER +local tinsert = table.insert + +local function UpdateValue(control) + if control.data.refreshFunc then + control.data.refreshFunc(control) + end +end function LAMCreateControl.custom(parent, customData, controlName) local control = wm:CreateTopLevelWindow(controlName or customData.reference) control:SetResizeToFitDescendents(true) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = customData.width == "half" if isHalfWidth then --note these restrictions @@ -27,5 +35,11 @@ function LAMCreateControl.custom(parent, customData, controlName) control.panel = parent.panel or parent --if this is in a submenu, panel is its parent control.data = customData + control.UpdateValue = UpdateValue + + if control.panel.data.registerForRefresh or control.panel.data.registerForDefaults then --if our parent window wants to refresh controls, then add this to the list + tinsert(control.panel.controlsToRefresh, control) + end + return control end \ No newline at end of file diff --git a/libs/LibAddonMenu-2.0/controls/description.lua b/libs/LibAddonMenu-2.0/controls/description.lua index 16fc227..18f92a6 100644 --- a/libs/LibAddonMenu-2.0/controls/description.lua +++ b/libs/LibAddonMenu-2.0/controls/description.lua @@ -7,16 +7,24 @@ } ]] -local widgetVersion = 2 +local widgetVersion = 4 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("description", widgetVersion) then return end local wm = WINDOW_MANAGER +local tinsert = table.insert + +local function UpdateValue(control) + if control.title then + control.title:SetText(control.data.title) + end + control.desc:SetText(control.data.text) +end function LAMCreateControl.description(parent, descriptionData, controlName) local control = wm:CreateTopLevelWindow(controlName or descriptionData.reference) control:SetResizeToFitDescendents(true) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = descriptionData.width == "half" if isHalfWidth then control:SetDimensionConstraints(250, 55, 250, 100) @@ -48,5 +56,11 @@ function LAMCreateControl.description(parent, descriptionData, controlName) control.panel = parent.panel or parent --if this is in a submenu, panel is its parent control.data = descriptionData + control.UpdateValue = UpdateValue + + if control.panel.data.registerForRefresh or control.panel.data.registerForDefaults then --if our parent window wants to refresh controls, then add this to the list + tinsert(control.panel.controlsToRefresh, control) + end + return control end \ No newline at end of file diff --git a/libs/LibAddonMenu-2.0/controls/dropdown.lua b/libs/LibAddonMenu-2.0/controls/dropdown.lua index 7ff4a89..01addfd 100644 --- a/libs/LibAddonMenu-2.0/controls/dropdown.lua +++ b/libs/LibAddonMenu-2.0/controls/dropdown.lua @@ -14,7 +14,7 @@ } ]] -local widgetVersion = 3 +local widgetVersion = 5 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("dropdown", widgetVersion) then return end @@ -86,7 +86,7 @@ end local comboboxCount = 1 function LAMCreateControl.dropdown(parent, dropdownData, controlName) local control = wm:CreateTopLevelWindow(controlName or dropdownData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) control:SetMouseEnabled(true) control.tooltipText = dropdownData.tooltip control:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter) @@ -116,21 +116,19 @@ function LAMCreateControl.dropdown(parent, dropdownData, controlName) if isHalfWidth then control:SetDimensions(250, 55) label:SetDimensions(250, 26) - combobox:SetDimensions(240, 26) - --dropdown:SetWidth(240) + combobox:SetDimensions(225, 26) combobox:SetAnchor(TOPRIGHT, label, BOTTOMRIGHT) else control:SetDimensions(510, 30) label:SetDimensions(300, 26) combobox:SetDimensions(200, 26) - --dropdown:SetWidth(200) combobox:SetAnchor(TOPRIGHT) end - if warning then + if dropdownData.warning then control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon") control.warning:SetAnchor(RIGHT, combobox, LEFT, -5, 0) - control.warning.tooltipText = warningText + control.warning.tooltipText = dropdownData.warning end control.panel = parent.panel or parent --if this is in a submenu, panel is its parent diff --git a/libs/LibAddonMenu-2.0/controls/editbox.lua b/libs/LibAddonMenu-2.0/controls/editbox.lua index 5567acb..7b575ce 100644 --- a/libs/LibAddonMenu-2.0/controls/editbox.lua +++ b/libs/LibAddonMenu-2.0/controls/editbox.lua @@ -13,7 +13,7 @@ } ]] -local widgetVersion = 3 +local widgetVersion = 4 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("editbox", widgetVersion) then return end @@ -61,7 +61,7 @@ end function LAMCreateControl.editbox(parent, editboxData, controlName) local control = wm:CreateTopLevelWindow(controlName or editboxData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) control:SetMouseEnabled(true) control:SetResizeToFitDescendents(true) control.tooltipText = editboxData.tooltip diff --git a/libs/LibAddonMenu-2.0/controls/header.lua b/libs/LibAddonMenu-2.0/controls/header.lua index 23eec1f..aac21d6 100644 --- a/libs/LibAddonMenu-2.0/controls/header.lua +++ b/libs/LibAddonMenu-2.0/controls/header.lua @@ -6,15 +6,20 @@ } ]] -local widgetVersion = 2 +local widgetVersion = 4 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("header", widgetVersion) then return end local wm = WINDOW_MANAGER +local tinsert = table.insert + +local function UpdateValue(control) + control.header:SetText(control.data.name) +end function LAMCreateControl.header(parent, headerData, controlName) local control = wm:CreateTopLevelWindow(controlName or headerData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = headerData.width == "half" control:SetDimensions(isHalfWidth and 250 or 510, 30) @@ -32,5 +37,11 @@ function LAMCreateControl.header(parent, headerData, controlName) control.panel = parent.panel or parent --if this is in a submenu, panel is its parent control.data = headerData + control.UpdateValue = UpdateValue + + if control.panel.data.registerForRefresh or control.panel.data.registerForDefaults then --if our parent window wants to refresh controls, then add this to the list + tinsert(control.panel.controlsToRefresh, control) + end + return control end \ No newline at end of file diff --git a/libs/LibAddonMenu-2.0/controls/panel.lua b/libs/LibAddonMenu-2.0/controls/panel.lua index 6f9dc4a..6dd4e4f 100644 --- a/libs/LibAddonMenu-2.0/controls/panel.lua +++ b/libs/LibAddonMenu-2.0/controls/panel.lua @@ -11,7 +11,7 @@ } ]] -local widgetVersion = 5 +local widgetVersion = 8 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("panel", widgetVersion) then return end @@ -71,7 +71,8 @@ ESO_Dialogs["LAM_DEFAULTS"] = { }, } -local scrollCount = 1 +local callbackRegistered = false +LAMCreateControl.scrollCount = LAMCreateControl.scrollCount or 1 function LAMCreateControl.panel(parent, panelData, controlName) local control = wm:CreateTopLevelWindow(controlName) control:SetParent(parent) @@ -104,8 +105,8 @@ function LAMCreateControl.panel(parent, panelData, controlName) end end - control.container = wm:CreateControlFromVirtual("LAMAddonPanelContainer" .. scrollCount, control, "ZO_ScrollContainer") - scrollCount = scrollCount + 1 + control.container = wm:CreateControlFromVirtual("LAMAddonPanelContainer" .. LAMCreateControl.scrollCount, control, "ZO_ScrollContainer") + LAMCreateControl.scrollCount = LAMCreateControl.scrollCount + 1 local container = control.container container:SetAnchor(TOPLEFT, label, BOTTOMLEFT, 0, 20) container:SetAnchor(BOTTOMRIGHT, control, BOTTOMRIGHT, -3, -3) @@ -126,8 +127,9 @@ function LAMCreateControl.panel(parent, panelData, controlName) end) end - if panelData.registerForRefresh then + if panelData.registerForRefresh and not callbackRegistered then --don't want to register our callback more than once cm:RegisterCallback("LAM-RefreshPanel", RefreshPanel) + callbackRegistered = true end control.data = panelData diff --git a/libs/LibAddonMenu-2.0/controls/slider.lua b/libs/LibAddonMenu-2.0/controls/slider.lua index ee6b7f6..889ed9e 100644 --- a/libs/LibAddonMenu-2.0/controls/slider.lua +++ b/libs/LibAddonMenu-2.0/controls/slider.lua @@ -15,7 +15,7 @@ } ]] -local widgetVersion = 2 +local widgetVersion = 3 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("slider", widgetVersion) then return end @@ -69,7 +69,7 @@ end function LAMCreateControl.slider(parent, sliderData, controlName) local control = wm:CreateTopLevelWindow(controlName or sliderData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = sliderData.width == "half" if isHalfWidth then control:SetDimensions(250, 55) @@ -164,7 +164,7 @@ function LAMCreateControl.slider(parent, sliderData, controlName) control.warning.tooltipText = sliderData.warning end - control.panel = parent.panel or parent --if this is in a submenu, panel is its parent + control.panel = parent.panel or parent --if this is in a submenu, panel is the submenu's parent control.data = sliderData if sliderData.disabled then diff --git a/libs/LibAddonMenu-2.0/controls/submenu.lua b/libs/LibAddonMenu-2.0/controls/submenu.lua index e2165d8..f09837c 100644 --- a/libs/LibAddonMenu-2.0/controls/submenu.lua +++ b/libs/LibAddonMenu-2.0/controls/submenu.lua @@ -6,16 +6,24 @@ reference = "MyAddonSubmenu" --(optional) unique global reference to control } ]] -local widgetVersion = 3 +local widgetVersion = 5 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("submenu", widgetVersion) then return end local wm = WINDOW_MANAGER local am = ANIMATION_MANAGER +local tinsert = table.insert -local function AnimateSubmenu(label) - local control = label:GetParent() +local function UpdateValue(control) + control.label:SetText(control.data.name) + if control.data.tooltip then + control.label.tooltipText = control.data.tooltip + end +end + +local function AnimateSubmenu(clicked) + local control = clicked:GetParent() control.open = not control.open if control.open then @@ -28,7 +36,7 @@ end function LAMCreateControl.submenu(parent, submenuData, controlName) local control = wm:CreateTopLevelWindow(controlName or submenuData.reference) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) control.panel = parent control:SetDimensions(523, 40) @@ -90,8 +98,24 @@ function LAMCreateControl.submenu(parent, submenuData, controlName) end end) + --small strip at the bottom of the submenu that you can click to close it + control.btmToggle = wm:CreateControl(nil, control, CT_TEXTURE) + local btmToggle = control.btmToggle + btmToggle:SetMouseEnabled(true) + btmToggle:SetAnchor(BOTTOMLEFT, control.scroll, BOTTOMLEFT) + btmToggle:SetAnchor(BOTTOMRIGHT, control.scroll, BOTTOMRIGHT) + btmToggle:SetHeight(15) + btmToggle:SetAlpha(0) + btmToggle:SetHandler("OnMouseUp", AnimateSubmenu) + control.data = submenuData + control.UpdateValue = UpdateValue + + if control.panel.data.registerForRefresh or control.panel.data.registerForDefaults then --if our parent window wants to refresh controls, then add this to the list + tinsert(control.panel.controlsToRefresh, control) + end + return control end diff --git a/libs/LibAddonMenu-2.0/controls/texture.lua b/libs/LibAddonMenu-2.0/controls/texture.lua index b30999d..ab02754 100644 --- a/libs/LibAddonMenu-2.0/controls/texture.lua +++ b/libs/LibAddonMenu-2.0/controls/texture.lua @@ -10,7 +10,7 @@ --add texture coords support? -local widgetVersion = 2 +local widgetVersion = 3 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("texture", widgetVersion) then return end @@ -19,7 +19,7 @@ local wm = WINDOW_MANAGER function LAMCreateControl.texture(parent, textureData, controlName) local control = wm:CreateTopLevelWindow(controlName or textureData.reference) control:SetResizeToFitDescendents(true) - control:SetParent(parent.scroll) + control:SetParent(parent.scroll or parent) local isHalfWidth = textureData.width == "half" if isHalfWidth then diff --git a/libs/LibStub/LibStub.lua b/libs/LibStub/LibStub.lua index 822586e..9831755 100644 --- a/libs/LibStub/LibStub.lua +++ b/libs/LibStub/LibStub.lua @@ -3,7 +3,7 @@ -- LibStub developed for World of Warcraft by above members of the WowAce community. -- Ported to Elder Scrolls Online by Seerah -local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 1 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! +local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! local LibStub = _G[LIBSTUB_MAJOR] local strformat = string.format @@ -24,7 +24,7 @@ if not LibStub or LibStub.minor < LIBSTUB_MINOR then function LibStub:GetLibrary(major, silent) if not self.libs[major] and not silent then - error(("Cannot find a library instance of %q."):strformat(tostring(major)), 2) + error(strformat("Cannot find a library instance of %q.", tostring(major)), 2) end return self.libs[major], self.minors[major] end