mirror of
https://forgejo.merr.is/annika/KittenDismount.git
synced 2025-12-13 05:17:43 -05:00
Merge pull request 'settings' (#2) from settings into main
Reviewed-on: https://forgejo.merr.is/annika/KittenDismount/pulls/2
This commit is contained in:
commit
94a5a6d3db
4 changed files with 33 additions and 26 deletions
19
.vscode/settings.json
vendored
19
.vscode/settings.json
vendored
|
|
@ -1,10 +1,21 @@
|
||||||
{
|
{
|
||||||
"Lua.diagnostics.globals": [
|
"Lua.diagnostics.globals": [
|
||||||
"CreateFrame",
|
|
||||||
"C_ChatInfo",
|
|
||||||
"DEFAULT_CHAT_FRAME",
|
"DEFAULT_CHAT_FRAME",
|
||||||
"IsFlying",
|
|
||||||
"Dismount",
|
|
||||||
"Settings"
|
"Settings"
|
||||||
|
],
|
||||||
|
"Lua.runtime.version": "Lua 5.1",
|
||||||
|
"Lua.runtime.builtin": {
|
||||||
|
"basic": "disable",
|
||||||
|
"debug": "disable",
|
||||||
|
"io": "disable",
|
||||||
|
"math": "disable",
|
||||||
|
"os": "disable",
|
||||||
|
"package": "disable",
|
||||||
|
"string": "disable",
|
||||||
|
"table": "disable",
|
||||||
|
"utf8": "disable"
|
||||||
|
},
|
||||||
|
"Lua.workspace.library": [
|
||||||
|
"~/.vscode/extensions/ketho.wow-api/Annotations"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,8 @@ KittenDismount
|
||||||
Author: Anisa of Scarlet Crusade
|
Author: Anisa of Scarlet Crusade
|
||||||
|
|
||||||
Usage: go to Options->AddOns->Kitten Easy Dismount
|
Usage: go to Options->AddOns->Kitten Easy Dismount
|
||||||
]] --
|
]]--
|
||||||
|
|
||||||
KittenDismount = {
|
KittenDismount = {
|
||||||
DefaultSettings = {
|
DefaultSettings = {
|
||||||
surgeForward = true,
|
surgeForward = true,
|
||||||
|
|
@ -47,6 +48,7 @@ end)
|
||||||
local category = Settings.RegisterVerticalLayoutCategory("Kitten Easy Dismount")
|
local category = Settings.RegisterVerticalLayoutCategory("Kitten Easy Dismount")
|
||||||
|
|
||||||
-- Event Handlers
|
-- Event Handlers
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function KittenDismount:UNIT_SPELLCAST_SENT(...)
|
function KittenDismount:UNIT_SPELLCAST_SENT(...)
|
||||||
local unit, target, castGUID, spellID = ...;
|
local unit, target, castGUID, spellID = ...;
|
||||||
if ((not IsFlying()) and KittenDismount.disabledSpells[spellID]) then
|
if ((not IsFlying()) and KittenDismount.disabledSpells[spellID]) then
|
||||||
|
|
@ -55,6 +57,7 @@ function KittenDismount:UNIT_SPELLCAST_SENT(...)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Setup stuff
|
-- Setup stuff
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function KittenDismount:VARIABLES_LOADED()
|
function KittenDismount:VARIABLES_LOADED()
|
||||||
if (KittenDismountData.DataCode ~= self.DataCode) then
|
if (KittenDismountData.DataCode ~= self.DataCode) then
|
||||||
self:SetDefaults()
|
self:SetDefaults()
|
||||||
|
|
@ -74,7 +77,7 @@ function KittenDismount:VARIABLES_LOADED()
|
||||||
local variableKey = "surgeForward"
|
local variableKey = "surgeForward"
|
||||||
local defaultValue = Settings.Default.True
|
local defaultValue = Settings.Default.True
|
||||||
local tooltip = "Automatically dismount when Surge Forward is cast while on the ground."
|
local tooltip = "Automatically dismount when Surge Forward is cast while on the ground."
|
||||||
|
|
||||||
self:RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
self:RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
|
|
@ -83,7 +86,7 @@ function KittenDismount:VARIABLES_LOADED()
|
||||||
local variableKey = "skywardAscent"
|
local variableKey = "skywardAscent"
|
||||||
local defaultValue = Settings.Default.False
|
local defaultValue = Settings.Default.False
|
||||||
local tooltip = "Automatically dismount when Skyward Ascent is cast while on the ground."
|
local tooltip = "Automatically dismount when Skyward Ascent is cast while on the ground."
|
||||||
|
|
||||||
self:RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
self:RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
|
|
@ -92,7 +95,7 @@ function KittenDismount:VARIABLES_LOADED()
|
||||||
local variableKey = "whirlingSurge"
|
local variableKey = "whirlingSurge"
|
||||||
local defaultValue = Settings.Default.True
|
local defaultValue = Settings.Default.True
|
||||||
local tooltip = "Automatically dismount when Whirling Surge is cast while on the ground."
|
local tooltip = "Automatically dismount when Whirling Surge is cast while on the ground."
|
||||||
|
|
||||||
self:RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
self:RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
|
|
@ -101,7 +104,7 @@ function KittenDismount:VARIABLES_LOADED()
|
||||||
local variableKey = "aerielHalt"
|
local variableKey = "aerielHalt"
|
||||||
local defaultValue = Settings.Default.True
|
local defaultValue = Settings.Default.True
|
||||||
local tooltip = "Automatically dismount when Aeriel Halt is cast while on the ground."
|
local tooltip = "Automatically dismount when Aeriel Halt is cast while on the ground."
|
||||||
|
|
||||||
self:RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
self:RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
|
|
@ -110,13 +113,14 @@ function KittenDismount:VARIABLES_LOADED()
|
||||||
local variableKey = "secondWind"
|
local variableKey = "secondWind"
|
||||||
local defaultValue = Settings.Default.False
|
local defaultValue = Settings.Default.False
|
||||||
local tooltip = "Automatically dismount when Second Wind is cast while on the ground."
|
local tooltip = "Automatically dismount when Second Wind is cast while on the ground."
|
||||||
|
|
||||||
self:RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
self:RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
||||||
end
|
end
|
||||||
Settings.RegisterAddOnCategory(category)
|
Settings.RegisterAddOnCategory(category)
|
||||||
self:ActivateMod()
|
self:ActivateMod()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function KittenDismount:SaveSettings()
|
function KittenDismount:SaveSettings()
|
||||||
KittenDismountData.DataCode = KittenDismount.DataCode
|
KittenDismountData.DataCode = KittenDismount.DataCode
|
||||||
KittenDismountData.Active = KittenDismount.Active
|
KittenDismountData.Active = KittenDismount.Active
|
||||||
|
|
@ -126,6 +130,7 @@ function KittenDismount:SaveSettings()
|
||||||
KittenDismountData.arielHalt = KittenDismount.Settings.arielHalt
|
KittenDismountData.arielHalt = KittenDismount.Settings.arielHalt
|
||||||
KittenDismountData.secondWind = KittenDismount.Settings.secondWind
|
KittenDismountData.secondWind = KittenDismount.Settings.secondWind
|
||||||
end
|
end
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function KittenDismount:SetDefaults()
|
function KittenDismount:SetDefaults()
|
||||||
KittenDismount.Active = KittenDismountData.Active
|
KittenDismount.Active = KittenDismountData.Active
|
||||||
KittenDismount.Settings.surgeForward = KittenDismount.DefaultSettings.surgeForward
|
KittenDismount.Settings.surgeForward = KittenDismount.DefaultSettings.surgeForward
|
||||||
|
|
@ -135,6 +140,7 @@ function KittenDismount:SetDefaults()
|
||||||
KittenDismount.Settings.secondWind = KittenDismount.DefaultSettings.secondWind
|
KittenDismount.Settings.secondWind = KittenDismount.DefaultSettings.secondWind
|
||||||
self:SaveSettings()
|
self:SaveSettings()
|
||||||
end
|
end
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function KittenDismount:ActivateMod()
|
function KittenDismount:ActivateMod()
|
||||||
if (KittenDismount.Active) then
|
if (KittenDismount.Active) then
|
||||||
kittenDismountFrame:RegisterEvent("UNIT_SPELLCAST_SENT")
|
kittenDismountFrame:RegisterEvent("UNIT_SPELLCAST_SENT")
|
||||||
|
|
@ -147,6 +153,7 @@ end
|
||||||
local function settingChanged(setting, value)
|
local function settingChanged(setting, value)
|
||||||
KittenDismount:SetDismountArray()
|
KittenDismount:SetDismountArray()
|
||||||
end
|
end
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function KittenDismount:SetDismountArray()
|
function KittenDismount:SetDismountArray()
|
||||||
local disabled = {}
|
local disabled = {}
|
||||||
|
|
||||||
|
|
@ -156,14 +163,17 @@ function KittenDismount:SetDismountArray()
|
||||||
|
|
||||||
self.disabledSpells = disabled
|
self.disabledSpells = disabled
|
||||||
end
|
end
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function KittenDismount:RegisterCheckbox(cat, variable, variableKey, name, defaultValue, tooltip)
|
function KittenDismount:RegisterCheckbox(cat, variable, variableKey, name, defaultValue, tooltip)
|
||||||
local setting = Settings.RegisterAddOnSetting(cat, variable, variableKey, KittenDismountData, Settings.VarType.Boolean, name, defaultValue)
|
local setting = Settings.RegisterAddOnSetting(cat, variable, variableKey, KittenDismountData, Settings.VarType.Boolean, name, defaultValue)
|
||||||
setting:SetValueChangedCallback(settingChanged)
|
setting:SetValueChangedCallback(settingChanged)
|
||||||
Settings.CreateCheckbox(cat, setting, tooltip)
|
Settings.CreateCheckbox(cat, setting, tooltip)
|
||||||
end
|
end
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function KittenDismount:Print(message)
|
function KittenDismount:Print(message)
|
||||||
DEFAULT_CHAT_FRAME:AddMessage("[|c44ff44ffKittenDismount|r] " .. tostring(message))
|
DEFAULT_CHAT_FRAME:AddMessage("[|c44ff44ffKittenDismount|r] " .. tostring(message))
|
||||||
end
|
end
|
||||||
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function KittenDismount:Error(message)
|
function KittenDismount:Error(message)
|
||||||
DEFAULT_CHAT_FRAME:AddMessage("[|c44ff44ffKittenDismount|r] |cff0000ff" .. tostring(message) .. "|r")
|
DEFAULT_CHAT_FRAME:AddMessage("[|c44ff44ffKittenDismount|r] |cff0000ff" .. tostring(message) .. "|r")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
# KittenDismount
|
# Kitten Easy Dismount
|
||||||
|
|
||||||
Addon to dismount from Skyriding mounts if you are on the ground and activate skyriding abilities.
|
Addon to dismount from Skyriding mounts if you are on the ground and activate skyriding abilities.
|
||||||
|
|
|
||||||
14
dump.lua
14
dump.lua
|
|
@ -1,14 +0,0 @@
|
||||||
function KittenDismount_dump(o)
|
|
||||||
if type(o) == 'table' then
|
|
||||||
local s = '{ '
|
|
||||||
for k,v in pairs(o) do
|
|
||||||
if type(k) ~= 'number' then
|
|
||||||
k = '"'..k..'"'
|
|
||||||
end
|
|
||||||
s = s .. '['..k..'] = ' .. KittenDismount_dump(v) .. ','
|
|
||||||
end
|
|
||||||
return s .. '} '
|
|
||||||
else
|
|
||||||
return tostring(o)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue