Migrate camera and spellq settings

This commit is contained in:
2024-12-16 16:19:44 +01:00
parent bbc764d782
commit fa3e4ba02a
4 changed files with 78 additions and 0 deletions

36
CameraSettings.lua Normal file
View 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

View File

@@ -13,11 +13,16 @@ local addonname, shared = ...
---@field DumpTable fun(table: table<any, any>, depth: number) ---@field DumpTable fun(table: table<any, any>, depth: number)
---@field TableContains fun(table: table<any, any>, value: any): boolean ---@field TableContains fun(table: table<any, any>, value: any): boolean
---@field Autoloot Autoloot ---@field Autoloot Autoloot
---@field CameraSettings CameraSettings
---@field SpellQSettings SpellQSettings
---@class CykaData ---@class CykaData
---@class CykaConfig ---@class CykaConfig
---@field autoloot CykaAutolootConfig ---@field autoloot CykaAutolootConfig
---@field camera { enabled: boolean, speed: number }
---@field spellQueue { enabled: boolean, queue: number }
---@class CykaAutolootConfig ---@class CykaAutolootConfig
---@field enabled boolean ---@field enabled boolean

View File

@@ -6,5 +6,7 @@
#core #core
Autoloot.lua Autoloot.lua
CameraSettings.lua
SpellQSettings.lua
CLEUParser.lua CLEUParser.lua
Cyka.lua Cyka.lua

35
SpellQSettings.lua Normal file
View 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