diff --git a/Bindings/Bindings.xml b/Bindings/Bindings.xml index 678c39b..270b77d 100644 --- a/Bindings/Bindings.xml +++ b/Bindings/Bindings.xml @@ -1,8 +1,8 @@ <Bindings> <Layer name="SI_KEYBINDINGS_LAYER_GENERAL"> <Category name="Summon Assistant"> - <Action name="SummonAssistant_Assistant_Fence"><Down>UseCollectible(300)</Down></Action> <Action name="SummonAssistant_Assistant_Banker"><Down>UseCollectible(267)</Down></Action> + <Action name="SummonAssistant_Assistant_Fence"><Down>UseCollectible(300)</Down></Action> <Action name="SummonAssistant_Assistant_Vendor"><Down>UseCollectible(301)</Down></Action> </Category> </Layer> diff --git a/Changelog b/Changelog index 85fe1e1..1208d5f 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,11 @@ ------------------------------------------------------------------------------- Summon Assistant ------------------------------------------------------------------------------- +Version 1.2.2 (17-12-2017) +- Added functionality to change the orientation the icon bar (Horizontal/Vertical) +- Fixed issue where the default color would not be set properly +- Code cleanup: Persisted assistant order by collectionId. + Version 1.2.1 (09-12-2017) - Updated APIVersion to 100021. - Updated to LibAddonMenu-2.0 r25. diff --git a/SummonAssistant.lua b/SummonAssistant.lua index 5da9ed4..966beeb 100644 --- a/SummonAssistant.lua +++ b/SummonAssistant.lua @@ -1,7 +1,6 @@ --[[ Author: Jarth Filename: SummonAssistant.lua -Version: V1.2.1 ]]-- ------------------------------------------------------------------------------------------------- @@ -14,7 +13,7 @@ local LAM2 = LibStub:GetLibrary("LibAddonMenu-2.0") ------------------------------------------------------------------------------------------------- local ADDON_NAME = "SummonAssistant" local ADDON_VERSION = 1.2 -local ADDON_MINOR_VERSION = 1 +local ADDON_MINOR_VERSION = 2 local ADDON_AUTHOR = "Jarth" local ADDON_WEBSITE = "" local SummonAssistant = {} -- this may seem odd, but it sets the access level for "SummonAssistant" @@ -25,12 +24,13 @@ SummonAssistant.SA_Button = {} SummonAssistant.Default = { left = CENTER, top = CENTER, - centerColor = { r = 0.88, g = 0.88, b = 0.88, a = 0.4 }, -- {red, green, blue, alpha} - edgeColor = { r = 0.57, g = 0.57, b = 0.57, a = 0.6 }, -- {red, green, blue, alpha} - showFence = IsCollectibleUnlocked(300), + centerColor = { [1] = 0.88, [2] = 0.88, [3] = 0.88, [4] = 0.4 }, -- {red, green, blue, alpha} + edgeColor = { [1] = 0.57, [2] = 0.57, [3] = 0.57, [4] = 0.6 }, -- {red, green, blue, alpha} showBanker = IsCollectibleUnlocked(267), + showFence = IsCollectibleUnlocked(300), showVendor = IsCollectibleUnlocked(301), useAccountSettings = true, + horizontalOrientation = true } ------------------------------------------------------------------------------------------------- @@ -64,7 +64,11 @@ function SummonAssistant.initializeButtons() SummonAssistant.setupButton(i, SummonAssistant.SA_Button[i], id, enabled) SummonAssistant.SA_Button[i]:SetHidden(false) SummonAssistant.SA_Button[i]:ClearAnchors() - SummonAssistant.SA_Button[i]:SetAnchor(TOPLEFT, SA_FrameBackdrop, TOPLEFT, 10+60*(position), 10) + if SummonAssistant.savedVariables.horizontalOrientation then + SummonAssistant.SA_Button[i]:SetAnchor(TOPLEFT, SA_FrameBackdrop, TOPLEFT, 10+60*(position), 10) + else + SummonAssistant.SA_Button[i]:SetAnchor(TOPLEFT, SA_FrameBackdrop, TOPLEFT, 10, 10+60*(position)) + end position = position + 1 else if SummonAssistant.SA_Button[i] == nil then @@ -76,19 +80,28 @@ function SummonAssistant.initializeButtons() end function SummonAssistant.setButtonFrameWidth() - local saWidth = 0 - if IsCollectibleUnlocked(300) and SummonAssistant.savedVariables.showFence then saWidth = saWidth + 60 end - if IsCollectibleUnlocked(267) and SummonAssistant.savedVariables.showBanker then saWidth = saWidth + 60 end - if IsCollectibleUnlocked(301) and SummonAssistant.savedVariables.showVendor then saWidth = saWidth + 60 end - SA_Frame:SetHidden(saWidth == 0) - SA_Frame:SetWidth(saWidth) - SA_FrameBackdrop:SetWidth(saWidth) + local saSize = 0 + if IsCollectibleUnlocked(267) and SummonAssistant.savedVariables.showBanker then saSize = saSize + 60 end + if IsCollectibleUnlocked(300) and SummonAssistant.savedVariables.showFence then saSize = saSize + 60 end + if IsCollectibleUnlocked(301) and SummonAssistant.savedVariables.showVendor then saSize = saSize + 60 end + SA_Frame:SetHidden(saSize == 0) + if SummonAssistant.savedVariables.horizontalOrientation then + SA_Frame:SetWidth(saSize) + SA_FrameBackdrop:SetWidth(saSize) + SA_Frame:SetHeight(60) + SA_FrameBackdrop:SetHeight(60) + else + SA_Frame:SetWidth(60) + SA_FrameBackdrop:SetWidth(60) + SA_Frame:SetHeight(saSize) + SA_FrameBackdrop:SetHeight(saSize) + end end function SummonAssistant.isCollectibleEnabled(id) local result = true - if id == 300 and not SummonAssistant.savedVariables.showFence then result = false end if id == 267 and not SummonAssistant.savedVariables.showBanker then result = false end + if id == 300 and not SummonAssistant.savedVariables.showFence then result = false end if id == 301 and not SummonAssistant.savedVariables.showVendor then result = false end return result end @@ -98,14 +111,14 @@ function SummonAssistant.setupButton(i, SA_Button, id, enabled) if SA_ButtonTexture == nil then else if enabled then - if id == 300 then SA_ButtonTexture:SetTexture("/esoui/art/icons/assistant_fence_01.dds") - elseif id == 267 then SA_ButtonTexture:SetTexture("/esoui/art/icons/assistant_banker_01.dds") + if id == 267 then SA_ButtonTexture:SetTexture("/esoui/art/icons/assistant_banker_01.dds") + elseif id == 300 then SA_ButtonTexture:SetTexture("/esoui/art/icons/assistant_fence_01.dds") elseif id == 301 then SA_ButtonTexture:SetTexture("/esoui/art/icons/assistant_vendor_01.dds") end SA_Button:SetHandler("OnClicked", function(self) SummonAssistant.saClicked(SA_Button:GetId()) end) else - if id == 300 then SA_ButtonTexture:SetTexture("/esoui/art/icons/assistant_fence_01_empty.dds") - elseif id == 267 then SA_ButtonTexture:SetTexture("/esoui/art/icons/assistant_banker_01-empty.dds") + if id == 267 then SA_ButtonTexture:SetTexture("/esoui/art/icons/assistant_banker_01-empty.dds") + elseif id == 300 then SA_ButtonTexture:SetTexture("/esoui/art/icons/assistant_fence_01_empty.dds") elseif id == 301 then SA_ButtonTexture:SetTexture("/esoui/art/icons/assistant_vendor_01_empty.dds") else SA_Button:SetAlpha(0) @@ -122,12 +135,12 @@ function SummonAssistant.saRestorePosition() end function SummonAssistant.createHotkeySelections() - if IsCollectibleUnlocked(300) then - ZO_CreateStringId('SI_BINDING_NAME_SummonAssistant_Assistant_Fence', 'Fence') - end if IsCollectibleUnlocked(267) then ZO_CreateStringId('SI_BINDING_NAME_SummonAssistant_Assistant_Banker', 'Banker') end + if IsCollectibleUnlocked(300) then + ZO_CreateStringId('SI_BINDING_NAME_SummonAssistant_Assistant_Fence', 'Fence') + end if IsCollectibleUnlocked(301) then ZO_CreateStringId('SI_BINDING_NAME_SummonAssistant_Assistant_Vendor', 'Vendor') end @@ -169,7 +182,7 @@ function SummonAssistant.CreateSettingsWindow() registerForRefresh = true, registerForDefaults = true, } - local cntrlOptionsPanel = LAM2:RegisterAddonPanel("SummonAssistant", panelData) + local cntrlOptionsPanel = LAM2:RegisterAddonPanel(SummonAssistant.name, panelData) local optionsData = { [1] = { @@ -199,9 +212,21 @@ function SummonAssistant.CreateSettingsWindow() SA_FrameBackdrop:SetCenterColor(unpack(SummonAssistant.savedVariables.centerColor)) SA_FrameBackdrop:SetEdgeColor(unpack(SummonAssistant.savedVariables.edgeColor)) SummonAssistant.RestorePanel() - end, + end }, [4] = { + type = "checkbox", + name = "Bar orientation horizontal", + tooltip = "When ON the bar will orientate horizontally.", + default = SummonAssistant.Default.horizontalOrientation, + getFunc = function() return SummonAssistant.savedVariables.horizontalOrientation end, + setFunc = function(newValue) + --Apply value to existing variable + SummonAssistant.savedVariables.horizontalOrientation = newValue; + SummonAssistant.RestorePanel() + end + }, + [5] = { type = "submenu", name = "Colors", tooltip = "Allows you to change colors.", @@ -219,8 +244,8 @@ function SummonAssistant.CreateSettingsWindow() setFunc = function(r,g,b,a) SummonAssistant.savedVariables.centerColor = {r,g,b,a} SA_FrameBackdrop:SetCenterColor(r,g,b,a) - end, - width = "half" + end, + width = "half" }, [3] = { type = "colorpicker", @@ -236,7 +261,7 @@ function SummonAssistant.CreateSettingsWindow() } }, }, - [5] = { + [6] = { type = "submenu", name = "Visibility", tooltip = "Allows you to choose what assistant buttons you wants to see.", @@ -247,18 +272,6 @@ function SummonAssistant.CreateSettingsWindow() }, [2] = { type = "checkbox", - name = "Show fence", - tooltip = "When ON the fence button will be visible. When OFF the fence button will not be visible (disabled if locked for the account).", - default = SummonAssistant.Default.showFence, - disabled = not IsCollectibleUnlocked(300), - getFunc = function() return SummonAssistant.savedVariables.showFence end, - setFunc = function(newValue) - SummonAssistant.savedVariables.showFence = newValue - SummonAssistant.RestorePanel() - end, - }, - [3] = { - type = "checkbox", name = "Show banker", tooltip = "When ON the banker button will be visible. When OFF the banker button will not be visible (disabled if locked for the account).", default = SummonAssistant.Default.showBanker, @@ -267,7 +280,19 @@ function SummonAssistant.CreateSettingsWindow() setFunc = function(newValue) SummonAssistant.savedVariables.showBanker = newValue SummonAssistant.RestorePanel() - end, + end + }, + [3] = { + type = "checkbox", + name = "Show fence", + tooltip = "When ON the fence button will be visible. When OFF the fence button will not be visible (disabled if locked for the account).", + default = SummonAssistant.Default.showFence, + disabled = not IsCollectibleUnlocked(300), + getFunc = function() return SummonAssistant.savedVariables.showFence end, + setFunc = function(newValue) + SummonAssistant.savedVariables.showFence = newValue + SummonAssistant.RestorePanel() + end }, [4] = { type = "checkbox", @@ -279,12 +304,12 @@ function SummonAssistant.CreateSettingsWindow() setFunc = function(newValue) SummonAssistant.savedVariables.showVendor = newValue SummonAssistant.RestorePanel() - end, - }, + end + } } - }, + } } - LAM2:RegisterOptionControls("SummonAssistant", optionsData) + LAM2:RegisterOptionControls(SummonAssistant.name, optionsData) end function SummonAssistant:Initialize() @@ -302,7 +327,7 @@ function SummonAssistant:Initialize() SA_FrameBackdrop:SetCenterColor(unpack(SummonAssistant.savedVariables.centerColor)) SA_FrameBackdrop:SetEdgeColor(unpack(SummonAssistant.savedVariables.edgeColor)) -- ToDo - End. - EVENT_MANAGER:UnregisterForEvent("SummonAssistant", EVENT_ADD_ON_LOADED) + EVENT_MANAGER:UnregisterForEvent(SummonAssistant.name, EVENT_ADD_ON_LOADED) end -- Then we create an event handler function which will be called when the "addon loaded" event @@ -317,6 +342,6 @@ end -- Load Event -- We unregistered this at the end of the loadCC function for optimization. -- Here we register it (after all the functions). --- EVENT_MANAGER:RegisterForEvent("SummonAssistant", EVENT_ADD_ON_LOADED, SummonAssistant.saLoad) +-- EVENT_MANAGER:RegisterForEvent(SummonAssistant.name, EVENT_ADD_ON_LOADED, SummonAssistant.saLoad) EVENT_MANAGER:RegisterForEvent(SummonAssistant.name, EVENT_ADD_ON_LOADED, SummonAssistant.OnAddOnLoaded) -- EVENT_MANAGER:RegisterForEvent("SummonAssistant Click", EVENT_GLOBAL_MOUSE_DOWN, SummonAssistant.saClicked) -- Edit by Mitsarugi, addon wont work without this line of code \ No newline at end of file diff --git a/SummonAssistant.txt b/SummonAssistant.txt index 86fc84c..96f7eb8 100644 --- a/SummonAssistant.txt +++ b/SummonAssistant.txt @@ -6,7 +6,7 @@ ## APIVersion: 100021 ## Title: SummonAssistant -## Version: 1.2.1 +## Version: 1.2.2 ## Author: Jarth ## Description: Summon assistant, by hotkey or button! ##