Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.
41 changes: 41 additions & 0 deletions Core/MultiBotConfig.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ local THROTTLE_DEFAULTS = {
burst = 8,
}

local UI_DEFAULTS = {
mainBar = {
moveLocked = true,
},
}

local DB_DEFAULTS = {
profile = {
timers = {
Expand All @@ -29,6 +35,11 @@ local DB_DEFAULTS = {
rate = THROTTLE_DEFAULTS.rate,
burst = THROTTLE_DEFAULTS.burst,
},
ui = {
mainBar = {
moveLocked = UI_DEFAULTS.mainBar.moveLocked,
},
},
},
}

Expand Down Expand Up @@ -62,6 +73,12 @@ local function migrateLegacyConfigIntoProfile(profile)
profile.throttle[key] = defaultValue
end
end

profile.ui = profile.ui or {}
profile.ui.mainBar = profile.ui.mainBar or {}
if type(profile.ui.mainBar.moveLocked) ~= "boolean" then
profile.ui.mainBar.moveLocked = UI_DEFAULTS.mainBar.moveLocked
end
end

local function getConfigStore(createIfMissing)
Expand Down Expand Up @@ -117,6 +134,12 @@ function MultiBot.Config_Ensure()
if type(config.throttle.burst) ~= "number" or config.throttle.burst <= 0 then
config.throttle.burst = THROTTLE_DEFAULTS.burst
end

config.ui = config.ui or {}
config.ui.mainBar = config.ui.mainBar or {}
if type(config.ui.mainBar.moveLocked) ~= "boolean" then
config.ui.mainBar.moveLocked = UI_DEFAULTS.mainBar.moveLocked
end
end

-- Copy saved values into runtime timers.
Expand Down Expand Up @@ -212,3 +235,21 @@ function MultiBot.SetThrottleBurst(value)
MultiBot._ThrottleStats(MultiBot.GetThrottleRate(), config.throttle.burst)
end
end

function MultiBot.GetMainBarMoveLocked()
local config = getConfigStore(false)
local value = config and config.ui and config.ui.mainBar and config.ui.mainBar.moveLocked
if type(value) == "boolean" then
return value
end

return UI_DEFAULTS.mainBar.moveLocked
end

function MultiBot.SetMainBarMoveLocked(value)
local config = getConfigStore(true)
config.ui = config.ui or {}
config.ui.mainBar = config.ui.mainBar or {}
config.ui.mainBar.moveLocked = value and true or false
return config.ui.mainBar.moveLocked
end
Loading
Loading