Migrate camera and spellq settings
This commit is contained in:
36
CameraSettings.lua
Normal file
36
CameraSettings.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
local addonname, shared = ...
|
||||
---@cast shared CykaShared
|
||||
---@cast addonname string
|
||||
|
||||
---@class CameraSettings
|
||||
---@field Init fun()
|
||||
|
||||
shared.CameraSettings = { Init = function() end }
|
||||
function shared.CameraSettings.Init()
|
||||
if not shared.config.camera.enabled then
|
||||
print("Cyka - Camera settings disabled")
|
||||
return
|
||||
end
|
||||
|
||||
local function SetCameraSpeed(speed)
|
||||
if not speed then return end
|
||||
print("Camera speed set to " .. tostring(speed))
|
||||
SetCVar("cameraYawMoveSpeed", speed)
|
||||
SetCVar("cameraPitchMoveSpeed", speed)
|
||||
end
|
||||
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("PLAYER_LOGIN")
|
||||
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
frame:SetScript("OnEvent", function(self, event, ...)
|
||||
SetCameraSpeed(CykaPersistentData.config.camera.speed)
|
||||
end)
|
||||
|
||||
SlashCmdList["CAMERASETTINGS"] = function(speed)
|
||||
if speed then CykaPersistentData.config.camera.speed = speed end
|
||||
SetCameraSpeed(CykaPersistentData.config.camera.speed)
|
||||
end
|
||||
SLASH_CAMERASETTINGS1 = "/cs"
|
||||
|
||||
print("Cyka - Autoloot loaded")
|
||||
end
|
5
Cyka.lua
5
Cyka.lua
@@ -13,11 +13,16 @@ local addonname, shared = ...
|
||||
---@field DumpTable fun(table: table<any, any>, depth: number)
|
||||
---@field TableContains fun(table: table<any, any>, value: any): boolean
|
||||
---@field Autoloot Autoloot
|
||||
---@field CameraSettings CameraSettings
|
||||
---@field SpellQSettings SpellQSettings
|
||||
|
||||
|
||||
---@class CykaData
|
||||
|
||||
---@class CykaConfig
|
||||
---@field autoloot CykaAutolootConfig
|
||||
---@field camera { enabled: boolean, speed: number }
|
||||
---@field spellQueue { enabled: boolean, queue: number }
|
||||
|
||||
---@class CykaAutolootConfig
|
||||
---@field enabled boolean
|
||||
|
2
Cyka.toc
2
Cyka.toc
@@ -6,5 +6,7 @@
|
||||
|
||||
#core
|
||||
Autoloot.lua
|
||||
CameraSettings.lua
|
||||
SpellQSettings.lua
|
||||
CLEUParser.lua
|
||||
Cyka.lua
|
||||
|
35
SpellQSettings.lua
Normal file
35
SpellQSettings.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
local addonname, shared = ...
|
||||
---@cast shared CykaShared
|
||||
---@cast addonname string
|
||||
|
||||
---@class SpellQSettings
|
||||
---@field Init fun()
|
||||
|
||||
shared.SpellQSettings = { Init = function() end }
|
||||
function shared.SpellQSettings.Init()
|
||||
if not shared.config.spellQueue.enabled then
|
||||
print("Cyka - Spell queue disabled")
|
||||
return
|
||||
end
|
||||
|
||||
local function SetSpellQueue(window)
|
||||
if not window then return end
|
||||
print("Spell queue window set to " .. tostring(window))
|
||||
SetCVar("SpellQueueWindow", window)
|
||||
end
|
||||
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("PLAYER_LOGIN")
|
||||
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
frame:SetScript("OnEvent", function(self, event, ...)
|
||||
SetSpellQueue(CykaPersistentData.config.spellQueue.queue)
|
||||
end)
|
||||
|
||||
SlashCmdList["SPELLQSETTINGS"] = function(window)
|
||||
if window then CykaPersistentData.config.spellQueue.queue = window end
|
||||
SetSpellQueue(CykaPersistentData.config.spellQueue.queue)
|
||||
end
|
||||
SLASH_SPELLQSETTINGS1 = "/sq"
|
||||
|
||||
print("Cyka - Autoloot loaded")
|
||||
end
|
Reference in New Issue
Block a user