diff --git a/Changelog b/Changelog
index 0d41277..eb72380 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,19 @@
-------------------------------------------------------------------------------
Summon Assistant
-------------------------------------------------------------------------------
+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.
+- Refactored code to make it more reusable.
+
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/SummonAssistant.lua b/SummonAssistant.lua
index 6dea712..7413c4e 100644
--- a/SummonAssistant.lua
+++ b/SummonAssistant.lua
@@ -6,58 +6,58 @@ Filename: SummonAssistant.lua
-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
-local SummonAssistant = SummonAssistant
+local baseModule = SummonAssistant
-------------------------------------------------------------------------------------------------
-- FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function SummonAssistant.OnAddOnLoaded(_, addonName)
- if addonName == SummonAssistant.Addon.Name then
- SummonAssistant.Initialize()
+function baseModule.OnAddOnLoaded(_, addonName)
+ if addonName == baseModule.Addon.Name then
+ baseModule.Initialize()
end
end
-function SummonAssistant.Initialize()
+function baseModule.Initialize()
-- Load saved values..
- SummonAssistant.Saved = ZO_SavedVars:New("SummonAssistant_Character", SummonAssistant.Addon.Version, nil, SummonAssistant.Default)
+ baseModule.Saved = ZO_SavedVars:New("SummonAssistant_Character", baseModule.Addon.Version, nil, baseModule.Default)
- if SummonAssistant.Saved.UseAccountSettings then
- SummonAssistant.Saved = ZO_SavedVars:NewAccountWide("SummonAssistant_Account", SummonAssistant.Addon.Version, nil, SummonAssistant.Default)
+ if baseModule.Saved.UseAccountSettings then
+ baseModule.Saved = ZO_SavedVars:NewAccountWide("SummonAssistant_Account", baseModule.Addon.Version, nil, baseModule.Default)
end
- SummonAssistant:RestorePanel()
- SummonAssistant:HoykeyCreateSelections()
- SummonAssistant:CreateSettingsWindow()
+ baseModule:RestorePanel()
+ baseModule:HoykeyCreateSelections()
+ baseModule:CreateSettingsWindow()
- EVENT_MANAGER:UnregisterForEvent(SummonAssistant.Addon.Name, EVENT_ADD_ON_LOADED)
+ EVENT_MANAGER:UnregisterForEvent(baseModule.Addon.Name, EVENT_ADD_ON_LOADED)
end
-------------------------------------------------------------------------------------------------
-- PRIVATE FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function SummonAssistant:GetVersion(showMinor)
- if showMinor == false or SummonAssistant.Addon.MinorVersion == nil then
- return tostring(SummonAssistant.Addon.Version)
+function baseModule:GetVersion(showMinor)
+ if showMinor == false or baseModule.Addon.MinorVersion == nil then
+ return tostring(baseModule.Addon.Version)
end
- return tostring(SummonAssistant.Addon.Version) .. "." .. tostring(SummonAssistant.Addon.MinorVersion)
+ return tostring(baseModule.Addon.Version) .. "." .. tostring(baseModule.Addon.MinorVersion)
end
-function SummonAssistant:RestorePanel()
- SummonAssistant:SetButtonFrameWidth()
- SummonAssistant:InitializeButtons()
- SummonAssistant:ButtonsBackdropColor()
- SummonAssistant:RestorePosition()
- SummonAssistant:UpdateMoveFrame()
- SummonAssistant:SetFragmentBehaviour()
+function baseModule:RestorePanel()
+ baseModule:SetButtonFrameWidth()
+ baseModule:InitializeButtons()
+ baseModule:ButtonsBackdropColor()
+ baseModule:RestorePosition()
+ baseModule:UpdateMoveFrame()
+ baseModule:SetFragmentBehaviour()
end
-function SummonAssistant:RestorePosition()
- local Top = SummonAssistant.Saved.Top
- local Left = SummonAssistant.Saved.Left
+function baseModule:RestorePosition()
+ local Top = baseModule.Saved.Top
+ local Left = baseModule.Saved.Left
SummonAssistant_Frame:ClearAnchors()
SummonAssistant_Frame:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, Left, Top)
end
-EVENT_MANAGER:RegisterForEvent(SummonAssistant.Addon.Name, EVENT_ADD_ON_LOADED, SummonAssistant.OnAddOnLoaded)
+EVENT_MANAGER:RegisterForEvent(baseModule.Addon.Name, EVENT_ADD_ON_LOADED, baseModule.OnAddOnLoaded)
diff --git a/SummonAssistant_Constants.lua b/SummonAssistant_Constants.lua
index a739563..75065b0 100644
--- a/SummonAssistant_Constants.lua
+++ b/SummonAssistant_Constants.lua
@@ -7,8 +7,9 @@ Filename: SummonAssistant_Constants.lua
-- VARIABLES --
-------------------------------------------------------------------------------------------------
SummonAssistant = {}
+local baseModule = SummonAssistant
-SummonAssistant.Addon = {
+baseModule.Addon = {
Name = "SummonAssistant",
DisplayName = "Summon Assistant",
Version = 1.6,
@@ -17,10 +18,10 @@ SummonAssistant.Addon = {
Author = "Jarth",
Website = ""
}
-SummonAssistant.WM = GetWindowManager()
-SummonAssistant.Buttons = {}
-SummonAssistant.Fragment = nil
-SummonAssistant.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 @@ SummonAssistant.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,
@@ -47,11 +51,11 @@ SummonAssistant.Default = {
ShowKeyBinding = true,
IsAudioEnabled = true
}
-SummonAssistant.Global = {
+baseModule.Global = {
IsMoveEnabled = false,
ChoisesKeyBindingLocation = {"bottom", "bottomleft", "bottomright", "center", "left", "right", "top", "topleft", "topright"}
}
-SummonAssistant.Types = {
+baseModule.Types = {
Banker = {
Id = 267,
Title = "Banker:",
@@ -89,8 +93,8 @@ SummonAssistant.Types = {
end
}
}
-SummonAssistant.OrderedTypes = {
- [1] = SummonAssistant.Types["Banker"],
- [2] = SummonAssistant.Types["Fence"],
- [3] = SummonAssistant.Types["Vendor"]
+baseModule.OrderedTypes = {
+ [1] = baseModule.Types["Banker"],
+ [2] = baseModule.Types["Fence"],
+ [3] = baseModule.Types["Vendor"]
}
diff --git a/SummonAssistant_Fragments.lua b/SummonAssistant_Fragments.lua
index 043891a..63fffcc 100644
--- a/SummonAssistant_Fragments.lua
+++ b/SummonAssistant_Fragments.lua
@@ -6,12 +6,12 @@ Filename: SummonAssistant_Fragments.lua
-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
-local SummonAssistant = SummonAssistant
+local baseModule = SummonAssistant
-------------------------------------------------------------------------------------------------
-- Helper FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function SummonAssistant:HelperSetFragmentBehaviour(value, scene, fragment, statement, frameIsHidden)
+function baseModule:HelperSetFragmentBehaviour(value, scene, fragment, statement, frameIsHidden)
if value then
scene:AddFragment(fragment)
@@ -28,31 +28,28 @@ end
-------------------------------------------------------------------------------------------------
-- PRIVATE FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function SummonAssistant:SetFragmentBehaviour()
- local base = SummonAssistant
+function baseModule:SetFragmentBehaviour()
local frame = SummonAssistant_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 = SummonAssistant:HelperSetFragmentBehaviour(saved.ShowBarOnHud, HUD_SCENE, fragment, currentScene == nil, frameIsHidden)
- frameIsHidden = SummonAssistant:HelperSetFragmentBehaviour(saved.ShowBarOnHudUI, HUD_UI_SCENE, fragment, false, frameIsHidden)
- frameIsHidden =
- SummonAssistant:HelperSetFragmentBehaviour(
- saved.ShowBarInMenu,
- SCENE_MANAGER:GetScene("gameMenuInGame"),
- fragment,
- currentScene ~= nil and currentScene:GetName() == "gameMenuInGame",
- frameIsHidden
- )
- frameIsHidden = SummonAssistant:HelperSetFragmentBehaviour(saved.ShowBarInStore, SCENE_MANAGER:GetScene("store"), fragment, false, frameIsHidden)
- frameIsHidden = SummonAssistant: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/SummonAssistant_Hotkeys.lua b/SummonAssistant_Hotkeys.lua
index 66aa780..7cc68c1 100644
--- a/SummonAssistant_Hotkeys.lua
+++ b/SummonAssistant_Hotkeys.lua
@@ -6,20 +6,20 @@ Filename: SummonAssistant_Hotkeys.lua
-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
-local SummonAssistant = SummonAssistant
+local baseModule = SummonAssistant
-------------------------------------------------------------------------------------------------
-- PRIVATE FUNCTIONS --
-------------------------------------------------------------------------------------------------
-function SummonAssistant:HoykeyCreateSelections()
- for _, _value in ipairs(SummonAssistant.OrderedTypes) do
+function baseModule:HoykeyCreateSelections()
+ for _, _value in ipairs(baseModule.OrderedTypes) do
if IsCollectibleUnlocked(_value.Id) then
ZO_CreateStringId(_value.KeyBinding, _value.Name)
end
end
end
-function SummonAssistant:HoykeyGetKey(keyBinding)
+function baseModule:HoykeyGetKey(keyBinding)
local result = ""
if keyBinding then
@@ -27,14 +27,14 @@ function SummonAssistant:HoykeyGetKey(keyBinding)
for _, keyValue in pairs(keyBindingTable) do
if keyValue > 0 then
- result = SummonAssistant:HotkeyGetKeyName(result, keyValue)
+ result = baseModule:HotkeyGetKeyName(result, keyValue)
end
end
end
return result
end
-function SummonAssistant:HotkeyGetKeyName(result, keyValue)
+function baseModule:HotkeyGetKeyName(result, keyValue)
if keyValue > 0 then
if result ~= "" then
result = string.format("%s+%s", result, GetKeyName(keyValue))
@@ -45,13 +45,13 @@ function SummonAssistant:HotkeyGetKeyName(result, keyValue)
return result
end
-function SummonAssistant:HotkeyUpdateColor(frame)
- local fontColor = SummonAssistant.Saved.FontColor
+function baseModule:HotkeyUpdateColor(frame)
+ local fontColor = baseModule.Saved.FontColor
frame:SetColor(fontColor.r, fontColor.g, fontColor.b, fontColor.a)
end
-function SummonAssistant:HotKeyGetLocationValue(value)
+function baseModule:HotKeyGetLocationValue(value)
local result
if value == "bottom" then
@@ -77,7 +77,7 @@ function SummonAssistant:HotKeyGetLocationValue(value)
return result
end
-function SummonAssistant:HotKeyGetLocationText(value)
+function baseModule:HotKeyGetLocationText(value)
local result
if value == BOTTOM then
diff --git a/SummonAssistant_Menu.lua b/SummonAssistant_Menu.lua
index 4a7d022..5ab0e69 100644
--- a/SummonAssistant_Menu.lua
+++ b/SummonAssistant_Menu.lua
@@ -11,49 +11,49 @@ local LAM2 = LibStub:GetLibrary("LibAddonMenu-2.0")
-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
-local SummonAssistant = SummonAssistant
+local baseModule = SummonAssistant
-------------------------------------------------------------------------------------------------
-- Menu Functions --
-------------------------------------------------------------------------------------------------
-function SummonAssistant:CreateSettingsWindow()
+function baseModule:CreateSettingsWindow()
local panelData = {
type = "panel",
- name = SummonAssistant.Addon.DisplayName,
- displayName = SummonAssistant.Addon.DisplayName,
- author = SummonAssistant.Addon.Author,
- version = SummonAssistant:GetVersion(true),
- slashCommand = SummonAssistant.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(SummonAssistant.Addon.Name, panelData)
+ local cntrlOptionsPanel = LAM2:RegisterAddonPanel(baseModule.Addon.Name, panelData)
local optionsData = {
[1] = {
type = "header",
- name = SummonAssistant.Addon.DisplayName .. " Settings"
+ name = baseModule.Addon.DisplayName .. " Settings"
},
[2] = {
type = "description",
- text = string.format("Here you can setup %s.\nSlash command: %s", SummonAssistant.Addon.DisplayName, SummonAssistant.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 = SummonAssistant.Default.UseAccountSettings,
+ default = baseModule.Default.UseAccountSettings,
getFunc = function()
- return SummonAssistant.Saved.UseAccountSettings
+ return baseModule.Saved.UseAccountSettings
end,
setFunc = function(newValue)
- SummonAssistant.Saved.UseAccountSettings = newValue
+ baseModule.Saved.UseAccountSettings = newValue
if newValue then
- SummonAssistant.Saved = ZO_SavedVars:NewAccountWide("SummonAssistant_Account", SummonAssistant.Addon.Version, nil, SummonAssistant.Default)
+ baseModule.Saved = ZO_SavedVars:NewAccountWide("SummonAssistant_Account", baseModule.Addon.Version, nil, baseModule.Default)
else
- SummonAssistant.Saved = ZO_SavedVars:New("SummonAssistant_Character", SummonAssistant.Addon.Version, nil, SummonAssistant.Default)
+ baseModule.Saved = ZO_SavedVars:New("SummonAssistant_Character", baseModule.Addon.Version, nil, baseModule.Default)
end
- SummonAssistant.Saved.UseAccountSettings = newValue
- SummonAssistant:RestorePanel()
+ baseModule.Saved.UseAccountSettings = newValue
+ baseModule:RestorePanel()
end
},
[4] = {
@@ -82,52 +82,52 @@ function SummonAssistant:CreateSettingsWindow()
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.",
disabled = function()
local count = 0
- if IsCollectibleUnlocked(267) and SummonAssistant.Saved.ShowAssistants[267] then
+ if IsCollectibleUnlocked(267) and baseModule.Saved.ShowAssistants[267] then
count = count + 1
end
- if IsCollectibleUnlocked(300) and SummonAssistant.Saved.ShowAssistants[300] then
+ if IsCollectibleUnlocked(300) and baseModule.Saved.ShowAssistants[300] then
count = count + 1
end
- if IsCollectibleUnlocked(301) and SummonAssistant.Saved.ShowAssistants[301] then
+ if IsCollectibleUnlocked(301) and baseModule.Saved.ShowAssistants[301] then
count = count + 1
end
return count == 0
end,
default = function()
- return SummonAssistant.Global.IsMoveEnabled
+ return baseModule.Global.IsMoveEnabled
end,
getFunc = function()
- return SummonAssistant.Global.IsMoveEnabled
+ return baseModule.Global.IsMoveEnabled
end,
setFunc = function(newValue)
- SummonAssistant.Global.IsMoveEnabled = newValue
- SummonAssistant:RestorePanel()
+ baseModule.Global.IsMoveEnabled = newValue
+ baseModule:RestorePanel()
end
},
[3] = {
type = "checkbox",
name = "Bar orientation horizontal",
tooltip = "When ON the bar will orientate horizontally.",
- default = SummonAssistant.Default.Horizontal,
+ default = baseModule.Default.Horizontal,
getFunc = function()
- return SummonAssistant.Saved.Horizontal
+ return baseModule.Saved.Horizontal
end,
setFunc = function(newValue)
- SummonAssistant.Saved.Horizontal = newValue
- SummonAssistant:RestorePanel()
+ baseModule.Saved.Horizontal = newValue
+ baseModule:RestorePanel()
end
},
[4] = {
type = "slider",
name = "Choose button margin",
tooltip = "It is at this time, 'not possible' to move/drag the frame, when the margin is set to 0",
- default = SummonAssistant.Default.Margin,
+ default = baseModule.Default.Margin,
getFunc = function()
- return SummonAssistant.Saved.Margin
+ return baseModule.Saved.Margin
end,
setFunc = function(value)
- SummonAssistant.Saved.Margin = value
- SummonAssistant:RestorePanel()
+ baseModule.Saved.Margin = value
+ baseModule:RestorePanel()
end,
min = 1,
max = 50
@@ -135,13 +135,13 @@ function SummonAssistant:CreateSettingsWindow()
[5] = {
type = "slider",
name = "Choose button height",
- default = SummonAssistant.Default.Height,
+ default = baseModule.Default.Height,
getFunc = function()
- return SummonAssistant.Saved.Height
+ return baseModule.Saved.Height
end,
setFunc = function(value)
- SummonAssistant.Saved.Height = value
- SummonAssistant:RestorePanel()
+ baseModule.Saved.Height = value
+ baseModule:RestorePanel()
end,
min = 1,
max = 100
@@ -149,13 +149,13 @@ function SummonAssistant:CreateSettingsWindow()
[6] = {
type = "slider",
name = "Choose button width",
- default = SummonAssistant.Default.Width,
+ default = baseModule.Default.Width,
getFunc = function()
- return SummonAssistant.Saved.Width
+ return baseModule.Saved.Width
end,
setFunc = function(value)
- SummonAssistant.Saved.Width = value
- SummonAssistant:RestorePanel()
+ baseModule.Saved.Width = value
+ baseModule:RestorePanel()
end,
min = 1,
max = 100
@@ -163,13 +163,13 @@ function SummonAssistant:CreateSettingsWindow()
[7] = {
type = "slider",
name = "Choose snap size when moving",
- default = SummonAssistant.Default.SnapSize,
+ default = baseModule.Default.SnapSize,
getFunc = function()
- return SummonAssistant.Saved.SnapSize
+ return baseModule.Saved.SnapSize
end,
setFunc = function(value)
- SummonAssistant.Saved.SnapSize = value
- SummonAssistant:RestorePanel()
+ baseModule.Saved.SnapSize = value
+ baseModule:RestorePanel()
end,
min = 1,
max = 10
@@ -178,13 +178,13 @@ function SummonAssistant:CreateSettingsWindow()
type = "checkbox",
name = "Show hotkey's on bar",
tooltip = "When ON the hotkey's will be shown on the bar.",
- default = SummonAssistant.Default.ShowKeyBinding,
+ default = baseModule.Default.ShowKeyBinding,
getFunc = function()
- return SummonAssistant.Saved.ShowKeyBinding
+ return baseModule.Saved.ShowKeyBinding
end,
setFunc = function(newValue)
- SummonAssistant.Saved.ShowKeyBinding = newValue
- SummonAssistant:RestorePanel()
+ baseModule.Saved.ShowKeyBinding = newValue
+ baseModule:RestorePanel()
end,
width = "half"
},
@@ -192,17 +192,17 @@ function SummonAssistant:CreateSettingsWindow()
type = "dropdown",
name = "Hotkey label location",
tooltip = "Select hotkey label location",
- choices = SummonAssistant.Global.ChoisesKeyBindingLocation,
- default = SummonAssistant.Default.KeyBindingLocation,
+ choices = baseModule.Global.ChoisesKeyBindingLocation,
+ default = baseModule.Default.KeyBindingLocation,
disabled = function()
- return not SummonAssistant.Saved.ShowKeyBinding
+ return not baseModule.Saved.ShowKeyBinding
end,
getFunc = function()
- return SummonAssistant:HotKeyGetLocationText(SummonAssistant.Saved.KeyBindingLocation)
+ return baseModule:HotKeyGetLocationText(baseModule.Saved.KeyBindingLocation)
end,
setFunc = function(value)
- SummonAssistant.Saved.KeyBindingLocation = SummonAssistant:HotKeyGetLocationValue(value)
- SummonAssistant:RestorePanel()
+ baseModule.Saved.KeyBindingLocation = baseModule:HotKeyGetLocationValue(value)
+ baseModule:RestorePanel()
end,
width = "half"
}
@@ -222,14 +222,14 @@ function SummonAssistant:CreateSettingsWindow()
name = "Button background Color",
tooltip = "Changes the background color of the buttons.",
default = function()
- return SummonAssistant.Default.CenterColor
+ return baseModule.Default.CenterColor
end,
getFunc = function()
- return SummonAssistant.Saved.CenterColor.r, SummonAssistant.Saved.CenterColor.g, SummonAssistant.Saved.CenterColor.b, SummonAssistant.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)
- SummonAssistant.Saved.CenterColor = {r = r, g = g, b = b, a = a}
- SummonAssistant:RestorePanel()
+ baseModule.Saved.CenterColor = {r = r, g = g, b = b, a = a}
+ baseModule:RestorePanel()
end,
width = "half"
},
@@ -238,14 +238,14 @@ function SummonAssistant:CreateSettingsWindow()
name = "Button edge Color",
tooltip = "Changes the edgecolor of the buttons.",
default = function()
- return SummonAssistant.Default.EdgeColor
+ return baseModule.Default.EdgeColor
end,
getFunc = function()
- return SummonAssistant.Saved.EdgeColor.r, SummonAssistant.Saved.EdgeColor.g, SummonAssistant.Saved.EdgeColor.b, SummonAssistant.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)
- SummonAssistant.Saved.EdgeColor = {r = r, g = g, b = b, a = a}
- SummonAssistant:RestorePanel()
+ baseModule.Saved.EdgeColor = {r = r, g = g, b = b, a = a}
+ baseModule:RestorePanel()
end,
width = "half"
},
@@ -254,28 +254,28 @@ function SummonAssistant:CreateSettingsWindow()
name = "Button highlight Color",
tooltip = "Changes the highlight color of the buttons.",
default = function()
- return SummonAssistant.Default.HighlightColor
+ return baseModule.Default.HighlightColor
end,
getFunc = function()
- return SummonAssistant.Saved.HighlightColor.r, SummonAssistant.Saved.HighlightColor.g, SummonAssistant.Saved.HighlightColor.b, SummonAssistant.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)
- SummonAssistant.Saved.HighlightColor = {r = r, g = g, b = b, a = a}
- SummonAssistant:RestorePanel()
+ baseModule.Saved.HighlightColor = {r = r, g = g, b = b, a = a}
+ baseModule:RestorePanel()
end,
width = "half"
},
[5] = {
type = "colorpicker",
name = "Frame font color",
- default = SummonAssistant.Default.FontColor,
+ default = baseModule.Default.FontColor,
tooltip = "Changes of the frame font color.",
getFunc = function()
- return SummonAssistant.Saved.FontColor.r, SummonAssistant.Saved.FontColor.g, SummonAssistant.Saved.FontColor.b, SummonAssistant.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)
- SummonAssistant.Saved.FontColor = {r = r, g = g, b = b, a = a}
- SummonAssistant:RestorePanel()
+ baseModule.Saved.FontColor = {r = r, g = g, b = b, a = a}
+ baseModule:RestorePanel()
end,
width = "half"
}
@@ -295,13 +295,13 @@ function SummonAssistant:CreateSettingsWindow()
name = "Play hover audio",
tooltip = "When ON hover events on the bar, will play audio.",
default = function()
- return SummonAssistant.Global.IsAudioEnabled
+ return baseModule.Global.IsAudioEnabled
end,
getFunc = function()
- return SummonAssistant.Saved.IsAudioEnabled
+ return baseModule.Saved.IsAudioEnabled
end,
setFunc = function(newValue)
- SummonAssistant.Saved.IsAudioEnabled = newValue
+ baseModule.Saved.IsAudioEnabled = newValue
end
}
}
@@ -315,72 +315,111 @@ function SummonAssistant:CreateSettingsWindow()
type = "checkbox",
name = "Show bar " .. "on main view/hud",
tooltip = "When ON the bar will show the bar " .. "on main view/hud",
- default = SummonAssistant.Default.ShowBarOnHud,
+ default = baseModule.Default.ShowBarOnHud,
getFunc = function()
- return SummonAssistant.Saved.ShowBarOnHud
+ return baseModule.Saved.ShowBarOnHud
end,
setFunc = function(newValue)
- SummonAssistant.Saved.ShowBarOnHud = newValue
- SummonAssistant: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 = SummonAssistant.Default.ShowBarOnHudUI,
+ default = baseModule.Default.ShowBarOnHudUI,
getFunc = function()
- return SummonAssistant.Saved.ShowBarOnHudUI
+ return baseModule.Saved.ShowBarOnHudUI
end,
setFunc = function(newValue)
- SummonAssistant.Saved.ShowBarOnHudUI = newValue
- SummonAssistant: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 = SummonAssistant.Default.ShowBarInMenu,
+ default = baseModule.Default.ShowBarInMenu,
getFunc = function()
- return SummonAssistant.Saved.ShowBarInMenu
+ return baseModule.Saved.ShowBarInMenu
end,
setFunc = function(newValue)
- SummonAssistant.Saved.ShowBarInMenu = newValue
- SummonAssistant: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 = SummonAssistant.Default.ShowBarInInventory,
+ default = baseModule.Default.ShowBarInInventory,
getFunc = function()
- return SummonAssistant.Saved.ShowBarInInventory
+ return baseModule.Saved.ShowBarInInventory
end,
setFunc = function(newValue)
- SummonAssistant.Saved.ShowBarInInventory = newValue
- SummonAssistant: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 = SummonAssistant.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 SummonAssistant.Saved.ShowBarInStore
+ return baseModule.Saved.ShowBarInInteract
end,
setFunc = function(newValue)
- SummonAssistant.Saved.ShowBarInStore = newValue
- SummonAssistant: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(SummonAssistant.OrderedTypes) do
+ for index, _type in ipairs(baseModule.OrderedTypes) do
local line = {
type = "checkbox",
name = "Show " .. _type.name,
@@ -388,15 +427,15 @@ function SummonAssistant:CreateSettingsWindow()
default = not _type.Disabled,
disabled = _type.Disabled,
getFunc = function()
- return SummonAssistant.Saved.ShowAssistants[_type.Id]
+ return baseModule.Saved.ShowAssistants[_type.Id]
end,
setFunc = function(newValue)
- SummonAssistant.Saved.ShowAssistants[_type.Id] = newValue
- SummonAssistant:RestorePanel()
+ baseModule.Saved.ShowAssistants[_type.Id] = newValue
+ baseModule:RestorePanel()
end
}
table.insert(optionsData[4].controls, index + 1, line)
end
- LAM2:RegisterOptionControls(SummonAssistant.Addon.Name, optionsData)
+ LAM2:RegisterOptionControls(baseModule.Addon.Name, optionsData)
end
diff --git a/SummonAssistant_Move.lua b/SummonAssistant_Move.lua
index b80e3ab..301cddb 100644
--- a/SummonAssistant_Move.lua
+++ b/SummonAssistant_Move.lua
@@ -6,22 +6,22 @@ Filename: SummonAssistant_Move.lua
-------------------------------------------------------------------------------------------------
-- VARIABLES --
-------------------------------------------------------------------------------------------------
-local SummonAssistant = SummonAssistant
+local baseModule = SummonAssistant
-------------------------------------------------------------------------------------------------
-- FUNCTIONS --
-- Move frame --
-------------------------------------------------------------------------------------------------
-function SummonAssistant:UpdateMoveFrame()
- local moveFrame = SummonAssistant.MoveFrame
+function baseModule:UpdateMoveFrame()
+ local moveFrame = baseModule.MoveFrame
local onMouseEnter, onMouseExit, onMouseDown, onMouseUp = nil, nil, nil, nil
- if SummonAssistant.Global.IsMoveEnabled then
- moveFrame = SummonAssistant:GetOrCreateMoveFrame()
- onMouseEnter = SummonAssistant.MoveFrameOnEnter
- onMouseExit = SummonAssistant.MoveFrameOnExit
- onMouseDown = SummonAssistant.MoveFrameOnDown
- onMouseUp = SummonAssistant.MoveFrameOnUp
+ if baseModule.Global.IsMoveEnabled then
+ moveFrame = baseModule:GetOrCreateMoveFrame()
+ onMouseEnter = baseModule.MoveFrameOnEnter
+ onMouseExit = baseModule.MoveFrameOnExit
+ onMouseDown = baseModule.MoveFrameOnDown
+ onMouseUp = baseModule.MoveFrameOnUp
end
if moveFrame then
@@ -29,10 +29,10 @@ function SummonAssistant:UpdateMoveFrame()
moveFrame:SetHandler("OnMouseExit", onMouseExit)
moveFrame:SetHandler("OnMouseDown", onMouseDown)
moveFrame:SetHandler("OnMouseUp", onMouseUp)
- moveFrame:SetHidden(not SummonAssistant.Global.IsMoveEnabled)
- moveFrame.overlay:SetHidden(not SummonAssistant.Global.IsMoveEnabled)
- moveFrame.labelCenter:SetHidden(not SummonAssistant.Global.IsMoveEnabled)
- moveFrame.labelTopLeft:SetHidden(not SummonAssistant.Global.IsMoveEnabled)
+ moveFrame:SetHidden(not baseModule.Global.IsMoveEnabled)
+ moveFrame.overlay:SetHidden(not baseModule.Global.IsMoveEnabled)
+ moveFrame.labelCenter:SetHidden(not baseModule.Global.IsMoveEnabled)
+ moveFrame.labelTopLeft:SetHidden(not baseModule.Global.IsMoveEnabled)
moveFrame.MoveFrameUpdateText(moveFrame)
moveFrame.MoveFrameUpdateColor(moveFrame)
moveFrame.MoveFrameAnchorToTarget(moveFrame, moveFrame.TargetFrame)
@@ -43,20 +43,20 @@ end
-- FUNCTIONS --
-- Move handlers --
-------------------------------------------------------------------------------------------------
-function SummonAssistant:GetOrCreateMoveFrame(show)
- if SummonAssistant.MoveFrame == nil then
- local newMoveFrame = SummonAssistant.WM:CreateControlFromVirtual(nil, GuiRoot, "SummonAssistant_MoveFrame")
+function baseModule:GetOrCreateMoveFrame(show)
+ if baseModule.MoveFrame == nil then
+ local newMoveFrame = baseModule.WM:CreateControlFromVirtual(nil, GuiRoot, "SummonAssistant_MoveFrame")
local targetFrame = SummonAssistant_Frame
--Variable is used to define what savedVariable the Frame refers to.
newMoveFrame.TargetFrame = targetFrame
- newMoveFrame["MoveFrameAnchorToTarget"] = SummonAssistant.MoveFrameAnchorToTarget
- newMoveFrame["MoveFrameGetSnapPosition"] = SummonAssistant.MoveFrameGetSnapPosition
- newMoveFrame["MoveFrameUpdateText"] = SummonAssistant.MoveFrameUpdateText
- newMoveFrame["MoveFrameUpdateColor"] = SummonAssistant.MoveFrameUpdateColor
- newMoveFrame["MoveFrameOnUpdate"] = SummonAssistant.MoveFrameOnUpdate
- newMoveFrame["MoveFrameStorePosition"] = SummonAssistant.MoveFrameStorePosition
+ newMoveFrame["MoveFrameAnchorToTarget"] = baseModule.MoveFrameAnchorToTarget
+ newMoveFrame["MoveFrameGetSnapPosition"] = baseModule.MoveFrameGetSnapPosition
+ newMoveFrame["MoveFrameUpdateText"] = baseModule.MoveFrameUpdateText
+ newMoveFrame["MoveFrameUpdateColor"] = baseModule.MoveFrameUpdateColor
+ newMoveFrame["MoveFrameOnUpdate"] = baseModule.MoveFrameOnUpdate
+ newMoveFrame["MoveFrameStorePosition"] = baseModule.MoveFrameStorePosition
newMoveFrame:SetDimensions(targetFrame:GetWidth(), targetFrame:GetHeight())
newMoveFrame:SetDrawLayer(4)
@@ -66,57 +66,57 @@ function SummonAssistant:GetOrCreateMoveFrame(show)
newMoveFrame:SetClampedToScreen(true)
-- overlay
- newMoveFrame.overlay = SummonAssistant.WM:CreateControl(nil, newMoveFrame, CT_BACKDROP)
+ newMoveFrame.overlay = baseModule.WM:CreateControl(nil, newMoveFrame, CT_BACKDROP)
newMoveFrame.overlay:SetDrawLevel(2)
newMoveFrame.overlay:SetAnchorFill(targetFrame)
newMoveFrame.overlay:SetEdgeTexture("", 8, 1, 0)
-- label
- newMoveFrame.labelCenter = SummonAssistant.WM:CreateControl(nil, newMoveFrame, CT_LABEL)
+ newMoveFrame.labelCenter = baseModule.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 = SummonAssistant.WM:CreateControl(nil, newMoveFrame, CT_LABEL)
+ newMoveFrame.labelTopLeft = baseModule.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)
- SummonAssistant.MoveFrame = newMoveFrame
+ baseModule.MoveFrame = newMoveFrame
end
- return SummonAssistant.MoveFrame
+ return baseModule.MoveFrame
end
-function SummonAssistant.MoveFrameOnEnter(frame)
+function baseModule.MoveFrameOnEnter(frame)
frame.MoveFrameUpdateText(frame, true)
end
-function SummonAssistant.MoveFrameOnExit(frame)
+function baseModule.MoveFrameOnExit(frame)
frame.MoveFrameUpdateText(frame, false)
end
-function SummonAssistant.MoveFrameOnDown(frame)
+function baseModule.MoveFrameOnDown(frame)
frame:SetHandler("OnUpdate", frame.MoveFrameOnUpdate)
end
-function SummonAssistant.MoveFrameOnUp(frame)
+function baseModule.MoveFrameOnUp(frame)
frame.MoveFrameOnUpdate(frame)
frame.MoveFrameUpdateText(frame, false)
frame:SetHandler("OnUpdate", nil)
frame.MoveFrameStorePosition(frame)
end
-function SummonAssistant.MoveFrameOnUpdate(frame)
+function baseModule.MoveFrameOnUpdate(frame)
frame.TargetFrame:ClearAnchors()
- frame.TargetFrame:SetAnchor(TOPLeft, GuiRoot, TOPLeft, SummonAssistant.MoveFrameGetSnapPosition(frame:GetLeft()), SummonAssistant.MoveFrameGetSnapPosition(frame:GetTop()))
+ frame.TargetFrame:SetAnchor(TOPLeft, GuiRoot, TOPLeft, baseModule.MoveFrameGetSnapPosition(frame:GetLeft()), baseModule.MoveFrameGetSnapPosition(frame:GetTop()))
frame.MoveFrameUpdateText(frame, true)
end
-function SummonAssistant.MoveFrameUpdateText(frame, position)
+function baseModule.MoveFrameUpdateText(frame, position)
local labelTextTopLeft = ""
frame.labelCenter:SetText(string.format("%s,%s", frame:GetWidth(), frame:GetHeight()))
@@ -128,25 +128,25 @@ function SummonAssistant.MoveFrameUpdateText(frame, position)
frame.labelTopLeft:SetText(labelTextTopLeft)
end
-function SummonAssistant.MoveFrameGetSnapPosition(value)
- return (zo_round(value / SummonAssistant.Saved.SnapSize) * SummonAssistant.Saved.SnapSize)
+function baseModule.MoveFrameGetSnapPosition(value)
+ return (zo_round(value / baseModule.Saved.SnapSize) * baseModule.Saved.SnapSize)
end
-function SummonAssistant.MoveFrameStorePosition(frame)
- SummonAssistant.Saved.Top = frame.MoveFrameGetSnapPosition(frame:GetTop())
- SummonAssistant.Saved.Left = frame.MoveFrameGetSnapPosition(frame:GetLeft())
+function baseModule.MoveFrameStorePosition(frame)
+ baseModule.Saved.Top = frame.MoveFrameGetSnapPosition(frame:GetTop())
+ baseModule.Saved.Left = frame.MoveFrameGetSnapPosition(frame:GetLeft())
end
-function SummonAssistant.MoveFrameAnchorToTarget(frame, target)
+function baseModule.MoveFrameAnchorToTarget(frame, target)
frame:ClearAnchors()
frame:SetDimensions(target:GetWidth(), target:GetHeight())
frame:SetAnchor(TOPLeft, GuiRoot, TOPLeft, target:GetLeft(), target:GetTop())
end
-function SummonAssistant.MoveFrameUpdateColor(frame)
- local centerColor = SummonAssistant.Saved.CenterColor
- local edgeColor = SummonAssistant.Saved.EdgeColor
- local fontColor = SummonAssistant.Saved.FontColor
+function baseModule.MoveFrameUpdateColor(frame)
+ local centerColor = baseModule.Saved.CenterColor
+ local edgeColor = baseModule.Saved.EdgeColor
+ local fontColor = baseModule.Saved.FontColor
frame.overlay:SetCenterColor(centerColor.r, centerColor.g, centerColor.b, centerColor.a)
frame.overlay:SetEdgeColor(edgeColor.r, edgeColor.g, edgeColor.b, edgeColor.a)