Go to most recent revision | Compare with Previous | Blame | View Log
--[[
Addon: Taos Group Ultimate
Author: TProg Taonnor
Created by @Taonnor
]]--
--[[
Global variables
]]--
local LOG_ACTIVE = false
--[[
Class SettingsHandler
]]--
SettingsHandler = {}
SettingsHandler.__index = SettingsHandler
--[[
Class Members
]]--
SettingsHandler.SettingsName = "TaosGroupUltimateSettings"
SettingsHandler.SavedVariables = nil
SettingsHandler.Default =
{
["PosX"] = 0,
["PosY"] = 0,
["SelectorPosX"] = 0,
["SelectorPosY"] = 0,
["Movable"] = true,
["Style"] = 1,
["StaticUltimateID"] = 29861,
["SwimlaneUltimateGroupIds"] =
{
[1] = 29861,
[2] = 27413,
[3] = 86536,
[4] = 86112,
[5] = 46537,
[6] = 46622,
},
}
--[[
Class Members
]]--
--[[
Sets SetStyleSettings and fires TGU-StyleChanged callbacks
]]--
function SettingsHandler.SetStyleSettings(style)
if (LOG_ACTIVE) then
logTrace("SettingsHandler.SetStyleSettings")
logDebug("style: " .. tostring(style))
end
local numberStyle = tonumber(style)
if (numberStyle == 1 or numberStyle == 2 or numberStyle == 3) then
SettingsHandler.SavedVariables.Style = numberStyle
CALLBACK_MANAGER:FireCallbacks("TGU-StyleChanged")
else
logError("SettingsHandler.SetStyleSettings, invalid style " .. tostring(style))
end
end
--[[
Sets MovableSettings and fires TGU-MovableChanged callbacks
]]--
function SettingsHandler.SetStaticUltimateIDSettings(staticUltimateID)
if (LOG_ACTIVE) then
logTrace("SettingsHandler.StaticUltimateIDSettings")
logDebug("staticUltimateID: " .. tostring(staticUltimateID))
end
SettingsHandler.SavedVariables.StaticUltimateID = staticUltimateID
CALLBACK_MANAGER:FireCallbacks("TGU-StaticUltimateIDChanged", staticUltimateID)
end
--[[
Sets MovableSettings and fires TGU-MovableChanged callbacks
]]--
function SettingsHandler.SetSwimlaneUltimateGroupIdSettings(swimlane, ultimateGroup)
if (LOG_ACTIVE) then
logTrace("SettingsHandler.StaticUltimateIDSettings")
logDebug("swimlane: " .. tostring(swimlane),
"ultimateGroup: " .. tostring(ultimateGroup))
end
SettingsHandler.SavedVariables.SwimlaneUltimateGroupIds[swimlane] = ultimateGroup.GroupAbilityId
CALLBACK_MANAGER:FireCallbacks("TGU-SwimlaneUltimateGroupIdChanged", swimlane, ultimateGroup)
end
--[[
Sets MovableSettings and fires TGU-MovableChanged callbacks
]]--
function SettingsHandler.SetMovableSettings(movable)
if (LOG_ACTIVE) then
logTrace("SettingsHandler.SetMovableSettings")
logDebug("movable: " .. tostring(movable))
end
SettingsHandler.SavedVariables.Movable = movable
CALLBACK_MANAGER:FireCallbacks("TGU-MovableChanged", movable)
end
--[[
Gets SimpleList visible in connection with selected style
]]--
function SettingsHandler.IsSimpleListVisible()
if (LOG_ACTIVE) then logTrace("SettingsHandler.IsSimpleListVisible") end
if (SettingsHandler.SavedVariables ~= nil) then
if (LOG_ACTIVE) then logDebug(tostring(SettingsHandler.SavedVariables.Style)) end
return tonumber(SettingsHandler.SavedVariables.Style) == 1
else
logError("SettingsHandler.SavedVariables is nil")
return false
end
end
--[[
Gets SwimlaneList visible in connection with selected style
]]--
function SettingsHandler.IsSwimlaneListVisible()
if (LOG_ACTIVE) then logTrace("SettingsHandler.IsSwimlaneListVisible") end
if (SettingsHandler.SavedVariables ~= nil) then
if (LOG_ACTIVE) then logDebug(tostring(SettingsHandler.SavedVariables.Style)) end
return tonumber(SettingsHandler.SavedVariables.Style) == 2
else
logError("SettingsHandler.SavedVariables is nil")
return false
end
end
--[[
Gets CompactSwimlaneList visible in connection with selected style
]]--
function SettingsHandler.IsCompactSwimlaneListVisible()
if (LOG_ACTIVE) then logTrace("SettingsHandler.IsCompactSwimlaneListVisible") end
if (SettingsHandler.SavedVariables ~= nil) then
if (LOG_ACTIVE) then logDebug(tostring(SettingsHandler.SavedVariables.Style)) end
return tonumber(SettingsHandler.SavedVariables.Style) == 3
else
logError("SettingsHandler.SavedVariables is nil")
return false
end
end
--[[
Initialize loads SavedVariables
]]--
function SettingsHandler.Initialize()
if (LOG_ACTIVE) then logTrace("SettingsHandler.Initialize") end
SettingsHandler.SavedVariables = ZO_SavedVars:NewAccountWide(SettingsHandler.SettingsName, 1 , nil, SettingsHandler.Default)
end