diff --git a/Changelog b/Changelog
index 25878d1..44f70dd 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,18 @@
-------------------------------------------------------------------------------
Memento bar
-------------------------------------------------------------------------------
+Version 1.6.2 (18-03-2018)
+- Updated visibility fragments to support:
+-- hud
+-- HudUI
+-- Menu
+-- Inventory
+-- Interact
+-- Bank
+-- Fence
+-- Store
+- Tweeked visibility menu items, to better describe the area and for consistency.
+
Version 1.6.1 (11-03-2018)
- Added fragment support for Inventory and store views.
- Added menu items for visibilty of Inventory and store.
diff --git a/MementoBar.lua b/MementoBar.lua
index a8943f4..c7bc93d 100644
--- a/MementoBar.lua
+++ b/MementoBar.lua
@@ -6,62 +6,62 @@ Filename: MementoBar.lua
-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
-local MementoBar = MementoBar
+local baseModul = MementoBar
-------------------------------------------------------------------------------------------------
-- FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function MementoBar.OnAddOnLoaded(_, addonName)
- if addonName == MementoBar.Addon.Name then
- MementoBar:Initialize()
+function baseModul.OnAddOnLoaded(_, addonName)
+ if addonName == baseModul.Addon.Name then
+ baseModul:Initialize()
end
end
-function MementoBar:Initialize()
+function baseModul:Initialize()
-- Load saved values..
- MementoBar.Saved = ZO_SavedVars:New("MementoBar_Character", MementoBar.Addon.Version, nil, MementoBar.Default)
+ baseModul.Saved = ZO_SavedVars:New("MementoBar_Character", baseModul.Addon.Version, nil, baseModul.Default)
- if MementoBar.Saved.UseAccountSettings then
- MementoBar.Saved = ZO_SavedVars:NewAccountWide("MementoBar_Account", MementoBar.Addon.Version, nil, MementoBar.Default)
+ if baseModul.Saved.UseAccountSettings then
+ baseModul.Saved = ZO_SavedVars:NewAccountWide("MementoBar_Account", baseModul.Addon.Version, nil, baseModul.Default)
end
- MementoBar_Frame:SetHandler("OnMoveStop", MementoBar.OnMoveStop)
- MementoBar:RestorePanel()
- MementoBar:HoykeyCreateSelections()
- MementoBar:CreateSettingsWindow()
+ MementoBar_Frame:SetHandler("OnMoveStop", baseModul.OnMoveStop)
+ baseModul:RestorePanel()
+ baseModul:HoykeyCreateSelections()
+ baseModul:CreateSettingsWindow()
- EVENT_MANAGER:UnregisterForEvent(MementoBar.Addon.Name, EVENT_ADD_ON_LOADED)
+ EVENT_MANAGER:UnregisterForEvent(baseModul.Addon.Name, EVENT_ADD_ON_LOADED)
end
-------------------------------------------------------------------------------------------------
-- PRIVATE FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function MementoBar:GetVersion(showMinor)
+function baseModul:GetVersion(showMinor)
if showMinor == false or ADDON_MINOR_VERSION == nil then
- return tostring(MementoBar.Addon.Version)
+ return tostring(baseModul.Addon.Version)
end
- return tostring(MementoBar.Addon.Version) .. "." .. tostring(MementoBar.Addon.MinorVersion)
+ return tostring(baseModul.Addon.Version) .. "." .. tostring(baseModul.Addon.MinorVersion)
end
-function MementoBar:RestorePanel()
- MementoBar:SetButtonFrameWidth()
- MementoBar:HotkeyUpdate()
- MementoBar:InitializeButtons()
- MementoBar:RestoreButtons()
- MementoBar:RestorePosition()
- MementoBar:UpdateMoveFrame()
- MementoBar:SetFragmentBehaviour()
+function baseModul:RestorePanel()
+ baseModul:SetButtonFrameWidth()
+ baseModul:HotkeyUpdate()
+ baseModul:InitializeButtons()
+ baseModul:RestoreButtons()
+ baseModul:RestorePosition()
+ baseModul:UpdateMoveFrame()
+ baseModul:SetFragmentBehaviour()
end
-function MementoBar:RestorePosition()
- local Top = MementoBar.Saved.Top
- local Left = MementoBar.Saved.Left
+function baseModul:RestorePosition()
+ local Top = baseModul.Saved.Top
+ local Left = baseModul.Saved.Left
MementoBar_Frame:ClearAnchors()
MementoBar_Frame:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, Left, Top)
end
-EVENT_MANAGER:RegisterForEvent(MementoBar.Addon.Name, EVENT_ADD_ON_LOADED, MementoBar.OnAddOnLoaded)
+EVENT_MANAGER:RegisterForEvent(baseModul.Addon.Name, EVENT_ADD_ON_LOADED, baseModul.OnAddOnLoaded)
diff --git a/MementoBar_Buttons.lua b/MementoBar_Buttons.lua
index ed33a1b..7472666 100644
--- a/MementoBar_Buttons.lua
+++ b/MementoBar_Buttons.lua
@@ -6,18 +6,18 @@ Filename: MementoBar_Buttons.lua
-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
-local MementoBar = MementoBar
+local baseModule = MementoBar
-------------------------------------------------------------------------------------------------
-- FUNCTIONS --
-- Button highlight --
-------------------------------------------------------------------------------------------------
-function MementoBar.ButtonHighlightEnter(frame)
- local highlightColor = MementoBar.Saved.HighlightColor
+function baseModule.ButtonHighlightEnter(frame)
+ local highlightColor = baseModule.Saved.HighlightColor
local buttonBackdrop = GetControl(frame, "Backdrop")
if buttonBackdrop ~= nil then
- if MementoBar.Saved.IsAudioEnabled then
+ if baseModule.Saved.IsAudioEnabled then
PlaySound(SOUNDS.QUICKSLOT_MOUSEOVER)
end
@@ -25,8 +25,8 @@ function MementoBar.ButtonHighlightEnter(frame)
end
end
-function MementoBar.ButtonHighlightExit(frame)
- local edgeColor = MementoBar.Saved.EdgeColor
+function baseModule.ButtonHighlightExit(frame)
+ local edgeColor = baseModule.Saved.EdgeColor
local buttonBackdrop = GetControl(frame, "Backdrop")
if buttonBackdrop ~= nil then
@@ -34,13 +34,13 @@ function MementoBar.ButtonHighlightExit(frame)
end
end
-function MementoBar.ButtonOnClicked(button)
+function baseModule.ButtonOnClicked(button)
local id = button:GetId()
if id > 0 then
local cooldownRemaining, cooldownDuration = GetCollectibleCooldownAndDuration(id)
if cooldownRemaining == 0 then
- MementoBar:Activate(id)
+ baseModule:Activate(id)
end
end
end
@@ -48,50 +48,50 @@ end
-------------------------------------------------------------------------------------------------
-- PRIVATE FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function MementoBar:SetupButton(button, left, top)
+function baseModule:SetupButton(button, left, top)
button:ClearAnchors()
button:SetAnchor(TOPLEFT, MementoBar_Frame, TOPLEFT, left, top)
- button:SetHeight(MementoBar.Saved.Height)
- button:SetWidth(MementoBar.Saved.Width)
+ button:SetHeight(baseModule.Saved.Height)
+ button:SetWidth(baseModule.Saved.Width)
button:SetHidden(false)
end
-function MementoBar:SetupButtonBinding(button, key, left, top)
+function baseModule:SetupButtonBinding(button, key, left, top)
local buttonBinding = GetControl(button, "Binding")
if buttonBinding ~= nil then
- MementoBar:HotkeyUpdateColor(buttonBinding)
- buttonBinding:SetText(MementoBar:HoykeyGetKey(button, key))
+ baseModule:HotkeyUpdateColor(buttonBinding)
+ buttonBinding:SetText(baseModule:HoykeyGetKey(button, key))
buttonBinding:SetDrawLevel(3)
buttonBinding:ClearAnchors()
- buttonBinding:SetAnchor(MementoBar.Saved.KeyBindingLocation, button, MementoBar.Saved.KeyBindingLocation, 0, 0)
+ buttonBinding:SetAnchor(baseModule.Saved.KeyBindingLocation, button, baseModule.Saved.KeyBindingLocation, 0, 0)
end
if buttonBinding ~= nil then
- buttonBinding:SetHidden(not MementoBar.Saved.ShowKeyBinding)
+ buttonBinding:SetHidden(not baseModule.Saved.ShowKeyBinding)
end
end
-function MementoBar:SetupButtonTexture(button, key, left, top)
+function baseModule:SetupButtonTexture(button, key, left, top)
local buttonTexture = GetControl(button, "Texture")
if buttonTexture ~= nil then
- button:SetHandler("OnClicked", MementoBar.ButtonOnClicked)
+ button:SetHandler("OnClicked", baseModule.ButtonOnClicked)
buttonTexture:SetDrawLevel(3)
- buttonTexture:SetTexture(MementoBar.Mementos[key].EnabledTexture)
+ buttonTexture:SetTexture(baseModule.Mementos[key].EnabledTexture)
buttonTexture:ClearAnchors()
- buttonTexture:SetAnchor(TOPLEFT, button, TOPLEFT, MementoBar.Saved.Margin, MementoBar.Saved.Margin)
- buttonTexture:SetHeight(button:GetHeight() - (2 * MementoBar.Saved.Margin))
- buttonTexture:SetWidth(button:GetWidth() - (2 * MementoBar.Saved.Margin))
+ buttonTexture:SetAnchor(TOPLEFT, button, TOPLEFT, baseModule.Saved.Margin, baseModule.Saved.Margin)
+ buttonTexture:SetHeight(button:GetHeight() - (2 * baseModule.Saved.Margin))
+ buttonTexture:SetWidth(button:GetWidth() - (2 * baseModule.Saved.Margin))
end
end
-function MementoBar:SetupButtonBackdrop(button, key, left, top)
+function baseModule:SetupButtonBackdrop(button, key, left, top)
local buttonBackdrop = GetControl(button, "Backdrop")
if buttonBackdrop ~= nil then
buttonBackdrop:SetDrawLevel(2)
- buttonBackdrop:SetEdgeTexture(nil, 1, 1, MementoBar.Saved.Margin)
+ buttonBackdrop:SetEdgeTexture(nil, 1, 1, baseModule.Saved.Margin)
buttonBackdrop:ClearAnchors()
buttonBackdrop:SetAnchor(TOPLEFT, MementoBar_Frame, TOPLEFT, left, top)
buttonBackdrop:SetHeight(button:GetHeight())
@@ -99,26 +99,26 @@ function MementoBar:SetupButtonBackdrop(button, key, left, top)
end
end
-function MementoBar:SetButtonFrameWidth()
+function baseModule:SetButtonFrameWidth()
local count, depth, height, width = 0, 0, 0, 0
- for key, value in pairs(MementoBar.Saved.SelectedMementos) do
- if IsCollectibleUnlocked(key) and MementoBar.Saved.SelectedMementos[key] then
+ for key, value in pairs(baseModule.Saved.SelectedMementos) do
+ if IsCollectibleUnlocked(key) and baseModule.Saved.SelectedMementos[key] then
count = count + 1
end
end
if count > 0 then
- depth = math.ceil(count / MementoBar.Saved.BarDepth)
- height = MementoBar.Saved.Height * (MementoBar.Saved.Horizontal and MementoBar.Saved.BarDepth or depth)
- width = MementoBar.Saved.Width * (MementoBar.Saved.Horizontal and depth or MementoBar.Saved.BarDepth)
+ depth = math.ceil(count / baseModule.Saved.BarDepth)
+ height = baseModule.Saved.Height * (baseModule.Saved.Horizontal and baseModule.Saved.BarDepth or depth)
+ width = baseModule.Saved.Width * (baseModule.Saved.Horizontal and depth or baseModule.Saved.BarDepth)
end
- MementoBar:SetFrameSettings(MementoBar_Frame, count == 0, height, width)
- MementoBar:SetFrameSettings(MementoBar_FrameBackdrop, count == 0, height, width)
+ baseModule:SetFrameSettings(MementoBar_Frame, count == 0, height, width)
+ baseModule:SetFrameSettings(MementoBar_FrameBackdrop, count == 0, height, width)
end
-function MementoBar:SetFrameSettings(frame, isHidden, height, width)
+function baseModule:SetFrameSettings(frame, isHidden, height, width)
if frame ~= nil then
frame:SetHidden(count == 0)
frame:SetHeight(height)
@@ -126,61 +126,61 @@ function MementoBar:SetFrameSettings(frame, isHidden, height, width)
end
end
-function MementoBar:InitializeButtons()
+function baseModule:InitializeButtons()
local index = 1
- for _, _value in ipairs(MementoBar.OrderedMementos) do
+ for _, _value in ipairs(baseModule.OrderedMementos) do
local id = _value.Id
- local left, top = MementoBar:GetButtonPosition(index)
+ local left, top = baseModule:GetButtonPosition(index)
- if MementoBar.Saved.SelectedMementos[id] and IsCollectibleUnlocked(id) then
- if MementoBar.Buttons[id] == nil then
- MementoBar.Buttons[id] = MementoBar.WM:CreateControlFromVirtual("MementoBar_Button", MementoBar_Frame, "MementoBar_Button", id)
- MementoBar.Buttons[id]:SetId(id)
+ if baseModule.Saved.SelectedMementos[id] and IsCollectibleUnlocked(id) then
+ if baseModule.Buttons[id] == nil then
+ baseModule.Buttons[id] = baseModule.WM:CreateControlFromVirtual("MementoBar_Button", MementoBar_Frame, "MementoBar_Button", id)
+ baseModule.Buttons[id]:SetId(id)
end
- MementoBar:SetupButton(MementoBar.Buttons[id], left, top)
- MementoBar:SetupButtonBinding(MementoBar.Buttons[id], id, left, top)
- MementoBar:SetupButtonBackdrop(MementoBar.Buttons[id], id, left, top)
- MementoBar:SetupButtonTexture(MementoBar.Buttons[id], id, left, top)
- MementoBar.Buttons[id]:SetHandler("OnMouseEnter", MementoBar.ButtonHighlightEnter)
- MementoBar.Buttons[id]:SetHandler("OnMouseExit", MementoBar.ButtonHighlightExit)
+ baseModule:SetupButton(baseModule.Buttons[id], left, top)
+ baseModule:SetupButtonBinding(baseModule.Buttons[id], id, left, top)
+ baseModule:SetupButtonBackdrop(baseModule.Buttons[id], id, left, top)
+ baseModule:SetupButtonTexture(baseModule.Buttons[id], id, left, top)
+ baseModule.Buttons[id]:SetHandler("OnMouseEnter", baseModule.ButtonHighlightEnter)
+ baseModule.Buttons[id]:SetHandler("OnMouseExit", baseModule.ButtonHighlightExit)
index = index + 1
- elseif MementoBar.Buttons[id] ~= nil then
- MementoBar.Buttons[id]:SetHidden(true)
+ elseif baseModule.Buttons[id] ~= nil then
+ baseModule.Buttons[id]:SetHidden(true)
end
end
end
-function MementoBar:GetButtonPosition(index)
- local left = MementoBar.Saved.Width * ((index - 1) % MementoBar.Saved.BarDepth)
- local top = MementoBar.Saved.Height * (math.floor((index - 1) / MementoBar.Saved.BarDepth))
+function baseModule:GetButtonPosition(index)
+ local left = baseModule.Saved.Width * ((index - 1) % baseModule.Saved.BarDepth)
+ local top = baseModule.Saved.Height * (math.floor((index - 1) / baseModule.Saved.BarDepth))
- if MementoBar.Saved.Horizontal then
- left = MementoBar.Saved.Height * (math.floor((index - 1) / MementoBar.Saved.BarDepth))
- top = MementoBar.Saved.Width * ((index - 1) % MementoBar.Saved.BarDepth)
+ if baseModule.Saved.Horizontal then
+ left = baseModule.Saved.Height * (math.floor((index - 1) / baseModule.Saved.BarDepth))
+ top = baseModule.Saved.Width * ((index - 1) % baseModule.Saved.BarDepth)
end
return left, top
end
-function MementoBar:RestoreButtons()
- local centerColor = MementoBar.Saved.CenterColor
- local edgeColor = MementoBar.Saved.EdgeColor
- local timerIsTimerEnabled = MementoBar.Saved.IsTimerEnabled
- local timerFont = MementoBar.Saved.TimerFont
- local timerFontColor = MementoBar.Saved.TimerFontColor
+function baseModule:RestoreButtons()
+ local centerColor = baseModule.Saved.CenterColor
+ local edgeColor = baseModule.Saved.EdgeColor
+ local timerIsTimerEnabled = baseModule.Saved.IsTimerEnabled
+ local timerFont = baseModule.Saved.TimerFont
+ local timerFontColor = baseModule.Saved.TimerFontColor
- for _, _value in ipairs(MementoBar.OrderedMementos) do
- if MementoBar.Buttons[_value.Id] ~= nil then
- local backdrop = GetControl(MementoBar.Buttons[_value.Id], "Backdrop")
+ for _, _value in ipairs(baseModule.OrderedMementos) do
+ if baseModule.Buttons[_value.Id] ~= nil then
+ local backdrop = GetControl(baseModule.Buttons[_value.Id], "Backdrop")
if backdrop ~= nil then
backdrop:SetCenterColor(centerColor.r, centerColor.g, centerColor.b, centerColor.a)
backdrop:SetEdgeColor(edgeColor.r, edgeColor.g, edgeColor.b, edgeColor.a)
end
- local label = GetControl(MementoBar.Buttons[_value.Id], "Timer")
+ local label = GetControl(baseModule.Buttons[_value.Id], "Timer")
if label ~= nil then
label:SetHidden(not timerIsTimerEnabled)
@@ -191,38 +191,38 @@ function MementoBar:RestoreButtons()
end
end
-function MementoBar:Activate(collectibleId)
+function baseModule:Activate(collectibleId)
if collectibleId and IsCollectibleUsable(collectibleId) then
- MementoBar.CountDown.StartTime = GetTimeStamp()
- MementoBar.CountDown.CollectibleId = collectibleId
- EVENT_MANAGER:UnregisterForUpdate(MementoBar.Addon.Name .. MementoBar.CountDown.Event)
+ baseModule.CountDown.StartTime = GetTimeStamp()
+ baseModule.CountDown.CollectibleId = collectibleId
+ EVENT_MANAGER:UnregisterForUpdate(baseModule.Addon.Name .. baseModule.CountDown.Event)
UseCollectible(collectibleId)
- EVENT_MANAGER:RegisterForUpdate(MementoBar.Addon.Name .. MementoBar.CountDown.Event, MementoBar.CountDown.Tick, MementoBar.Update)
+ EVENT_MANAGER:RegisterForUpdate(baseModule.Addon.Name .. baseModule.CountDown.Event, baseModule.CountDown.Tick, baseModule.Update)
end
end
-function MementoBar.Update()
- local cooldownRemaining, cooldownDuration = GetCollectibleCooldownAndDuration(MementoBar.CountDown.CollectibleId)
+function baseModule.Update()
+ local cooldownRemaining, cooldownDuration = GetCollectibleCooldownAndDuration(baseModule.CountDown.CollectibleId)
if cooldownRemaining > 0 then
- MementoBar:UpdateLabel(cooldownRemaining)
- elseif (cooldownDuration > 0 and (GetTimeStamp() < (MementoBar.CountDown.StartTime + math.floor(cooldownDuration / 1000)))) then
- MementoBar:UpdateLabel(cooldownDuration)
+ baseModule:UpdateLabel(cooldownRemaining)
+ elseif (cooldownDuration > 0 and (GetTimeStamp() < (baseModule.CountDown.StartTime + math.floor(cooldownDuration / 1000)))) then
+ baseModule:UpdateLabel(cooldownDuration)
else
- MementoBar:UpdateLabel("")
- EVENT_MANAGER:UnregisterForUpdate(MementoBar.Addon.Name .. MementoBar.CountDown.Event)
+ baseModule:UpdateLabel("")
+ EVENT_MANAGER:UnregisterForUpdate(baseModule.Addon.Name .. baseModule.CountDown.Event)
end
end
-function MementoBar:UpdateLabel(remaining)
+function baseModule:UpdateLabel(remaining)
if type(remaining) == "number" and remaining > 0 then
remaining = string.format("%.1fs", (math.floor(remaining / 100) / 10))
end
- for collectibleId in pairs(MementoBar.Saved.SelectedMementos) do
- local buttonTimer = GetControl(MementoBar.Buttons[collectibleId], "Timer")
+ for collectibleId in pairs(baseModule.Saved.SelectedMementos) do
+ local buttonTimer = GetControl(baseModule.Buttons[collectibleId], "Timer")
- if buttonTimer and MementoBar.Mementos[collectibleId] then
+ if buttonTimer and baseModule.Mementos[collectibleId] then
buttonTimer:SetText(remaining)
end
end
diff --git a/MementoBar_Constants.lua b/MementoBar_Constants.lua
index 21a9c64..d02dded 100644
--- a/MementoBar_Constants.lua
+++ b/MementoBar_Constants.lua
@@ -7,8 +7,9 @@ Filename: MementoBar_Constants.lua
-- VARIABLES --
-------------------------------------------------------------------------------------------------
MementoBar = {}
+local baseModule = MementoBar
-MementoBar.Addon = {
+baseModule.Addon = {
Name = "MementoBar",
DisplayName = "Memento bar",
Version = 1.6,
@@ -17,10 +18,10 @@ MementoBar.Addon = {
Author = "Jarth",
Website = ""
}
-MementoBar.WM = GetWindowManager()
-MementoBar.Buttons = {}
-MementoBar.Fragment = nil
-MementoBar.Default = {
+baseModule.WM = GetWindowManager()
+baseModule.Buttons = {}
+baseModule.Fragment = nil
+baseModule.Default = {
Left = CENTER,
Top = CENTER,
CenterColor = {r = 0.88, g = 0.88, b = 0.88, a = 0.4},
@@ -32,8 +33,11 @@ MementoBar.Default = {
ShowBarOnHud = true,
ShowBarOnHudUI = true,
ShowBarInMenu = false,
- ShowBarInStore = false,
ShowBarInInventory = false,
+ ShowBarInInteract = false,
+ ShowBarInBank = false,
+ ShowBarInFence = false,
+ ShowBarInStore = false,
Margin = 2,
Height = 60,
Width = 60,
@@ -54,9 +58,9 @@ MementoBar.Default = {
TimerFontColor = {r = 0.9, g = 0.9, b = 0.9, a = 0.9},
TimerFont = "ZoFontHeader2"
}
-MementoBar.Mementos = {}
-MementoBar.OrderedMementos = {}
-MementoBar.Global = {
+baseModule.Mementos = {}
+baseModule.OrderedMementos = {}
+baseModule.Global = {
IsMoveEnabled = false,
TopLevelIndex = 7,
ReverseKeyBindings = {},
@@ -83,26 +87,22 @@ MementoBar.Global = {
}
}
-MementoBar.Global.CategoryName,
- _,
- MementoBar.Global.CategoryNumCollectibles,
- MementoBar.Global.CategoryNumUnlocked,
- MementoBar.Global.CategoryTotal,
- _ = GetCollectibleCategoryInfo(MementoBar.Global.TopLevelIndex)
-for index = 1, MementoBar.Global.CategoryTotal do
- local collectibleId = GetCollectibleId(MementoBar.Global.TopLevelIndex, nil, index)
+baseModule.Global.CategoryName, _, baseModule.Global.CategoryNumCollectibles, baseModule.Global.CategoryNumUnlocked, baseModule.Global.CategoryTotal, _ =
+ GetCollectibleCategoryInfo(baseModule.Global.TopLevelIndex)
+for index = 1, baseModule.Global.CategoryTotal do
+ local collectibleId = GetCollectibleId(baseModule.Global.TopLevelIndex, nil, index)
local collectibleName, collectibleDescription, collectibleIcon, _, collectibleUnlocked, _, _, _, collectibleHint, _ = GetCollectibleInfo(collectibleId)
- MementoBar.Mementos[collectibleId] = {
+ baseModule.Mementos[collectibleId] = {
Id = collectibleId,
Name = collectibleName,
EnabledTexture = collectibleIcon,
Disabled = not collectibleUnlocked,
Tooltip = string.format("Description: %s \nHint: %s", collectibleDescription, collectibleHint)
}
- MementoBar.OrderedMementos[index] = MementoBar.Mementos[collectibleId]
+ baseModule.OrderedMementos[index] = baseModule.Mementos[collectibleId]
end
-MementoBar.CountDown = {
+baseModule.CountDown = {
Event = "Cooldown",
Tick = 100,
StartTime = 0,
diff --git a/MementoBar_Fragments.lua b/MementoBar_Fragments.lua
index f9f5312..062eaae 100644
--- a/MementoBar_Fragments.lua
+++ b/MementoBar_Fragments.lua
@@ -6,12 +6,12 @@ Filename: MementoBar_Fragments.lua
-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
-local MementoBar = MementoBar
+local baseModule = MementoBar
-------------------------------------------------------------------------------------------------
-- Helper FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function MementoBar:HelperSetFragmentBehaviour(value, scene, fragment, statement, frameIsHidden)
+function baseModule:HelperSetFragmentBehaviour(value, scene, fragment, statement, frameIsHidden)
if value then
scene:AddFragment(fragment)
@@ -28,31 +28,27 @@ end
-------------------------------------------------------------------------------------------------
-- PRIVATE FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function MementoBar:SetFragmentBehaviour()
- local base = MementoBar
+function baseModule:SetFragmentBehaviour()
local frame = MementoBar_Frame
- local saved = base.Saved
- local fragment = base.Fragment
+ local saved = baseModule.Saved
+ local fragment = baseModule.Fragment
local currentScene = SCENE_MANAGER:GetCurrentScene()
local frameIsHidden = true
+ local currentSceneIsGameMenuInGame = currentScene ~= nil and currentScene:GetName() == "gameMenuInGame"
if fragment == nil then
- base.Fragment = ZO_HUDFadeSceneFragment:New(frame)
- fragment = base.Fragment
+ baseModule.Fragment = ZO_HUDFadeSceneFragment:New(frame)
+ fragment = baseModule.Fragment
end
- frameIsHidden = MementoBar:HelperSetFragmentBehaviour(saved.ShowBarOnHud, HUD_SCENE, fragment, currentScene == nil, frameIsHidden)
- frameIsHidden = MementoBar:HelperSetFragmentBehaviour(saved.ShowBarOnHudUI, HUD_UI_SCENE, fragment, false, frameIsHidden)
- frameIsHidden =
- MementoBar:HelperSetFragmentBehaviour(
- saved.ShowBarInMenu,
- SCENE_MANAGER:GetScene("gameMenuInGame"),
- fragment,
- currentScene ~= nil and currentScene:GetName() == "gameMenuInGame",
- frameIsHidden
- )
- frameIsHidden = MementoBar:HelperSetFragmentBehaviour(saved.ShowBarInStore, SCENE_MANAGER:GetScene("store"), fragment, false, frameIsHidden)
- frameIsHidden = MementoBar:HelperSetFragmentBehaviour(saved.ShowBarInInventory, SCENE_MANAGER:GetScene("inventory"), fragment, false, frameIsHidden)
+ frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarOnHud, HUD_SCENE, fragment, currentScene == nil, frameIsHidden)
+ frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarOnHudUI, HUD_UI_SCENE, fragment, false, frameIsHidden)
+ frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInMenu, SCENE_MANAGER:GetScene("gameMenuInGame"), fragment, currentSceneIsGameMenuInGame, frameIsHidden)
+ frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInInventory, SCENE_MANAGER:GetScene("inventory"), fragment, false, frameIsHidden)
+ frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInInteract, SCENE_MANAGER:GetScene("interact"), fragment, false, frameIsHidden)
+ frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInBank, SCENE_MANAGER:GetScene("bank"), fragment, false, frameIsHidden)
+ frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInFence, SCENE_MANAGER:GetScene("fence_keyboard"), fragment, false, frameIsHidden)
+ frameIsHidden = baseModule:HelperSetFragmentBehaviour(saved.ShowBarInStore, SCENE_MANAGER:GetScene("store"), fragment, false, frameIsHidden)
frame:SetHidden(frameIsHidden)
end
diff --git a/MementoBar_Hotkeys.lua b/MementoBar_Hotkeys.lua
index 0381801..a77e522 100644
--- a/MementoBar_Hotkeys.lua
+++ b/MementoBar_Hotkeys.lua
@@ -6,64 +6,64 @@ Filename: MementoBar_Hotkeys.lua
-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
-local MementoBar = MementoBar
+local baseModule = MementoBar
-------------------------------------------------------------------------------------------------
-- PUBLIC FUNCTIONS --
-------------------------------------------------------------------------------------------------
function MementoBar_KeyBindingPressed(keyId)
- local control = MementoBar.WM:GetMouseOverControl()
+ local control = baseModul.WM:GetMouseOverControl()
if control ~= nil then
- for collectibleId, _ in pairs(MementoBar.Saved.SelectedMementos) do
- if MementoBar.Buttons[collectibleId] == control then
- MementoBar:HotkeyUpdate(keyId, collectibleId)
- MementoBar:InitializeButtons()
+ for collectibleId, _ in pairs(baseModul.Saved.SelectedMementos) do
+ if baseModul.Buttons[collectibleId] == control then
+ baseModule:HotkeyUpdate(keyId, collectibleId)
+ baseModule:InitializeButtons()
return
end
end
end
- if MementoBar.Saved.KeyBindings[keyId] > 0 then
- MementoBar.ButtonOnClicked(MementoBar.Buttons[MementoBar.Saved.KeyBindings[keyId]])
+ if baseModul.Saved.KeyBindings[keyId] > 0 then
+ baseModul.ButtonOnClicked(baseModul.Buttons[baseModul.Saved.KeyBindings[keyId]])
end
end
-------------------------------------------------------------------------------------------------
-- PRIVATE FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function MementoBar:HoykeyCreateSelections()
- for key, value in ipairs(MementoBar.Saved.KeyBindings) do
+function baseModule:HoykeyCreateSelections()
+ for key, value in ipairs(baseModul.Saved.KeyBindings) do
ZO_CreateStringId("SI_BINDING_NAME_MementoBar_" .. key, "MementoBar_" .. key)
end
end
-function MementoBar:HotkeyUpdate(newKeyId, newCollectibleId)
- MementoBar.Global.ReverseKeyBindings = {}
+function baseModule:HotkeyUpdate(newKeyId, newCollectibleId)
+ baseModul.Global.ReverseKeyBindings = {}
- for keyId, collectibleId in ipairs(MementoBar.Saved.KeyBindings) do
+ for keyId, collectibleId in ipairs(baseModul.Saved.KeyBindings) do
if newCollectibleId and newKeyId == keyId then
- MementoBar.Saved.KeyBindings[keyId] = newCollectibleId
- MementoBar.Global.ReverseKeyBindings[newCollectibleId] = keyId
+ baseModul.Saved.KeyBindings[keyId] = newCollectibleId
+ baseModul.Global.ReverseKeyBindings[newCollectibleId] = keyId
elseif newCollectibleId == collectibleId and newKeyId ~= keyId then
- MementoBar.Saved.KeyBindings[keyId] = 0
- elseif collectibleId > 0 and not MementoBar.Saved.SelectedMementos[collectibleId] then
- MementoBar.Saved.KeyBindings[keyId] = 0
+ baseModul.Saved.KeyBindings[keyId] = 0
+ elseif collectibleId > 0 and not baseModul.Saved.SelectedMementos[collectibleId] then
+ baseModul.Saved.KeyBindings[keyId] = 0
elseif collectibleId > 0 then
- MementoBar.Global.ReverseKeyBindings[collectibleId] = keyId
+ baseModul.Global.ReverseKeyBindings[collectibleId] = keyId
end
end
end
-function MementoBar:HoykeyGetKey(button, collectibleId)
+function baseModule:HoykeyGetKey(button, collectibleId)
local result = ""
- local keyId = MementoBar.Global.ReverseKeyBindings[collectibleId]
+ local keyId = baseModul.Global.ReverseKeyBindings[collectibleId]
if keyId then
local keyBindingTable = {GetHighestPriorityActionBindingInfoFromName("MementoBar_" .. keyId)}
for _, keyValue in pairs(keyBindingTable) do
if keyValue > 0 then
- result = MementoBar:HotkeyGetKeyName(result, keyValue)
+ result = baseModule:HotkeyGetKeyName(result, keyValue)
end
end
end
@@ -71,7 +71,7 @@ function MementoBar:HoykeyGetKey(button, collectibleId)
return result
end
-function MementoBar:HotkeyGetKeyName(result, keyValue)
+function baseModule:HotkeyGetKeyName(result, keyValue)
if keyValue > 0 then
if result ~= "" then
result = string.format("%s+%s", result, GetKeyName(keyValue))
@@ -83,13 +83,13 @@ function MementoBar:HotkeyGetKeyName(result, keyValue)
return result
end
-function MementoBar:HotkeyUpdateColor(frame)
- local fontColor = MementoBar.Saved.FontColor
+function baseModule:HotkeyUpdateColor(frame)
+ local fontColor = baseModul.Saved.FontColor
frame:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
end
-function MementoBar:HotKeyGetLocationValue(value)
+function baseModule:HotKeyGetLocationValue(value)
local result
if value == "bottom" then
@@ -115,7 +115,7 @@ function MementoBar:HotKeyGetLocationValue(value)
return result
end
-function MementoBar:HotKeyGetLocationText(value)
+function baseModule:HotKeyGetLocationText(value)
local result
if value == BOTTOM then
diff --git a/MementoBar_Menu.lua b/MementoBar_Menu.lua
index 91891d5..98890b0 100644
--- a/MementoBar_Menu.lua
+++ b/MementoBar_Menu.lua
@@ -11,69 +11,69 @@ local LAM2 = LibStub:GetLibrary("LibAddonMenu-2.0")
-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
-local MementoBar = MementoBar
+local baseModule = MementoBar
-------------------------------------------------------------------------------------------------
-- Menu Functions --
-------------------------------------------------------------------------------------------------
-function MementoBar:CreateSettingsWindow()
+function baseModule:CreateSettingsWindow()
local panelData = {
type = "panel",
- name = MementoBar.Addon.DisplayName,
- displayName = MementoBar.Addon.DisplayName,
- author = MementoBar.Addon.Author,
- version = MementoBar:GetVersion(true),
- slashCommand = MementoBar.Addon.SlashCommand,
+ name = baseModule.Addon.DisplayName,
+ displayName = baseModule.Addon.DisplayName,
+ author = baseModule.Addon.Author,
+ version = baseModule:GetVersion(true),
+ slashCommand = baseModule.Addon.SlashCommand,
registerForRefresh = true,
registerForDefaults = true
}
- local cntrlOptionsPanel = LAM2:RegisterAddonPanel(MementoBar.Addon.Name, panelData)
+ local cntrlOptionsPanel = LAM2:RegisterAddonPanel(baseModule.Addon.Name, panelData)
local optionsData = {
[1] = {
type = "header",
- name = MementoBar.Addon.DisplayName .. " Settings"
+ name = baseModule.Addon.DisplayName .. " Settings"
},
[2] = {
type = "description",
- text = string.format("Here you can setup %s.\nSlash command: %s", MementoBar.Addon.DisplayName, MementoBar.Addon.SlashCommand)
+ text = string.format("Here you can setup %s.\nSlash command: %s", baseModule.Addon.DisplayName, baseModule.Addon.SlashCommand)
},
[3] = {
type = "checkbox",
name = "Use account settings",
tooltip = "When ON the account settings will be used. When OFF character settings will be used.",
- default = MementoBar.Default.UseAccountSettings,
+ default = baseModule.Default.UseAccountSettings,
getFunc = function()
- return MementoBar.Saved.UseAccountSettings
+ return baseModule.Saved.UseAccountSettings
end,
setFunc = function(newValue)
- MementoBar.Saved.UseAccountSettings = newValue
+ baseModule.Saved.UseAccountSettings = newValue
if newValue then
- MementoBar.Saved = ZO_SavedVars:NewAccountWide("MementoBar_Account", MementoBar.Addon.Version, nil, MementoBar.Default)
+ baseModule.Saved = ZO_SavedVars:NewAccountWide("MementoBar_Account", baseModule.Addon.Version, nil, baseModule.Default)
else
- MementoBar.Saved = ZO_SavedVars:New("MementoBar_Character", MementoBar.Addon.Version, nil, MementoBar.Default)
+ baseModule.Saved = ZO_SavedVars:New("MementoBar_Character", baseModule.Addon.Version, nil, baseModule.Default)
end
- MementoBar.Saved.UseAccountSettings = newValue
- MementoBar:RestorePanel()
+ baseModule.Saved.UseAccountSettings = newValue
+ baseModule:RestorePanel()
end
},
[4] = {
type = "submenu",
- name = MementoBar.Global.CategoryName .. " (Total: " .. MementoBar.Global.CategoryTotal .. " Unlocked: " .. MementoBar.Global.CategoryNumUnlocked .. ")",
+ name = baseModule.Global.CategoryName .. " (Total: " .. baseModule.Global.CategoryTotal .. " Unlocked: " .. baseModule.Global.CategoryNumUnlocked .. ")",
tooltip = "Choose what memento's you want on the bar.",
controls = {
[1] = {
type = "slider",
name = "Choose bar depth (number of rows/columns)", -- or string id or function returning a string
- default = MementoBar.Default.BarDepth,
+ default = baseModule.Default.BarDepth,
getFunc = function()
- return MementoBar.Saved.BarDepth
+ return baseModule.Saved.BarDepth
end,
setFunc = function(value)
- MementoBar.Saved.BarDepth = value
- MementoBar:RestorePanel()
+ baseModule.Saved.BarDepth = value
+ baseModule:RestorePanel()
end,
min = 1,
- max = MementoBar.Global.CategoryNumUnlocked
+ max = baseModule.Global.CategoryNumUnlocked
},
[2] = {
type = "description",
@@ -95,39 +95,39 @@ function MementoBar:CreateSettingsWindow()
name = "Unlock movement of bar",
tooltip = "When ON the bar will show the X,Y position of the top left corner, when the mouse enters and drags the panel around.",
default = function()
- return MementoBar.Global.IsMoveEnabled
+ return baseModule.Global.IsMoveEnabled
end,
getFunc = function()
- return MementoBar.Global.IsMoveEnabled
+ return baseModule.Global.IsMoveEnabled
end,
setFunc = function(newValue)
- MementoBar.Global.IsMoveEnabled = newValue
- MementoBar:RestorePanel()
+ baseModule.Global.IsMoveEnabled = newValue
+ baseModule:RestorePanel()
end
},
[3] = {
type = "checkbox",
name = "Bar orientation horizontal",
tooltip = "When ON the bar will orientate horizontally.",
- default = MementoBar.Default.Horizontal,
+ default = baseModule.Default.Horizontal,
getFunc = function()
- return MementoBar.Saved.Horizontal
+ return baseModule.Saved.Horizontal
end,
setFunc = function(newValue)
- MementoBar.Saved.Horizontal = newValue
- MementoBar:RestorePanel()
+ baseModule.Saved.Horizontal = newValue
+ baseModule:RestorePanel()
end
},
[4] = {
type = "slider",
name = "Choose button margin",
- default = MementoBar.Default.Margin,
+ default = baseModule.Default.Margin,
getFunc = function()
- return MementoBar.Saved.Margin
+ return baseModule.Saved.Margin
end,
setFunc = function(value)
- MementoBar.Saved.Margin = value
- MementoBar:RestorePanel()
+ baseModule.Saved.Margin = value
+ baseModule:RestorePanel()
end,
min = 1,
max = 50
@@ -135,13 +135,13 @@ function MementoBar:CreateSettingsWindow()
[5] = {
type = "slider",
name = "Choose button height",
- default = MementoBar.Default.Height,
+ default = baseModule.Default.Height,
getFunc = function()
- return MementoBar.Saved.Height
+ return baseModule.Saved.Height
end,
setFunc = function(value)
- MementoBar.Saved.Height = value
- MementoBar:RestorePanel()
+ baseModule.Saved.Height = value
+ baseModule:RestorePanel()
end,
min = 1,
max = 100
@@ -149,13 +149,13 @@ function MementoBar:CreateSettingsWindow()
[6] = {
type = "slider",
name = "Choose button width",
- default = MementoBar.Default.Width,
+ default = baseModule.Default.Width,
getFunc = function()
- return MementoBar.Saved.Width
+ return baseModule.Saved.Width
end,
setFunc = function(value)
- MementoBar.Saved.Width = value
- MementoBar:RestorePanel()
+ baseModule.Saved.Width = value
+ baseModule:RestorePanel()
end,
min = 1,
max = 100
@@ -163,13 +163,13 @@ function MementoBar:CreateSettingsWindow()
[7] = {
type = "slider",
name = "Choose snap size when moving",
- default = MementoBar.Default.SnapSize,
+ default = baseModule.Default.SnapSize,
getFunc = function()
- return MementoBar.Saved.SnapSize
+ return baseModule.Saved.SnapSize
end,
setFunc = function(value)
- MementoBar.Saved.SnapSize = value
- MementoBar:RestorePanel()
+ baseModule.Saved.SnapSize = value
+ baseModule:RestorePanel()
end,
min = 1,
max = 10
@@ -178,13 +178,13 @@ function MementoBar:CreateSettingsWindow()
type = "checkbox",
name = "Show hotkey's on bar",
tooltip = "When ON the hotkey's will be shown on the bar.",
- default = MementoBar.Default.ShowKeyBinding,
+ default = baseModule.Default.ShowKeyBinding,
getFunc = function()
- return MementoBar.Saved.ShowKeyBinding
+ return baseModule.Saved.ShowKeyBinding
end,
setFunc = function(newValue)
- MementoBar.Saved.ShowKeyBinding = newValue
- MementoBar:RestorePanel()
+ baseModule.Saved.ShowKeyBinding = newValue
+ baseModule:RestorePanel()
end,
width = "half"
},
@@ -192,17 +192,17 @@ function MementoBar:CreateSettingsWindow()
type = "dropdown",
name = "Hotkey label location",
tooltip = "Select hotkey label location",
- choices = MementoBar.Global.ChoisesKeyBindingLocation,
- default = MementoBar.Default.KeyBindingLocation,
+ choices = baseModule.Global.ChoisesKeyBindingLocation,
+ default = baseModule.Default.KeyBindingLocation,
disabled = function()
- return not MementoBar.Saved.ShowKeyBinding
+ return not baseModule.Saved.ShowKeyBinding
end,
getFunc = function()
- return MementoBar:HotKeyGetLocationText(MementoBar.Saved.KeyBindingLocation)
+ return baseModule:HotKeyGetLocationText(baseModule.Saved.KeyBindingLocation)
end,
setFunc = function(value)
- MementoBar.Saved.KeyBindingLocation = MementoBar:HotKeyGetLocationValue(value)
- MementoBar:RestorePanel()
+ baseModule.Saved.KeyBindingLocation = baseModule:HotKeyGetLocationValue(value)
+ baseModule:RestorePanel()
end,
width = "half"
}
@@ -222,14 +222,14 @@ function MementoBar:CreateSettingsWindow()
name = "Button background Color",
tooltip = "Changes the background color of the buttons.",
default = function()
- return MementoBar.Default.CenterColor
+ return baseModule.Default.CenterColor
end,
getFunc = function()
- return MementoBar.Saved.CenterColor.r, MementoBar.Saved.CenterColor.g, MementoBar.Saved.CenterColor.b, MementoBar.Saved.CenterColor.a
+ return baseModule.Saved.CenterColor.r, baseModule.Saved.CenterColor.g, baseModule.Saved.CenterColor.b, baseModule.Saved.CenterColor.a
end,
setFunc = function(r, g, b, a)
- MementoBar.Saved.CenterColor = {r = r, g = g, b = b, a = a}
- MementoBar:RestorePanel()
+ baseModule.Saved.CenterColor = {r = r, g = g, b = b, a = a}
+ baseModule:RestorePanel()
end,
width = "half"
},
@@ -238,14 +238,14 @@ function MementoBar:CreateSettingsWindow()
name = "Button edge Color",
tooltip = "Changes the edge color of the buttons.",
default = function()
- return MementoBar.Default.EdgeColor
+ return baseModule.Default.EdgeColor
end,
getFunc = function()
- return MementoBar.Saved.EdgeColor.r, MementoBar.Saved.EdgeColor.g, MementoBar.Saved.EdgeColor.b, MementoBar.Saved.EdgeColor.a
+ return baseModule.Saved.EdgeColor.r, baseModule.Saved.EdgeColor.g, baseModule.Saved.EdgeColor.b, baseModule.Saved.EdgeColor.a
end,
setFunc = function(r, g, b, a)
- MementoBar.Saved.EdgeColor = {r = r, g = g, b = b, a = a}
- MementoBar:RestorePanel()
+ baseModule.Saved.EdgeColor = {r = r, g = g, b = b, a = a}
+ baseModule:RestorePanel()
end,
width = "half"
},
@@ -254,14 +254,14 @@ function MementoBar:CreateSettingsWindow()
name = "Button highlight Color",
tooltip = "Changes the highlight color of the buttons.",
default = function()
- return MementoBar.Default.HighlightColor
+ return baseModule.Default.HighlightColor
end,
getFunc = function()
- return MementoBar.Saved.HighlightColor.r, MementoBar.Saved.HighlightColor.g, MementoBar.Saved.HighlightColor.b, MementoBar.Saved.HighlightColor.a
+ return baseModule.Saved.HighlightColor.r, baseModule.Saved.HighlightColor.g, baseModule.Saved.HighlightColor.b, baseModule.Saved.HighlightColor.a
end,
setFunc = function(r, g, b, a)
- MementoBar.Saved.HighlightColor = {r = r, g = g, b = b, a = a}
- MementoBar:RestorePanel()
+ baseModule.Saved.HighlightColor = {r = r, g = g, b = b, a = a}
+ baseModule:RestorePanel()
end,
width = "half"
},
@@ -269,13 +269,13 @@ function MementoBar:CreateSettingsWindow()
type = "colorpicker",
name = "Frame font Color",
tooltip = "Changes of the frame font color.",
- default = MementoBar.Default.FontColor,
+ default = baseModule.Default.FontColor,
getFunc = function()
- return MementoBar.Saved.FontColor.r, MementoBar.Saved.FontColor.g, MementoBar.Saved.FontColor.b, MementoBar.Saved.FontColor.a
+ return baseModule.Saved.FontColor.r, baseModule.Saved.FontColor.g, baseModule.Saved.FontColor.b, baseModule.Saved.FontColor.a
end,
setFunc = function(r, g, b, a)
- MementoBar.Saved.FontColor = {r = r, g = g, b = b, a = a}
- MementoBar:RestorePanel()
+ baseModule.Saved.FontColor = {r = r, g = g, b = b, a = a}
+ baseModule:RestorePanel()
end,
width = "half"
}
@@ -295,13 +295,13 @@ function MementoBar:CreateSettingsWindow()
name = "Play hover audio",
tooltip = "When ON hover events on the bar, will play audio.",
default = function()
- return MementoBar.Saved.IsAudioEnabled
+ return baseModule.Saved.IsAudioEnabled
end,
getFunc = function()
- return MementoBar.Saved.IsAudioEnabled
+ return baseModule.Saved.IsAudioEnabled
end,
setFunc = function(newValue)
- MementoBar.Saved.IsAudioEnabled = newValue
+ baseModule.Saved.IsAudioEnabled = newValue
end
}
}
@@ -320,14 +320,14 @@ function MementoBar:CreateSettingsWindow()
name = "Display cooldown",
tooltip = "When ON cooldown will be displayed.",
default = function()
- return MementoBar.Saved.IsTimerEnabled
+ return baseModule.Saved.IsTimerEnabled
end,
getFunc = function()
- return MementoBar.Saved.IsTimerEnabled
+ return baseModule.Saved.IsTimerEnabled
end,
setFunc = function(newValue)
- MementoBar.Saved.IsTimerEnabled = newValue
- MementoBar:RestoreButtons()
+ baseModule.Saved.IsTimerEnabled = newValue
+ baseModule:RestoreButtons()
end
},
[3] = {
@@ -335,19 +335,19 @@ function MementoBar:CreateSettingsWindow()
name = "Cooldown font color",
tooltip = "Changes of the cooldown font color.",
disabled = function()
- return not MementoBar.Saved.IsTimerEnabled
+ return not baseModule.Saved.IsTimerEnabled
end,
default = function()
- return MementoBar.Default.TimerFontColor
+ return baseModule.Default.TimerFontColor
end,
getFunc = function()
- MementoBar:UpdateCooldownExampleText()
- return MementoBar.Saved.TimerFontColor.r, MementoBar.Saved.TimerFontColor.g, MementoBar.Saved.TimerFontColor.b, MementoBar.Saved.TimerFontColor.a
+ baseModule:UpdateCooldownExampleText()
+ return baseModule.Saved.TimerFontColor.r, baseModule.Saved.TimerFontColor.g, baseModule.Saved.TimerFontColor.b, baseModule.Saved.TimerFontColor.a
end,
setFunc = function(r, g, b, a)
- MementoBar.Saved.TimerFontColor = {r = r, g = g, b = b, a = a}
- MementoBar:RestoreButtons()
- MementoBar:UpdateCooldownExampleText()
+ baseModule.Saved.TimerFontColor = {r = r, g = g, b = b, a = a}
+ baseModule:RestoreButtons()
+ baseModule:UpdateCooldownExampleText()
end,
width = "half"
},
@@ -355,26 +355,26 @@ function MementoBar:CreateSettingsWindow()
type = "dropdown",
name = "Cooldown font",
tooltip = "Select the " .. "cooldown font.",
- choices = MementoBar.Global.TimerFonts,
+ choices = baseModule.Global.TimerFonts,
disabled = function()
- return not MementoBar.Saved.IsTimerEnabled
+ return not baseModule.Saved.IsTimerEnabled
end,
- default = MementoBar.Default.TimerFont,
+ default = baseModule.Default.TimerFont,
getFunc = function()
- MementoBar:UpdateCooldownExampleText()
- return MementoBar.Saved.TimerFont
+ baseModule:UpdateCooldownExampleText()
+ return baseModule.Saved.TimerFont
end,
setFunc = function(value)
- MementoBar.Saved.TimerFont = value
- MementoBar:RestoreButtons()
- MementoBar:UpdateCooldownExampleText()
+ baseModule.Saved.TimerFont = value
+ baseModule:RestoreButtons()
+ baseModule:UpdateCooldownExampleText()
end,
width = "half"
},
[5] = {
type = "description",
title = "Example text: 20.9s\n(Update a value to see an example)",
- reference = MementoBar.Addon.DisplayName .. "ExampleTextControl"
+ reference = baseModule.Addon.DisplayName .. "ExampleTextControl"
}
}
},
@@ -387,72 +387,111 @@ function MementoBar:CreateSettingsWindow()
type = "checkbox",
name = "Show bar " .. "on main view/hud",
tooltip = "When ON the bar will show the bar " .. "on main view/hud",
- default = MementoBar.Default.ShowBarOnHud,
+ default = baseModule.Default.ShowBarOnHud,
getFunc = function()
- return MementoBar.Saved.ShowBarOnHud
+ return baseModule.Saved.ShowBarOnHud
end,
setFunc = function(newValue)
- MementoBar.Saved.ShowBarOnHud = newValue
- MementoBar:SetFragmentBehaviour()
+ baseModule.Saved.ShowBarOnHud = newValue
+ baseModule:SetFragmentBehaviour()
end
},
[2] = {
type = "checkbox",
name = "Show bar " .. "on the main view when an overlay is activated/hudui",
tooltip = "When ON the bar will show the bar " .. "on the main view when an overlay is activated/hudui",
- default = MementoBar.Default.ShowBarOnHudUI,
+ default = baseModule.Default.ShowBarOnHudUI,
getFunc = function()
- return MementoBar.Saved.ShowBarOnHudUI
+ return baseModule.Saved.ShowBarOnHudUI
end,
setFunc = function(newValue)
- MementoBar.Saved.ShowBarOnHudUI = newValue
- MementoBar:SetFragmentBehaviour()
+ baseModule.Saved.ShowBarOnHudUI = newValue
+ baseModule:SetFragmentBehaviour()
end
},
[3] = {
type = "checkbox",
name = "Show bar " .. "in menu",
tooltip = "When ON the bar will show the bar " .. "in menu",
- default = MementoBar.Default.ShowBarInMenu,
+ default = baseModule.Default.ShowBarInMenu,
getFunc = function()
- return MementoBar.Saved.ShowBarInMenu
+ return baseModule.Saved.ShowBarInMenu
end,
setFunc = function(newValue)
- MementoBar.Saved.ShowBarInMenu = newValue
- MementoBar:SetFragmentBehaviour()
+ baseModule.Saved.ShowBarInMenu = newValue
+ baseModule:SetFragmentBehaviour()
end
},
[4] = {
type = "checkbox",
name = "Show bar " .. "in the inventory",
tooltip = "When ON the bar will show the bar " .. "in the inventory",
- default = MementoBar.Default.ShowBarInInventory,
+ default = baseModule.Default.ShowBarInInventory,
getFunc = function()
- return MementoBar.Saved.ShowBarInInventory
+ return baseModule.Saved.ShowBarInInventory
end,
setFunc = function(newValue)
- MementoBar.Saved.ShowBarInInventory = newValue
- MementoBar:SetFragmentBehaviour()
+ baseModule.Saved.ShowBarInInventory = newValue
+ baseModule:SetFragmentBehaviour()
end
},
[5] = {
type = "checkbox",
- name = "Show bar " .. "in a store",
- tooltip = "When ON the bar will show the bar " .. "in a store",
- default = MementoBar.Default.ShowBarInStore,
+ name = "Show bar " .. "in interactions",
+ tooltip = "When ON the bar will show the bar " .. "in interactions",
+ default = baseModule.Default.ShowBarInInteract,
getFunc = function()
- return MementoBar.Saved.ShowBarInStore
+ return baseModule.Saved.ShowBarInInteract
end,
setFunc = function(newValue)
- MementoBar.Saved.ShowBarInStore = newValue
- MementoBar:SetFragmentBehaviour()
+ baseModule.Saved.ShowBarInInteract = newValue
+ baseModule:SetFragmentBehaviour()
+ end
+ },
+ [6] = {
+ type = "checkbox",
+ name = "Show bar " .. "at a bank",
+ tooltip = "When ON the bar will show the bar " .. "at a bank",
+ default = baseModule.Default.ShowBarInBank,
+ getFunc = function()
+ return baseModule.Saved.ShowBarInBank
+ end,
+ setFunc = function(newValue)
+ baseModule.Saved.ShowBarInBank = newValue
+ baseModule:SetFragmentBehaviour()
+ end
+ },
+ [7] = {
+ type = "checkbox",
+ name = "Show bar " .. "at a fence",
+ tooltip = "When ON the bar will show the bar " .. "at a fence",
+ default = baseModule.Default.ShowBarInFence,
+ getFunc = function()
+ return baseModule.Saved.ShowBarInFence
+ end,
+ setFunc = function(newValue)
+ baseModule.Saved.ShowBarInFence = newValue
+ baseModule:SetFragmentBehaviour()
+ end
+ },
+ [8] = {
+ type = "checkbox",
+ name = "Show bar " .. "at a store",
+ tooltip = "When ON the bar will show the bar " .. "at a store",
+ default = baseModule.Default.ShowBarInStore,
+ getFunc = function()
+ return baseModule.Saved.ShowBarInStore
+ end,
+ setFunc = function(newValue)
+ baseModule.Saved.ShowBarInStore = newValue
+ baseModule:SetFragmentBehaviour()
end
}
}
}
}
- for index, _type in ipairs(MementoBar.OrderedMementos) do
+ for index, _type in ipairs(baseModule.OrderedMementos) do
local line = {
type = "checkbox",
name = "Show " .. _type.Name,
@@ -460,33 +499,33 @@ function MementoBar:CreateSettingsWindow()
default = not _type.Disabled,
disabled = _type.Disabled,
getFunc = function()
- return MementoBar.Saved.SelectedMementos[_type.Id]
+ return baseModule.Saved.SelectedMementos[_type.Id]
end,
setFunc = function(newValue)
if newValue == true then
- MementoBar.Saved.SelectedMementos[_type.Id] = newValue
+ baseModule.Saved.SelectedMementos[_type.Id] = newValue
else
- MementoBar.Saved.SelectedMementos[_type.Id] = nil
+ baseModule.Saved.SelectedMementos[_type.Id] = nil
end
- MementoBar:RestorePanel()
+ baseModule:RestorePanel()
end
}
table.insert(optionsData[4].controls, index + 2, line)
end
- LAM2:RegisterOptionControls(MementoBar.Addon.Name, optionsData)
+ LAM2:RegisterOptionControls(baseModule.Addon.Name, optionsData)
end
-function MementoBar:UpdateCooldownExampleText()
- local control = GetControl(MementoBar.Addon.DisplayName .. "ExampleTextControl")
- local fontColor = MementoBar.Saved.TimerFontColor
+function baseModule:UpdateCooldownExampleText()
+ local control = GetControl(baseModule.Addon.DisplayName .. "ExampleTextControl")
+ local fontColor = baseModule.Saved.TimerFontColor
if control ~= nil and control.desc ~= nil then
control.desc:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
- control.desc:SetFont(MementoBar.Saved.TimerFont)
+ control.desc:SetFont(baseModule.Saved.TimerFont)
end
if control ~= nil and control.title ~= nil then
control.title:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
- control.title:SetFont(MementoBar.Saved.TimerFont)
+ control.title:SetFont(baseModule.Saved.TimerFont)
end
end
diff --git a/MementoBar_Move.lua b/MementoBar_Move.lua
index 3bcef52..3b44129 100644
--- a/MementoBar_Move.lua
+++ b/MementoBar_Move.lua
@@ -6,22 +6,22 @@ Filename: MementoBar_Move.lua
-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
-local MementoBar = MementoBar
+local baseModul = MementoBar
-------------------------------------------------------------------------------------------------
-- FUNCTIONS --
-- Move frame --
-------------------------------------------------------------------------------------------------
-function MementoBar:UpdateMoveFrame()
- local moveFrame = MementoBar.MoveFrame
+function baseModul:UpdateMoveFrame()
+ local moveFrame = baseModul.MoveFrame
local onMouseEnter, onMouseExit, onMouseDown, onMouseUp = nil, nil, nil, nil
- if MementoBar.Global.IsMoveEnabled then
- moveFrame = MementoBar:GetOrCreateMoveFrame()
- onMouseEnter = MementoBar.MoveFrameOnEnter
- onMouseExit = MementoBar.MoveFrameOnExit
- onMouseDown = MementoBar.MoveFrameOnDown
- onMouseUp = MementoBar.MoveFrameOnUp
+ if baseModul.Global.IsMoveEnabled then
+ moveFrame = baseModul:GetOrCreateMoveFrame()
+ onMouseEnter = baseModul.MoveFrameOnEnter
+ onMouseExit = baseModul.MoveFrameOnExit
+ onMouseDown = baseModul.MoveFrameOnDown
+ onMouseUp = baseModul.MoveFrameOnUp
end
if moveFrame then
@@ -29,10 +29,10 @@ function MementoBar:UpdateMoveFrame()
moveFrame:SetHandler("OnMouseExit", onMouseExit)
moveFrame:SetHandler("OnMouseDown", onMouseDown)
moveFrame:SetHandler("OnMouseUp", onMouseUp)
- moveFrame:SetHidden(not MementoBar.Global.IsMoveEnabled)
- moveFrame.overlay:SetHidden(not MementoBar.Global.IsMoveEnabled)
- moveFrame.labelCenter:SetHidden(not MementoBar.Global.IsMoveEnabled)
- moveFrame.labelTopLeft:SetHidden(not MementoBar.Global.IsMoveEnabled)
+ moveFrame:SetHidden(not baseModul.Global.IsMoveEnabled)
+ moveFrame.overlay:SetHidden(not baseModul.Global.IsMoveEnabled)
+ moveFrame.labelCenter:SetHidden(not baseModul.Global.IsMoveEnabled)
+ moveFrame.labelTopLeft:SetHidden(not baseModul.Global.IsMoveEnabled)
moveFrame.MoveFrameUpdateText(moveFrame)
moveFrame.MoveFrameUpdateColor(moveFrame)
moveFrame.MoveFrameAnchorToTarget(moveFrame, moveFrame.TargetFrame)
@@ -43,20 +43,20 @@ end
-- FUNCTIONS --
-- Move handlers --
-------------------------------------------------------------------------------------------------
-function MementoBar:GetOrCreateMoveFrame(show)
- if MementoBar.MoveFrame == nil then
- local newMoveFrame = MementoBar.WM:CreateControlFromVirtual(nil, GuiRoot, "MementoBar_MoveFrame")
+function baseModul:GetOrCreateMoveFrame(show)
+ if baseModul.MoveFrame == nil then
+ local newMoveFrame = baseModul.WM:CreateControlFromVirtual(nil, GuiRoot, "MementoBar_MoveFrame")
local targetFrame = MementoBar_Frame
--Variable is used to define what savedVariable the Frame refers to.
newMoveFrame.TargetFrame = targetFrame
- newMoveFrame["MoveFrameAnchorToTarget"] = MementoBar.MoveFrameAnchorToTarget
- newMoveFrame["MoveFrameGetSnapPosition"] = MementoBar.MoveFrameGetSnapPosition
- newMoveFrame["MoveFrameUpdateText"] = MementoBar.MoveFrameUpdateText
- newMoveFrame["MoveFrameUpdateColor"] = MementoBar.MoveFrameUpdateColor
- newMoveFrame["MoveFrameOnUpdate"] = MementoBar.MoveFrameOnUpdate
- newMoveFrame["MoveFrameStorePosition"] = MementoBar.MoveFrameStorePosition
+ newMoveFrame["MoveFrameAnchorToTarget"] = baseModul.MoveFrameAnchorToTarget
+ newMoveFrame["MoveFrameGetSnapPosition"] = baseModul.MoveFrameGetSnapPosition
+ newMoveFrame["MoveFrameUpdateText"] = baseModul.MoveFrameUpdateText
+ newMoveFrame["MoveFrameUpdateColor"] = baseModul.MoveFrameUpdateColor
+ newMoveFrame["MoveFrameOnUpdate"] = baseModul.MoveFrameOnUpdate
+ newMoveFrame["MoveFrameStorePosition"] = baseModul.MoveFrameStorePosition
newMoveFrame:SetDimensions(targetFrame:GetWidth(), targetFrame:GetHeight())
newMoveFrame:SetDrawLayer(4)
@@ -66,56 +66,56 @@ function MementoBar:GetOrCreateMoveFrame(show)
newMoveFrame:SetClampedToScreen(true)
-- overlay
- newMoveFrame.overlay = MementoBar.WM:CreateControl(nil, newMoveFrame, CT_BACKDROP)
+ newMoveFrame.overlay = baseModul.WM:CreateControl(nil, newMoveFrame, CT_BACKDROP)
newMoveFrame.overlay:SetDrawLevel(2)
newMoveFrame.overlay:SetAnchorFill(targetFrame)
newMoveFrame.overlay:SetEdgeTexture("", 8, 1, 0)
-- label
- newMoveFrame.labelCenter = MementoBar.WM:CreateControl(nil, newMoveFrame, CT_LABEL)
+ newMoveFrame.labelCenter = baseModul.WM:CreateControl(nil, newMoveFrame, CT_LABEL)
newMoveFrame.labelCenter:SetDrawLevel(3)
newMoveFrame.labelCenter:SetAnchorFill(targetFrame)
newMoveFrame.labelCenter:SetFont("ZoFontWinH5")
newMoveFrame.labelCenter:SetHorizontalAlignment(1)
newMoveFrame.labelCenter:SetVerticalAlignment(1)
- newMoveFrame.labelTopLeft = MementoBar.WM:CreateControl(nil, newMoveFrame, CT_LABEL)
+ newMoveFrame.labelTopLeft = baseModul.WM:CreateControl(nil, newMoveFrame, CT_LABEL)
newMoveFrame.labelTopLeft:SetDrawLevel(3)
newMoveFrame.labelTopLeft:SetAnchorFill(targetFrame)
newMoveFrame.labelTopLeft:SetFont("ZoFontWinH5")
newMoveFrame.labelTopLeft:SetHorizontalAlignment(0)
newMoveFrame.labelTopLeft:SetVerticalAlignment(0)
- MementoBar.MoveFrame = newMoveFrame
+ baseModul.MoveFrame = newMoveFrame
end
- return MementoBar.MoveFrame
+ return baseModul.MoveFrame
end
-function MementoBar.MoveFrameOnEnter(frame)
+function baseModul.MoveFrameOnEnter(frame)
frame.MoveFrameUpdateText(frame, true)
end
-function MementoBar.MoveFrameOnExit(frame)
+function baseModul.MoveFrameOnExit(frame)
frame.MoveFrameUpdateText(frame, false)
end
-function MementoBar.MoveFrameOnDown(frame)
+function baseModul.MoveFrameOnDown(frame)
frame:SetHandler("OnUpdate", frame.MoveFrameOnUpdate)
end
-function MementoBar.MoveFrameOnUp(frame)
+function baseModul.MoveFrameOnUp(frame)
frame.MoveFrameOnUpdate(frame)
frame.MoveFrameUpdateText(frame, false)
frame:SetHandler("OnUpdate", nil)
frame.MoveFrameStorePosition(frame)
end
-function MementoBar.MoveFrameOnUpdate(frame)
+function baseModul.MoveFrameOnUpdate(frame)
frame.TargetFrame:ClearAnchors()
- frame.TargetFrame:SetAnchor(TOPLeft, GuiRoot, TOPLeft, MementoBar.MoveFrameGetSnapPosition(frame:GetLeft()), MementoBar.MoveFrameGetSnapPosition(frame:GetTop()))
+ frame.TargetFrame:SetAnchor(TOPLeft, GuiRoot, TOPLeft, baseModul.MoveFrameGetSnapPosition(frame:GetLeft()), baseModul.MoveFrameGetSnapPosition(frame:GetTop()))
frame.MoveFrameUpdateText(frame, true)
end
-function MementoBar.MoveFrameUpdateText(frame, position)
+function baseModul.MoveFrameUpdateText(frame, position)
local labelTextTopLeft = ""
frame.labelCenter:SetText(string.format("%s,%s", frame:GetWidth(), frame:GetHeight()))
@@ -127,25 +127,25 @@ function MementoBar.MoveFrameUpdateText(frame, position)
frame.labelTopLeft:SetText(labelTextTopLeft)
end
-function MementoBar.MoveFrameGetSnapPosition(value)
- return (zo_round(value / MementoBar.Saved.SnapSize) * MementoBar.Saved.SnapSize)
+function baseModul.MoveFrameGetSnapPosition(value)
+ return (zo_round(value / baseModul.Saved.SnapSize) * baseModul.Saved.SnapSize)
end
-function MementoBar.MoveFrameStorePosition(frame)
- MementoBar.Saved.Top = frame.MoveFrameGetSnapPosition(frame:GetTop())
- MementoBar.Saved.Left = frame.MoveFrameGetSnapPosition(frame:GetLeft())
+function baseModul.MoveFrameStorePosition(frame)
+ baseModul.Saved.Top = frame.MoveFrameGetSnapPosition(frame:GetTop())
+ baseModul.Saved.Left = frame.MoveFrameGetSnapPosition(frame:GetLeft())
end
-function MementoBar.MoveFrameAnchorToTarget(frame, target)
+function baseModul.MoveFrameAnchorToTarget(frame, target)
frame:ClearAnchors()
frame:SetDimensions(target:GetWidth(), target:GetHeight())
frame:SetAnchor(TOPLeft, GuiRoot, TOPLeft, target:GetLeft(), target:GetTop())
end
-function MementoBar.MoveFrameUpdateColor(frame)
- local centerColor = MementoBar.Saved.CenterColor
- local edgeColor = MementoBar.Saved.EdgeColor
- local fontColor = MementoBar.Saved.FontColor
+function baseModul.MoveFrameUpdateColor(frame)
+ local centerColor = baseModul.Saved.CenterColor
+ local edgeColor = baseModul.Saved.EdgeColor
+ local fontColor = baseModul.Saved.FontColor
frame.overlay:SetCenterColor(centerColor.r, centerColor.g, centerColor.b, centerColor.a)
frame.overlay:SetEdgeColor(edgeColor.r, edgeColor.g, edgeColor.b, edgeColor.a)