mirror of
https://forgejo.merr.is/annika/KittenDismount.git
synced 2025-12-13 07:02:10 -05:00
Working on Settings
This commit is contained in:
parent
e85191395b
commit
f4069d38f0
3 changed files with 118 additions and 0 deletions
10
KittenDismount.toc
Normal file
10
KittenDismount.toc
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
## Interface: 110002
|
||||||
|
## Version: 0.0.1
|
||||||
|
## Title: Easy Dismount
|
||||||
|
## Notes: Quick addon to dismount if you are on a flying mount, but on the ground.
|
||||||
|
## Author: Annika
|
||||||
|
|
||||||
|
## SavedVariables: KittenDismount_SavedVars
|
||||||
|
|
||||||
|
main.lua
|
||||||
|
settings.lua
|
||||||
25
main.lua
Normal file
25
main.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
local surgeForward = 372608;
|
||||||
|
local skywardAscent = 372610;
|
||||||
|
local whirlingSurge = 361584;
|
||||||
|
local aerielHalt = 403092;
|
||||||
|
local secondWind = 425782;
|
||||||
|
|
||||||
|
local frame = CreateFrame("Frame", "DismountAddonFrame");
|
||||||
|
frame:RegisterEvent("UNIT_SPELLCAST_SENT");
|
||||||
|
|
||||||
|
local function OnEvent(self, event, ...)
|
||||||
|
if event == "UNIT_SPELLCAST_SENT" then
|
||||||
|
print(KittenDismount_SavedVars)
|
||||||
|
print(KittenDismount_SavedVars.surgeForward)
|
||||||
|
local unit, target, castGUID, spellID = ...;
|
||||||
|
if not IsFlying() then
|
||||||
|
if spellID == surgeForward or spellID == whirlingSurge or spellID == aerielHalt then
|
||||||
|
Dismount()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
frame:SetScript("OnEvent", OnEvent)
|
||||||
|
|
||||||
|
-- Hi Kitten!
|
||||||
83
settings.lua
Normal file
83
settings.lua
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
KittenDismount_SavedVars = {}
|
||||||
|
|
||||||
|
local category = Settings.RegisterVerticalLayoutCategory("Kitten Dismount")
|
||||||
|
|
||||||
|
local function OnSettingChanged(setting, value)
|
||||||
|
print(KittenDismount_dump(KittenDismount_SavedVars))
|
||||||
|
print("hey")
|
||||||
|
print("Setting changed: ", setting:GetVariable(), value)
|
||||||
|
print(KittenDismount_SavedVars["surgeForward"])
|
||||||
|
end
|
||||||
|
|
||||||
|
local function RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
||||||
|
local setting = Settings.RegisterAddOnSetting(category, variable, variableKey, KittenDismount_SavedVars, Settings.VarType.Boolean, name, defaultValue)
|
||||||
|
setting:SetValueChangedCallback(OnSettingChanged)
|
||||||
|
Settings.CreateCheckbox(category, setting, tooltip)
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
do
|
||||||
|
local name = "Surge Forward"
|
||||||
|
local variable = "surgeForwardToggle"
|
||||||
|
local variableKey = "surgeForward"
|
||||||
|
local variableTbl = KittenDismount_SavedVars
|
||||||
|
local defaultValue = true
|
||||||
|
local tooltip = "Automatically dismount when Surge Forward is cast while on the ground."
|
||||||
|
|
||||||
|
RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
||||||
|
end
|
||||||
|
do
|
||||||
|
local name = "Skyward Ascent"
|
||||||
|
local variable = "skywardAscentToggle"
|
||||||
|
local variableKey = "skywardAscent"
|
||||||
|
local variableTbl = KittenDismount_SavedVars
|
||||||
|
local defaultValue = false
|
||||||
|
local tooltip = "Automatically dismount when Skyward Ascent is cast while on the ground."
|
||||||
|
|
||||||
|
RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
||||||
|
end
|
||||||
|
do
|
||||||
|
local name = "Whirling Surge"
|
||||||
|
local variable = "whirlingSurgeToggle"
|
||||||
|
local variableKey = "whirlingSurge"
|
||||||
|
local variableTbl = KittenDismount_SavedVars
|
||||||
|
local defaultValue = true
|
||||||
|
local tooltip = "Automatically dismount when Whirling Surge is cast while on the ground."
|
||||||
|
|
||||||
|
RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
||||||
|
end
|
||||||
|
do
|
||||||
|
local name = "Aeriel Halt"
|
||||||
|
local variable = "aerielHaltToggle"
|
||||||
|
local variableKey = "aerielHalt"
|
||||||
|
local variableTbl = KittenDismount_SavedVars
|
||||||
|
local defaultValue = true
|
||||||
|
local tooltip = "Automatically dismount when Aeriel Halt is cast while on the ground."
|
||||||
|
|
||||||
|
RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
||||||
|
end
|
||||||
|
do
|
||||||
|
local name = "Second Wind"
|
||||||
|
local variable = "secondWindToggle"
|
||||||
|
local variableKey = "secondWind"
|
||||||
|
local variableTbl = KittenDismount_SavedVars
|
||||||
|
local defaultValue = false
|
||||||
|
local tooltip = "Automatically dismount when Second Wind is cast while on the ground."
|
||||||
|
|
||||||
|
RegisterCheckbox(category, variable, variableKey, name, defaultValue, tooltip)
|
||||||
|
end
|
||||||
|
|
||||||
|
Settings.RegisterAddOnCategory(category)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue