-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSlashCommands.lua
152 lines (133 loc) · 7.97 KB
/
SlashCommands.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
--- @class (partial) CustomAbilityIcons
local CustomAbilityIcons = CustomAbilityIcons
--- Creates slash commands to be used for debugging.
function CustomAbilityIcons.CreateSlashCommands()
CustomAbilityIcons.CreateGetAbilityDetailsCommand()
CustomAbilityIcons.CreateGetIconsCommand()
CustomAbilityIcons.CreteGetSavedVarsCommand()
CustomAbilityIcons.CreateSetOptionGlobalIconsCommand()
CustomAbilityIcons.CreateSetOptionSkillStyleIconsCommand()
CustomAbilityIcons.CreateSetOptionCustomIconsCommand()
CustomAbilityIcons.CreateSetOptionMismatchedIconsCommand()
end
--- Creates the /getabilitydetails command, to retrieve details about the ability found at a specified slot.
function CustomAbilityIcons.CreateGetAbilityDetailsCommand()
SLASH_COMMANDS["/getabilitydetails"] = function(strInput)
local params = {}
for word in strInput:gmatch("%w+") do table.insert(params, word) end
local skillIndex = params[1]
local inactive = params[2] or "0"
local hotbarCategory = GetActiveHotbarCategory()
if inactive == "1" then
hotbarCategory = hotbarCategory == HOTBAR_CATEGORY_PRIMARY
and HOTBAR_CATEGORY_BACKUP or HOTBAR_CATEGORY_PRIMARY
end
local baseAbilityId = CustomAbilityIcons.GetBaseAbilityId(skillIndex, hotbarCategory)
CHAT_SYSTEM:AddMessage("Base Ability ID: " .. (baseAbilityId or -1))
local abilityId = CustomAbilityIcons.GetAbilityId(skillIndex, hotbarCategory)
CHAT_SYSTEM:AddMessage("Ability ID: " .. (abilityId or -1))
local primaryScriptId, secondaryScriptId, tertiaryScriptId = GetCraftedAbilityActiveScriptIds(abilityId)
local scriptLink = ""
if primaryScriptId ~= 0 or secondaryScriptId ~= 0 or tertiaryScriptId ~= 0 then
CHAT_SYSTEM:AddMessage("Focus Script: " .. GetCraftedAbilityScriptDisplayName(primaryScriptId) .. "(" .. primaryScriptId .. ")")
CHAT_SYSTEM:AddMessage("Signature Script: " .. GetCraftedAbilityScriptDisplayName(secondaryScriptId) .. "(" .. secondaryScriptId .. ")")
CHAT_SYSTEM:AddMessage("Affix Script: " .. GetCraftedAbilityScriptDisplayName(tertiaryScriptId) .. "(" .. tertiaryScriptId .. ")")
if primaryScriptId ~= 0 and secondaryScriptId ~= 0 and tertiaryScriptId ~= 0 then
scriptLink = ZO_LinkHandler_CreateChatLink(GetCraftedAbilityLink, abilityId, primaryScriptId, secondaryScriptId, tertiaryScriptId)
CHAT_SYSTEM:AddMessage("Scribed Skill Link: " .. scriptLink)
end
end
end
end
--- Creates the /geticons command, to retrieve available icons for the skill found at the specified slot.
function CustomAbilityIcons.CreateGetIconsCommand()
SLASH_COMMANDS["/geticons"] = function(strInput)
local params = {}
for word in strInput:gmatch("%w+") do table.insert(params, word) end
local skillIndex = params[1]
local inactive = params[2] or "0"
local hotbarCategory = GetActiveHotbarCategory()
if inactive == "1" then
hotbarCategory = hotbarCategory == HOTBAR_CATEGORY_PRIMARY
and HOTBAR_CATEGORY_BACKUP or HOTBAR_CATEGORY_PRIMARY
end
local collectibleIcon = CustomAbilityIcons.GetSkillStyleIcon(skillIndex, hotbarCategory)
CHAT_SYSTEM:AddMessage("Collectible Icon: " .. (collectibleIcon or "nil"))
local customIcon = CustomAbilityIcons.GetCustomAbilityIcon(skillIndex, hotbarCategory)
CHAT_SYSTEM:AddMessage("Custom Icon: " .. (customIcon or "nil"))
local abilityIcon = CustomAbilityIcons.GetDefaultAbilityIcon(skillIndex, hotbarCategory)
CHAT_SYSTEM:AddMessage("Default Icon: " .. (abilityIcon or "nil"))
end
end
--- Creates the /getsavedvars command, to check the contents of the addon's saved variables.
function CustomAbilityIcons.CreteGetSavedVarsCommand()
SLASH_COMMANDS["/getsavedvars"] = function ()
CHAT_SYSTEM:AddMessage("----------------------------------")
local sv1 = CustomAbilityIcons_SavedVariables["Default"][GetDisplayName()]["$AccountWide"]
CHAT_SYSTEM:AddMessage("CustomAbilityIcons_SavedVariables:")
for key, value in pairs(sv1) do
CHAT_SYSTEM:AddMessage("[" .. key .. "] -> " .. tostring(value))
end
CHAT_SYSTEM:AddMessage("----------------------------------")
local sv2 = CustomAbilityIcons_Globals["Default"][GetDisplayName()]["$AccountWide"]["global_settings"]
CHAT_SYSTEM:AddMessage("CustomAbilityIcons_Globals:")
for key, value in pairs(sv2) do
CHAT_SYSTEM:AddMessage("[" .. key .. "] -> " .. tostring(value))
end
CHAT_SYSTEM:AddMessage("----------------------------------")
local sv3 = CustomAbilityIcons_Settings["Default"][GetDisplayName()][GetCurrentCharacterId()]["character_settings"]
CHAT_SYSTEM:AddMessage("CustomAbilityIcons_Settings:")
for key, value in pairs(sv3) do
CHAT_SYSTEM:AddMessage("[" .. key .. "] -> " .. tostring(value))
end
CHAT_SYSTEM:AddMessage("----------------------------------")
end
end
--- Creates the /setoptionglobalicons command, to change the display setting for global (Account Wide) Icons
function CustomAbilityIcons.CreateSetOptionGlobalIconsCommand()
SLASH_COMMANDS["/setoptionglobalicons"] = function(option)
if string.lower(option) == "false" or option == "0" or string.lower(option) == "off" then
CustomAbilityIcons.SetOptionGlobalIcons(false)
CHAT_SYSTEM:AddMessage("Glocal (Account Wide) Icons are now OFF")
elseif string.lower(option) == "true" or option == "1" or string.lower(option) == "on" then
CustomAbilityIcons.SetOptionGlobalIcons(true)
CHAT_SYSTEM:AddMessage("Glocal (Account Wide) Icons are now ON")
end
end
end
--- Creates the /setoptionskillstyleicons command, to change the display setting for Skill Style Icons
function CustomAbilityIcons.CreateSetOptionSkillStyleIconsCommand()
SLASH_COMMANDS["/setoptionskillstyleicons"] = function(option)
if string.lower(option) == "false" or option == "0" or string.lower(option) == "off" then
CustomAbilityIcons.SetOptionSkillStyleIcons(false)
CHAT_SYSTEM:AddMessage("Skill Style Icons are now OFF")
elseif string.lower(option) == "true" or option == "1" or string.lower(option) == "on" then
CustomAbilityIcons.SetOptionSkillStyleIcons(true)
CHAT_SYSTEM:AddMessage("Skill Style Icons are now ON")
end
end
end
--- Creates the /setoptioncustomicons command, to change the display setting for Custom Scribed Ability Icons
function CustomAbilityIcons.CreateSetOptionCustomIconsCommand()
SLASH_COMMANDS["/setoptioncustomicons"] = function(option)
if string.lower(option) == "false" or option == "0" or string.lower(option) == "off" then
CustomAbilityIcons.SetOptionCustomIcons(false)
CHAT_SYSTEM:AddMessage("Custom Scribed Ability Icons are now OFF")
elseif string.lower(option) == "true" or option == "1" or string.lower(option) == "on" then
CustomAbilityIcons.SetOptionCustomIcons(true)
CHAT_SYSTEM:AddMessage("Custom Scribed Ability Icons are now ON")
end
end
end
--- Creates the /setoptionmismatchedicons command, to change the display setting for Mismatched Skill Icon replacements
function CustomAbilityIcons.CreateSetOptionMismatchedIconsCommand()
SLASH_COMMANDS["/setoptionmismatchedicons"] = function(option)
if string.lower(option) == "false" or option == "0" or string.lower(option) == "off" then
CustomAbilityIcons.SetOptionMismatchedIcons(false)
CHAT_SYSTEM:AddMessage("Mismatched Skill Icon replacements are now OFF")
elseif string.lower(option) == "true" or option == "1" or string.lower(option) == "on" then
CustomAbilityIcons.SetOptionMismatchedIcons(true)
CHAT_SYSTEM:AddMessage("Mismatched Skill Icon replacements are now ON")
end
end
end