Titan Logo

 Menu

 Developer

TitanVariables.lua


TitanVariables.lua
This file contains the routines to initialize, get, and set the basic data structures used by Titan.
It also sets the global variables and constants used by Titan.

TitanSettings, TitanSkins, ServerTimeOffsets, ServerHourFormat are the structures saved to disk (listed in toc).
TitanSettings: is the table that holds the Titan variables by character and the plugins used by that character.
TitanSkins: is the table that holds the list of Titan and custom skins available to the user. It is assumed that the skins are in the proper folder on the hard drive. Blizzard does not allow addons to access the disk.
ServerTimeOffsets and ServerHourFormat: are the tables that hold the user selected hour offset and display format per realm (server).


Titan bar overview
-- 3 buttons are used to create a Titan bar:
-- the 'display' button,
-- the 'hider',
-- and the 'auto hide' plugin.
-- The display is where the plugins are displayed.
-- The hider is used if auto hide is requested. This button will cause the display to show when the mouse is enters.
-- The auto hide is the plugin that shows the auto hide 'pin'.


TitanBarOrder table overview
The values must match the 'name' in the TitanBarData table!!!
The values specify the order the options should be ordered in the options pulldown.


TitanBarData table.
The index must match the 'button' names in the TitanPanel.xml!!!
The table holds:
the name of each Titan bar (in the index)
the short name of the bar
whether the bar is on top or bottom
the order they should be in top to bottom
show / hide give the values for the cooresponding SetPoint

The short name is used to build names of the various saved variables, frames, and buttons used by Titan.


AutoHideData table.
The index must match the hider 'button' names in the TitanPanel.xml!!!
The table holds:
the name of each hider bar (in the index)
the short name of the hider bar
whether the hider bar is on top or bottom


Titan plugin registration tables
TitanPluginToBeRegistered table holds each plugin that is requesting to be a plugin.
TitanPluginToBeRegisteredNum is the number of plugins that have requested.
Each plugin in the table will be updated with the status of the registration and will be available in the Titan Attempted option.


TitanPluginExtras table
This table holds the plugin data for plugins that are in saved variables but not loaded on the current character.
TitanPluginExtrasNum is the number of plugins not loaded.


TITAN_PANEL_SAVED_VARIABLES table
Holds the Titan Panel Default SavedVars.


TITAN_ALL_SAVED_VARIABLES table
Holds the Titan Panel Global SavedVars.


TitanRegisterExtra
Add the saved variable data of an unloaded plugin to the 'extra' list in case the user wants to delete the data via Titan Extras option.

Inputs
id - the name of the plugin (string)

Outputs
None


TitanVariables_InitPlayerSettings
Init the profile settings. It is assumed this is a wipe of the given profile.

Inputs
profile - string name of the profile

Outputs
None

Notes
- These will be saved on exit or reload.


TitanVariables_SyncRegisterSavedVariables
Helper routine to sync two sets of toon data - Titan settings and loaded plugins.

Inputs
registeredVariables - current loaded data (destination)
savedVariables - data to compare with (source)

Outputs
None


TitanVariables_PluginSettingsReset
Give the curent profile the default plugins - if they are registered.

Inputs
None

Outputs
None

Notes
- It is assumed this is a plugin wipe of the given profile.
- These will be saved on exit or reload.


TitanVariables_PluginSettingsReset
Give the curent profile the default plugins - if they are registered.

Inputs
None

Outputs
None

Notes
- It is assumed this is a plugin wipe of the given profile.
- These will be saved on exit or reload.


TitanVariables_SyncSkins
Routine to sync two sets of skins data - Titan defaults and Titan saved vars.

Inputs
None

Outputs
None

Notes
- It is assumed that the list in Titan defaults or as input from the user are in the Titan skins folder. Blizz does not allow LUA to read the hard drive directly.


TitanVariables_SyncPanelSettings
Routine to sync Titan settings and Titan skins - defaults to saved vars.

Inputs
None

Outputs
None


Set_Timers
Routine to reset / sync Titan settings.

Inputs
None

Outputs
None


TitanVariables_SyncPluginSettings
Routine to sync plugin datas - current loaded (lua file) to any plugin saved vars (last save to disk).

Inputs
None

Outputs
None


TitanVariables_ExtraPluginSettings
Routine to mark plugin data that is not loaded (no lua file) but has plugin saved vars (last save to disk).

Inputs
None

Outputs
None

Notes
This data is made available in case the user wants to delete the data via Titan Extras option.


TitanVariables_InitTitanSettings
Ensure TitanSettings (one of the saved vars in the toc) exists and set the Titan version.

Inputs
None

Outputs
None

Notes
- Called when Titan is loaded (ADDON_LOADED event)


Detailed_settings_reset
Reset the Titan settings, the plugin settings, the 'extras' data, and the Titan timer table.

Inputs
profile - the toon to use (string)

Outputs
None

Notes
- Called when the user does a Titan reset or the profile does not exist.


Detailed_settings_init
Init the Titan settings, the plugin settings, the 'extras' data, and the Titan timer table.

Inputs
profile - the toon to use (string)

Outputs
None

Notes
- Called at PLAYER_ENTERING_WORLD event after we know Titan has registered plugins.


TitanVariables_Detailed_settings_use
Use the Titan settings, the plugin settings, the 'extras' data of the given profile.

Inputs
profile - the toon to use (string)

Outputs
None

Notes
- Called at PLAYER_ENTERING_WORLD event after we know Titan has registered plugins.


TitanGetVar
Get the value of the requested plugin variable.

Inputs
id - the plugin name (string)
var - the name (string) of the variable

Outputs
None

Notes
- 'var' is from the plugin "button".registry.savedVariables table as created in the plugin lua.


TitanVarExists
Determine if requested plugin variable exists.

Inputs
id - the plugin name (string)
var - the name (string) of the variable

Outputs
None

Notes
- 'var' is from the plugin "button".registry.savedVariables table as created in the plugin lua.
- This checks existence NOT false!


TitanSetVar
Get the value of the requested plugin variable to the given value.

Inputs
id - the plugin name (string)
var - the name (string) of the variable
value - new value of var

Outputs
None

Notes
- 'var' is from the plugin "button".registry.savedVariables table as created in the plugin lua.


TitanToggleVar
Toggle the value of the requested plugin variable. This assumes var value represents a boolean

Inputs
id - the plugin name (string)
var - the name (string) of the variable

Outputs
None

Notes
- Boolean in this case could be true / false or non zero / zero or nil.


TitanPanelGetVar
Get the value of the requested Titan variable.

Inputs
var - the name (string) of the variable

Outputs
value of the requested Titan variable

Notes
- 'var' is from the TitanPanelSettings[var].


TitanPanelSetVar
Set the value of the requested Titan variable.

Inputs
var - the name (string) of the variable
value - new value of var

Outputs
None

Notes
- 'var' is from the TitanPanelSettings[var].


TitanPanelToggleVar
Toggle the value of the requested Titan variable. This assumes var value represents a boolean

Inputs
var - the name (string) of the variable

Outputs
None

Notes
- Boolean in this case could be true / false or non zero / zero or nil.


TitanAllGetVar
Get the value of the requested Titan global variable.

Inputs
var - the name (string) of the variable

Outputs
None

Notes
- 'var' is from the TitanAll[var].


TitanAllSetVar
Set the value of the requested Titan global variable.

Inputs
var - the name (string) of the variable
value - new value of var

Outputs
None

Notes
- 'var' is from the TitanPanelSettings[var].


TitanAllToggleVar
Toggle the value of the requested Titan global variable. This assumes var value represents a boolean

Inputs
var - the name (string) of the variable

Outputs
None

Notes
- Boolean in this case could be true / false or non zero / zero or nil.


TitanVariables_GetPanelStrata
Return the strata and the next highest strata of the given value

Inputs
value - the name (string) of the strata to look up

Outputs
string - Next highest strata
string - passed in strata


TitanVariables_SetPanelStrata
Set the Titan bars to the given strata and the plugins to the next highest strata.

Inputs
value - strata name (string)

Outputs
None


TitanVariables_UseSettings
Set the Titan variables and plugin variables to the passed in profile.

Inputs
profile - profile to use for this toon : <name>@<server>

Outputs
None

Notes
- Called from the Titan right click menu
- profile is compared as 'lower' so the case of profile does not matter