Renamed settings module to config module

* this module will be split into multiple parts
* moved to config package since it's not a utility
This commit is contained in:
Timo Smit 2020-04-15 17:04:45 +02:00
parent f17c3abdf3
commit 4ef95d2c85
60 changed files with 236 additions and 372 deletions

View file

@ -16,12 +16,10 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local db = wolfa_requireModule("db.db")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local constants = wolfa_requireModule("util.constants")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local util = wolfa_requireModule("util.util")
local admin = {}
@ -33,7 +31,7 @@ function admin.checkDamage(clientId)
local totalDamage = teamDamage + et.gentity_get(clientId, "sess.damage_given")
local teamDamagePercentage = teamDamage / totalDamage
if teamDamage > 250 and totalDamage > 500 and teamDamagePercentage > settings.get("g_maxTeamDamage") then
if teamDamage > 250 and totalDamage > 500 and teamDamagePercentage > config.get("g_maxTeamDamage") then
admin.kickPlayer(clientId, -1337, "Too much team damage.")
end
end
@ -110,7 +108,7 @@ function admin.onClientConnectAttempt(clientId, firstTime, isBot)
return "\n\nIt appears you do not have a ^7GUID^9/^7etkey^9. In order to play on this server, create an ^7etkey^9.\n\nMore info: ^7www.etkey.org"
end
if settings.get("g_standalone") ~= 0 then
if config.get("g_standalone") ~= 0 then
local player = db.getPlayer(guid)
if player then
local playerId = player["id"]
@ -127,7 +125,7 @@ end
events.handle("onClientConnectAttempt", admin.onClientConnectAttempt)
function admin.onClientConnect(clientId, firstTime, isBot)
if settings.get("g_standalone") ~= 0 and db.isConnected() then
if config.get("g_standalone") ~= 0 and db.isConnected() then
local guid = et.Info_ValueForKey(et.trap_GetUserinfo(clientId), "cl_guid")
local player = db.getPlayer(guid)
@ -198,7 +196,7 @@ function admin.onClientNameChange(clientId, oldName, newName)
if (playerRenames[clientId]["last"] - playerRenames[clientId]["first"]) > 3 then
local renamesPerMinute = playerRenames[clientId]["count"] / (playerRenames[clientId]["last"] - playerRenames[clientId]["first"]) * 60
if renamesPerMinute > settings.get("g_renameLimit") then
if renamesPerMinute > config.get("g_renameLimit") then
admin.kickPlayer(clientId, -1337, "Too many name changes.")
end
end

View file

@ -16,11 +16,10 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local teams = wolfa_requireModule("game.teams")
local config = wolfa_requireModule("config.config")
local constants = wolfa_requireModule("util.constants")
local bits = wolfa_requireModule("util.bits")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local tables = wolfa_requireModule("util.tables")
local timers = wolfa_requireModule("util.timers")
local util = wolfa_requireModule("util.util")
@ -60,7 +59,7 @@ function balancer.balance(byAdmin, forceBalance)
teamSmaller = constants.TEAM_AXIS
end
if settings.get("g_evenerMaxDifference") > 0 and teamsDifference >= settings.get("g_evenerMaxDifference") then
if config.get("g_evenerMaxDifference") > 0 and teamsDifference >= config.get("g_evenerMaxDifference") then
evenerCount = evenerCount + 1
if forceBalance or evenerCount >= 2 then
@ -71,7 +70,7 @@ function balancer.balance(byAdmin, forceBalance)
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cpm \"^dbalancer: ^1EVEN THE TEAMS ^7OR ^1SHUFFLE\";")
end
elseif teamsDifference >= settings.get("g_evenerMinDifference") then
elseif teamsDifference >= config.get("g_evenerMinDifference") then
evenerCount = evenerCount + 1
if forceBalance or evenerCount >= 3 then
@ -97,7 +96,7 @@ function balancer.balance(byAdmin, forceBalance)
end
function balancer.findPlayer(team, teamGreater, teamSmaller)
local playerSelection = settings.get("g_evenerPlayerSelection")
local playerSelection = config.get("g_evenerPlayerSelection")
if bits.hasbit(playerSelection, balancer.BALANCE_LAST_JOINED) then
if #lastJoined[teamGreater] > 0 then
@ -157,7 +156,7 @@ end
events.handle("onClientDisconnect", balancer.onclientdisconnect)
function balancer.enable()
balancerTimer = timers.add(balancer.balance, settings.get("g_evenerInterval") * 1000, 0, false, false)
balancerTimer = timers.add(balancer.balance, config.get("g_evenerInterval") * 1000, 0, false, false)
end
function balancer.disable()
@ -171,7 +170,7 @@ function balancer.isRunning()
end
function balancer.oninit()
if settings.get("g_balancedteams") ~= 0 and settings.get("g_evenerInterval") > 0 then
if config.get("g_balancedteams") ~= 0 and config.get("g_evenerInterval") > 0 then
balancer.enable()
end
end

View file

@ -15,9 +15,9 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local config = wolfa_requireModule("config.config")
local bits = wolfa_requireModule("util.bits")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local timers = wolfa_requireModule("util.timers")
local constants = wolfa_requireModule("util.constants")
local util = wolfa_requireModule("util.util")
@ -36,10 +36,10 @@ local welcomeBanners = {}
local infoBanners = {}
function banners.print(clientId, banner)
local prefix = (settings.get("g_bannerArea") ~= constants.AREA_CHAT) and "^7" or "^dbanner: ^9"
local prefix = (config.get("g_bannerArea") ~= constants.AREA_CHAT) and "^7" or "^dbanner: ^9"
local target = clientId and clientId or -1
et.trap_SendConsoleCommand(et.EXEC_APPEND,
string.format("%s %i \"%s%s\";", util.getCommandForArea(settings.get("g_bannerArea")), target, prefix, banner["text"]))
string.format("%s %i \"%s%s\";", util.getCommandForArea(config.get("g_bannerArea")), target, prefix, banner["text"]))
end
function banners.nextBanner(random)
@ -59,11 +59,11 @@ function banners.autoprint()
banners.print(nil, infoBanners[nextBannerId])
end
banners.nextBanner(bits.hasbit(settings.get("g_bannerRandomize"), banners.RANDOM_ALL))
banners.nextBanner(bits.hasbit(config.get("g_bannerRandomize"), banners.RANDOM_ALL))
end
function banners.load()
local fileName = settings.get("g_fileBanners")
local fileName = config.get("g_fileBanners")
if fileName == "" then
return 0
@ -116,9 +116,9 @@ events.handle("onPlayerReady", banners.onPlayerReady)
function banners.onGameInit(levelTime, randomSeed, restartMap)
banners.load()
banners.nextBanner(bits.hasbit(settings.get("g_bannerRandomize"), banners.RANDOM_START))
banners.nextBanner(bits.hasbit(config.get("g_bannerRandomize"), banners.RANDOM_START))
bannerTimer = timers.add(banners.autoprint, settings.get("g_bannerInterval") * 1000, 0)
bannerTimer = timers.add(banners.autoprint, config.get("g_bannerInterval") * 1000, 0)
end
events.handle("onGameInit", banners.onGameInit)

View file

@ -18,14 +18,10 @@
local admin = wolfa_requireModule("admin.admin")
local mutes = wolfa_requireModule("admin.mutes")
local history = wolfa_requireModule("admin.history")
local auth = wolfa_requireModule("auth.auth")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local toml = wolfa_requireLib("toml")
local censor = {}
@ -60,43 +56,43 @@ function censor.filterMessage(...)
end
function censor.punishClient(clientId)
if settings.get("g_censorBurn") ~= 0 then
if config.get("g_censorBurn") ~= 0 then
admin.burnPlayer(clientId)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dburn: ^7"..players.getName(clientId).." ^9burnt his tongue.\";")
end
if settings.get("g_censorSlap") ~= 0 then
if config.get("g_censorSlap") ~= 0 then
admin.slapPlayer(clientId, 20)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dslap: ^7"..players.getName(clientId).." ^9was slapped for his foul language.\";")
end
if settings.get("g_censorKill") ~= 0 and settings.get("g_censorGib") == 0 then
if config.get("g_censorKill") ~= 0 and config.get("g_censorGib") == 0 then
admin.killPlayer(clientId)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dkill: ^7"..players.getName(clientId).." ^9stumbled over his words.\";")
end
if settings.get("g_censorGib") ~= 0 then
if config.get("g_censorGib") ~= 0 then
admin.gibPlayer(clientId)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dgib: ^7"..players.getName(clientId).." ^9should not have said that.\";")
end
if settings.get("g_censorMute") > 0 then
mutes.add(clientId, -1337, players.MUTE_CHAT + players.MUTE_VOICE, settings.get("g_censorMute"), "censor")
if config.get("g_censorMute") > 0 then
mutes.add(clientId, -1337, players.MUTE_CHAT + players.MUTE_VOICE, config.get("g_censorMute"), "censor")
if settings.get("g_playerHistory") ~= 0 then
if config.get("g_playerHistory") ~= 0 then
history.add(clientId, -1337, "mute", "censor")
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dmute: ^7"..players.getName(clientId).." ^9has been muted for "..settings.get("g_censorMute").." seconds\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dmute: ^7"..players.getName(clientId).." ^9has been muted for "..config.get("g_censorMute").." seconds\";")
end
end
function censor.load()
local fileName = settings.get("g_fileCensor")
local fileName = config.get("g_fileCensor")
if fileName == "" then
return 0
@ -142,7 +138,7 @@ function censor.clear()
end
function censor.onClientConnectAttempt(clientId, firstTime, isBot)
if settings.get("g_censor") == 0 or auth.isPlayerAllowed(clientId, auth.PERM_NOCENSOR) then
if config.get("g_censor") == 0 or auth.isPlayerAllowed(clientId, auth.PERM_NOCENSOR) then
return
end
@ -151,7 +147,7 @@ function censor.onClientConnectAttempt(clientId, firstTime, isBot)
local censored, censoredName = censor.filterName(et.Info_ValueForKey(clientInfo, "name"))
if censored then
if settings.get("g_censorKick") ~= 0 then
if config.get("g_censorKick") ~= 0 then
return "\n\nYou have been kicked, Reason: Name not allowed."
else
clientInfo = et.Info_SetValueForKey(clientInfo, "name", censoredName)
@ -164,14 +160,14 @@ function censor.onClientConnectAttempt(clientId, firstTime, isBot)
end
function censor.onClientNameChange(clientId, oldName, newName)
if settings.get("g_censor") == 0 or auth.isPlayerAllowed(clientId, auth.PERM_NOCENSOR) then
if config.get("g_censor") == 0 or auth.isPlayerAllowed(clientId, auth.PERM_NOCENSOR) then
return
end
local censored, censoredName = censor.filterName(newName)
if censored then
if settings.get("g_censorKick") ~= 0 then
if config.get("g_censorKick") ~= 0 then
admin.kickPlayer(clientId, -1337, "Name not allowed.")
else
local clientInfo = et.trap_GetUserinfo(clientId)
@ -183,7 +179,7 @@ function censor.onClientNameChange(clientId, oldName, newName)
end
function censor.oninit(levelTime, randomSeed, restartMap)
if settings.get("g_standalone") ~= 0 then
if config.get("g_standalone") ~= 0 then
censor.load()
events.handle("onClientConnectAttempt", censor.onClientConnectAttempt)

View file

@ -15,10 +15,9 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local config = wolfa_requireModule("config.config")
local events = wolfa_requireModule("util.events")
local files = wolfa_requireModule("util.files")
local settings = wolfa_requireModule("util.settings")
local toml = wolfa_requireLib("toml")
local rules = {}
@ -34,7 +33,7 @@ function rules.get(shortcut)
end
function rules.load()
local fileName = settings.get("g_fileRules")
local fileName = config.get("g_fileRules")
if fileName == "" then
return 0

View file

@ -15,12 +15,10 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local config = wolfa_requireModule("config.config")
local db = wolfa_requireModule("db.db")
local players = wolfa_requireModule("players.players")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local tables = wolfa_requireModule("util.tables")
local acl = {}
@ -29,7 +27,7 @@ local cachedLevels = {}
local cachedClients = {}
function acl.onClientConnect(clientId, firstTime, isBot)
if settings.get("g_standalone") ~= 0 and db.isConnected() then
if config.get("g_standalone") ~= 0 and db.isConnected() then
local guid = et.Info_ValueForKey(et.trap_GetUserinfo(clientId), "cl_guid")
local player = db.getPlayer(guid)

View file

@ -16,9 +16,8 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local db = wolfa_requireModule("db.db")
local config = wolfa_requireModule("config.config")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local auth = {}
@ -118,7 +117,7 @@ auth.PERM_IMMUNE = "immune"
-- system in this function. might have to think of a better way to implement
-- this, but it will suffice.
function auth.onGameInit()
if settings.get("g_standalone") ~= 0 then
if config.get("g_standalone") ~= 0 then
if et.trap_Cvar_Get("g_shrubbot") ~= "" then
outputDebug("Running in standalone mode while g_shrubbot is set", 3)
end

View file

@ -16,13 +16,10 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local settings = wolfa_requireModule("util.settings")
function commandAdminTest(clientId, command)
local level = auth.getPlayerLevel(clientId)
local levelName = auth.getLevelName(level)
@ -31,4 +28,4 @@ function commandAdminTest(clientId, command)
return true
end
commands.addadmin("admintest", commandAdminTest, auth.PERM_ADMINTEST, "display your current admin level", nil, nil, (settings.get("g_standalone") == 0))
commands.addadmin("admintest", commandAdminTest, auth.PERM_ADMINTEST, "display your current admin level", nil, nil, (config.get("g_standalone") == 0))

View file

@ -16,12 +16,9 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local balancer = wolfa_requireModule("admin.balancer")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
function commandBalance(clientId, command, action)
if action == "enable" then
@ -50,4 +47,4 @@ function commandBalance(clientId, command, action)
return true
end
commands.addadmin("balance", commandBalance, auth.PERM_BALANCE, "either asks the players to even up or evens them by moving or shuffling players", "^2!balance ^9(^henable|disable|force^9)", nil, (settings.get("fs_game") == "etpub"))
commands.addadmin("balance", commandBalance, auth.PERM_BALANCE, "either asks the players to even up or evens them by moving or shuffling players", "^2!balance ^9(^henable|disable|force^9)", nil, (config.get("fs_game") == "etpub"))

View file

@ -16,14 +16,11 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local bans = wolfa_requireModule("admin.bans")
local history = wolfa_requireModule("admin.history")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local util = wolfa_requireModule("util.util")
local settings = wolfa_requireModule("util.settings")
function commandBan(clientId, command, victim, ...)
local cmdClient
@ -78,7 +75,7 @@ function commandBan(clientId, command, victim, ...)
return true
end
if settings.get("g_playerHistory") ~= 0 then
if config.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "ban", reason)
end
@ -94,4 +91,4 @@ function commandBan(clientId, command, victim, ...)
return true
end
commands.addadmin("ban", commandBan, auth.PERM_BAN, "ban a player with an optional duration and reason", "^9[^3name|slot#^9] ^9(^3duration^9) ^9(^3reason^9)", nil, (settings.get("g_standalone") == 0))
commands.addadmin("ban", commandBan, auth.PERM_BAN, "ban a player with an optional duration and reason", "^9[^3name|slot#^9] ^9(^3duration^9) ^9(^3reason^9)", nil, (config.get("g_standalone") == 0))

View file

@ -16,12 +16,9 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local settings = wolfa_requireModule("util.settings")
local util = wolfa_requireModule("util.util")
function commandFinger(clientId, command, victim)
@ -65,4 +62,4 @@ function commandFinger(clientId, command, victim)
return true
end
commands.addadmin("finger", commandFinger, auth.PERM_FINGER, "gives specific information about a player", "^9[^3name|slot#^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("finger", commandFinger, auth.PERM_FINGER, "gives specific information about a player", "^9[^3name|slot#^9]", nil, (config.get("g_standalone") == 0))

View file

@ -16,13 +16,10 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local constants = wolfa_requireModule("util.constants")
local settings = wolfa_requireModule("util.settings")
local vectors = wolfa_requireModule("util.vectors")
function commandFling(clientId, command, victim)
@ -77,4 +74,4 @@ function commandFling(clientId, command, victim)
return true
end
commands.addadmin("fling", commandFling, auth.PERM_THROW, "flings a player in a random direction", "^9[^3name|slot#^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("fling", commandFling, auth.PERM_THROW, "flings a player in a random direction", "^9[^3name|slot#^9]", nil, (config.get("g_standalone") == 0))

View file

@ -16,15 +16,11 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local admin = wolfa_requireModule("admin.admin")
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local constants = wolfa_requireModule("util.constants")
local settings = wolfa_requireModule("util.settings")
function commandGib(clientId, command, victim)
local cmdClient
@ -73,4 +69,4 @@ function commandGib(clientId, command, victim)
return true
end
commands.addadmin("gib", commandGib, auth.PERM_GIB, "insantly gibs a player", "^9(^3name|slot#^9) (^hreason^9)", nil, (settings.get("g_standalone") == 0))
commands.addadmin("gib", commandGib, auth.PERM_GIB, "insantly gibs a player", "^9(^3name|slot#^9) (^hreason^9)", nil, (config.get("g_standalone") == 0))

View file

@ -17,7 +17,7 @@
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
function commandHelp(clientId, command, cmd)
local cmds = commands.getadmin()
@ -31,7 +31,7 @@ function commandHelp(clientId, command, cmd)
end
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..clientId.." \"^dhelp: ^9"..#availableCommands.." "..((settings.get("g_standalone") ~= 0) and "available" or "additional").." commands (open console for the full list)\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..clientId.." \"^dhelp: ^9"..#availableCommands.." "..((config.get("g_standalone") ~= 0) and "available" or "additional").." commands (open console for the full list)\";")
local cmdsOnLine, cmdsBuffer = 0, ""
@ -68,4 +68,4 @@ function commandHelp(clientId, command, cmd)
return false
end
commands.addadmin("help", commandHelp, auth.PERM_HELP, "display commands available to you or help on a specific command", "^9(^hcommand^9)", (settings.get("g_standalone") == 0))
commands.addadmin("help", commandHelp, auth.PERM_HELP, "display commands available to you or help on a specific command", "^9(^hcommand^9)", (config.get("g_standalone") == 0))

View file

@ -16,13 +16,10 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local admin = wolfa_requireModule("admin.admin")
local history = wolfa_requireModule("admin.history")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
function commandKick(clientId, command, victim, ...)
local cmdClient
@ -70,7 +67,7 @@ function commandKick(clientId, command, victim, ...)
return true
end
if settings.get("g_playerHistory") ~= 0 then
if config.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "kick", reason)
end
@ -80,4 +77,4 @@ function commandKick(clientId, command, victim, ...)
return true
end
commands.addadmin("kick", commandKick, auth.PERM_KICK, "kick a player with an optional reason", "^9[^3name|slot#^9] ^9(^3reason^9)", nil, (settings.get("g_standalone") == 0))
commands.addadmin("kick", commandKick, auth.PERM_KICK, "kick a player with an optional reason", "^9[^3name|slot#^9] ^9(^3reason^9)", nil, (config.get("g_standalone") == 0))

View file

@ -16,13 +16,10 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local constants = wolfa_requireModule("util.constants")
local settings = wolfa_requireModule("util.settings")
local vectors = wolfa_requireModule("util.vectors")
function commandLaunch(clientId, command, victim)
@ -74,4 +71,4 @@ function commandLaunch(clientId, command, victim)
return true
end
commands.addadmin("launch", commandLaunch, auth.PERM_THROW, "launch a player vertically", "^9[^3name|slot#^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("launch", commandLaunch, auth.PERM_THROW, "launch a player vertically", "^9[^3name|slot#^9]", nil, (config.get("g_standalone") == 0))

View file

@ -16,17 +16,12 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local db = wolfa_requireModule("db.db")
local fireteams = wolfa_requireModule("game.fireteams")
local players = wolfa_requireModule("players.players")
local constants = wolfa_requireModule("util.constants")
local settings = wolfa_requireModule("util.settings")
local util = wolfa_requireModule("util.util")
function commandListPlayers(clientId, command)
@ -92,4 +87,4 @@ function commandListPlayers(clientId, command)
return true
end
commands.addadmin("listplayers", commandListPlayers, auth.PERM_LISTPLAYERS, "display a list of connected players, their slot numbers as well as their admin levels", nil, nil, (settings.get("g_standalone") == 0))
commands.addadmin("listplayers", commandListPlayers, auth.PERM_LISTPLAYERS, "display a list of connected players, their slot numbers as well as their admin levels", nil, nil, (config.get("g_standalone") == 0))

View file

@ -16,14 +16,11 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local teams = wolfa_requireModule("game.teams")
local util = wolfa_requireModule("util.util")
local constants = wolfa_requireModule("util.constants")
local settings = wolfa_requireModule("util.settings")
function commandLock(clientId, command, team)
if team == nil or (team ~= constants.TEAM_AXIS_SC and team ~= constants.TEAM_ALLIES_SC and team ~= constants.TEAM_SPECTATORS_SC and team ~= "all") then
@ -42,7 +39,7 @@ function commandLock(clientId, command, team)
return false
end
commands.addadmin("lock", commandLock, auth.PERM_LOCKTEAM, "lock one or all of the teams from players joining", "^9[^3r|b|s|all#^9]", true, (settings.get("g_standalone") ~= 0))
commands.addadmin("lock", commandLock, auth.PERM_LOCKTEAM, "lock one or all of the teams from players joining", "^9[^3r|b|s|all#^9]", true, (config.get("g_standalone") ~= 0))
function commandLock(clientId, command, team)
if team == nil or (team ~= constants.TEAM_AXIS_SC and team ~= constants.TEAM_ALLIES_SC and team ~= constants.TEAM_SPECTATORS_SC and team ~= "all") then
@ -68,4 +65,4 @@ function commandLock(clientId, command, team)
return false
end
commands.addadmin("lock", commandLock, auth.PERM_LOCKTEAM, "lock one or all of the teams from players joining", "^9[^3r|b|s|all#^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("lock", commandLock, auth.PERM_LOCKTEAM, "lock one or all of the teams from players joining", "^9[^3r|b|s|all#^9]", nil, (config.get("g_standalone") == 0))

View file

@ -16,16 +16,12 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local history = wolfa_requireModule("admin.history")
local mutes = wolfa_requireModule("admin.mutes")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local util = wolfa_requireModule("util.util")
local settings = wolfa_requireModule("util.settings")
function commandMute(clientId, command, victim, ...)
local cmdClient
@ -87,7 +83,7 @@ function commandMute(clientId, command, victim, ...)
mutes.add(cmdClient, clientId, players.MUTE_CHAT + players.MUTE_VOICE, duration, reason)
if settings.get("g_playerHistory") ~= 0 then
if config.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "mute", reason)
end
@ -95,4 +91,4 @@ function commandMute(clientId, command, victim, ...)
return true
end
commands.addadmin("mute", commandMute, auth.PERM_MUTE, "mutes a player (text and voice chat)", "^9[^3name|slot#^9] ^9(^3duration^9) ^9(^3reason^9)", nil, (settings.get("g_standalone") == 0))
commands.addadmin("mute", commandMute, auth.PERM_MUTE, "mutes a player (text and voice chat)", "^9[^3name|slot#^9] ^9(^3duration^9) ^9(^3reason^9)", nil, (config.get("g_standalone") == 0))

View file

@ -17,7 +17,7 @@
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
function commandNextMap(clientId, command)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dnextmap: ^9next map was loaded.\";")
@ -26,4 +26,4 @@ function commandNextMap(clientId, command)
return true
end
commands.addadmin("nextmap", commandNextMap, auth.PERM_NEXTMAP, "loads the next map", nil, nil, (settings.get("g_standalone") == 0))
commands.addadmin("nextmap", commandNextMap, auth.PERM_NEXTMAP, "loads the next map", nil, nil, (config.get("g_standalone") == 0))

View file

@ -16,10 +16,8 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
function commandPause(clientId, command)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dpause: ^9map paused.\";")
@ -28,4 +26,4 @@ function commandPause(clientId, command)
return true
end
commands.addadmin("pause", commandPause, auth.PERM_RESTART, "pauses the game for all players", nil, nil, (settings.get("g_standalone") == 0))
commands.addadmin("pause", commandPause, auth.PERM_RESTART, "pauses the game for all players", nil, nil, (config.get("g_standalone") == 0))

View file

@ -16,14 +16,11 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local admin = wolfa_requireModule("admin.admin")
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local util = wolfa_requireModule("util.util")
local constants = wolfa_requireModule("util.constants")
local settings = wolfa_requireModule("util.settings")
function commandPlayerPut(clientId, command, victim, team)
local cmdClient
@ -68,4 +65,4 @@ function commandPlayerPut(clientId, command, victim, team)
return true
end
commands.addadmin("put", commandPlayerPut, auth.PERM_PUT, "move a player to a specified team", "^9[^3name|slot#^9] [^3r|b|s^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("put", commandPlayerPut, auth.PERM_PUT, "move a player to a specified team", "^9[^3name|slot#^9] [^3r|b|s^9]", nil, (config.get("g_standalone") == 0))

View file

@ -18,19 +18,14 @@
local banners = wolfa_requireModule("admin.banners")
local censor = wolfa_requireModule("admin.censor")
local rules = wolfa_requireModule("admin.rules")
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local sprees = wolfa_requireModule("game.sprees")
local greetings = wolfa_requireModule("players.greetings")
local settings = wolfa_requireModule("util.settings")
function commandReadconfig(clientId, command)
settings.load()
config.load()
local bannersCount = banners.load()
local rulesCount = rules.load()
local greetingsCount = greetings.load()
@ -40,10 +35,10 @@ function commandReadconfig(clientId, command)
return false
end
commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the shrubbot config file and refreshes user flags", nil, true, (settings.get("g_standalone") ~= 0))
commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the shrubbot config file and refreshes user flags", nil, true, (config.get("g_standalone") ~= 0))
function commandReadconfig(clientId, command)
settings.load()
config.load()
local bannersCount = banners.load()
local censorCount = censor.load()
local rulesCount = rules.load()
@ -54,4 +49,4 @@ function commandReadconfig(clientId, command)
return false
end
commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the config file", nil, nil, (settings.get("g_standalone") == 0))
commands.addadmin("readconfig", commandReadconfig, auth.PERM_READCONFIG, "reloads the config file", nil, nil, (config.get("g_standalone") == 0))

View file

@ -16,13 +16,10 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local settings = wolfa_requireModule("util.settings")
function commandRename(clientId, command, victim, newName)
local cmdClient
@ -57,4 +54,4 @@ function commandRename(clientId, command, victim, newName)
return true
end
commands.addadmin("rename", commandRename, auth.PERM_RENAME, "renames a player", "^9[^3name|slot#^9] [^3new name^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("rename", commandRename, auth.PERM_RENAME, "renames a player", "^9[^3name|slot#^9] [^3new name^9]", nil, (config.get("g_standalone") == 0))

View file

@ -17,7 +17,7 @@
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
function commandReset(clientId, command)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dreset: ^9match reset.\";")
@ -26,4 +26,4 @@ function commandReset(clientId, command)
return true
end
commands.addadmin("reset", commandReset, auth.PERM_RESTART, "resets the current match", nil, nil, (settings.get("g_standalone") == 0))
commands.addadmin("reset", commandReset, auth.PERM_RESTART, "resets the current match", nil, nil, (config.get("g_standalone") == 0))

View file

@ -16,16 +16,12 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local db = wolfa_requireModule("db.db")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local game = wolfa_requireModule("game.game")
local sprees = wolfa_requireModule("game.sprees")
local settings = wolfa_requireModule("util.settings")
function commandResetSprees(clientId, command, map)
if not db.isConnected() then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dsprees: ^9spree records are disabled.\";")
@ -45,4 +41,4 @@ function commandResetSprees(clientId, command, map)
return true
end
commands.addadmin("resetsprees", commandResetSprees, auth.PERM_READCONFIG, "resets the spree records", nil, (settings.get("g_spreeRecords") == 0))
commands.addadmin("resetsprees", commandResetSprees, auth.PERM_READCONFIG, "resets the spree records", nil, (config.get("g_spreeRecords") == 0))

View file

@ -17,8 +17,8 @@
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local game = wolfa_requireModule("game.game")
local settings = wolfa_requireModule("util.settings")
function commandRestart(clientId, command)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^drestart: ^9map restarted.\";")
@ -34,4 +34,4 @@ function commandRestart(clientId, command)
return true
end
commands.addadmin("restart", commandRestart, auth.PERM_RESTART, "restarts the current map", nil, nil, (settings.get("g_standalone") == 0))
commands.addadmin("restart", commandRestart, auth.PERM_RESTART, "restarts the current map", nil, nil, (config.get("g_standalone") == 0))

View file

@ -17,14 +17,10 @@
local admin = wolfa_requireModule("admin.admin")
local history = wolfa_requireModule("admin.history")
local auth = wolfa_requireModule("auth.auth")
local db = wolfa_requireModule("db.db")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
local db = wolfa_requireModule("db.db")
function commandSetLevel(clientId, command, victim, level)
local cmdClient
@ -55,7 +51,7 @@ function commandSetLevel(clientId, command, victim, level)
return false
end
commands.addadmin("setlevel", commandSetLevel, auth.PERM_SETLEVEL, "sets the admin level of a player", "^9[^3name|slot#^9] ^9[^3level^9]", true, (settings.get("g_standalone") ~= 0))
commands.addadmin("setlevel", commandSetLevel, auth.PERM_SETLEVEL, "sets the admin level of a player", "^9[^3name|slot#^9] ^9[^3level^9]", true, (config.get("g_standalone") ~= 0))
function commandSetLevel(clientId, command, victim, level)
local cmdClient
@ -103,4 +99,4 @@ function commandSetLevel(clientId, command, victim, level)
return true
end
commands.addadmin("setlevel", commandSetLevel, auth.PERM_SETLEVEL, "sets the admin level of a player", "^9[^3name|slot#^9] ^9[^3level^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("setlevel", commandSetLevel, auth.PERM_SETLEVEL, "sets the admin level of a player", "^9[^3name|slot#^9] ^9[^3level^9]", nil, (config.get("g_standalone") == 0))

View file

@ -16,15 +16,11 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local bans = wolfa_requireModule("admin.bans")
local config = wolfa_requireModule("config.config")
local db = wolfa_requireModule("db.db")
local commands = wolfa_requireModule("commands.commands")
local pagination = wolfa_requireModule("util.pagination")
local settings = wolfa_requireModule("util.settings")
local util = wolfa_requireModule("util.util")
function commandShowBans(clientId, offset)
@ -52,4 +48,4 @@ function commandShowBans(clientId, offset)
return true
end
commands.addadmin("showbans", commandShowBans, auth.PERM_LISTBANS, "display a (partial) list of active bans", "(^hstart at ban#^9) ((^hbanner^9) (^3banner's name^9)) ((^3find^9) (^hbanned player^9)) ((^3reason^9) (^hreason for ban^9))", nil, (settings.get("g_standalone") == 0))
commands.addadmin("showbans", commandShowBans, auth.PERM_LISTBANS, "display a (partial) list of active bans", "(^hstart at ban#^9) ((^hbanner^9) (^3banner's name^9)) ((^3find^9) (^hbanned player^9)) ((^3reason^9) (^hreason for ban^9))", nil, (config.get("g_standalone") == 0))

View file

@ -16,21 +16,17 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local history = wolfa_requireModule("admin.history")
local db = wolfa_requireModule("db.db")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local util = wolfa_requireModule("util.util")
local pagination = wolfa_requireModule("util.pagination")
local settings = wolfa_requireModule("util.settings")
function commandListHistory(clientId, command, victim, offset)
local cmdClient
if not db.isConnected() or settings.get("g_playerHistory") == 0 then
if not db.isConnected() or config.get("g_playerHistory") == 0 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dshowhistory: ^9player history is disabled.\";")
return true
@ -72,4 +68,4 @@ function commandListHistory(clientId, command, victim, offset)
return true
end
commands.addadmin("showhistory", commandListHistory, auth.PERM_LISTHISTORY, "display history for a specific player", "^9[^3name|slot#^9] ^9(^hoffset^9)", (settings.get("g_playerHistory") == 0))
commands.addadmin("showhistory", commandListHistory, auth.PERM_LISTHISTORY, "display history for a specific player", "^9[^3name|slot#^9] ^9(^hoffset^9)", (config.get("g_playerHistory") == 0))

View file

@ -17,10 +17,10 @@
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
function commandShuffle(clientId, command)
if settings.get("fs_game") == "legacy" then
if config.get("fs_game") == "legacy" then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dshuffle: ^9teams were shuffled.\";")
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dshuffle: ^9teams were shuffled by XP.\";")
@ -29,4 +29,4 @@ function commandShuffle(clientId, command)
return true
end
commands.addadmin("shuffle", commandShuffle, auth.PERM_SHUFFLE, "shuffle the teams to try and even them", "^2!shuffle ^9", nil, (settings.get("g_standalone") == 0))
commands.addadmin("shuffle", commandShuffle, auth.PERM_SHUFFLE, "shuffle the teams to try and even them", "^2!shuffle ^9", nil, (config.get("g_standalone") == 0))

View file

@ -16,15 +16,11 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local admin = wolfa_requireModule("admin.admin")
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local constants = wolfa_requireModule("util.constants")
local settings = wolfa_requireModule("util.settings")
function commandSlap(clientId, command, victim)
local cmdClient
@ -73,4 +69,4 @@ function commandSlap(clientId, command, victim)
return true
end
commands.addadmin("slap", commandSlap, auth.PERM_SLAP, "give a player a specified amount of damage for a specified reason", "^9[^3name|slot#^9] (^hdamage^9) (^hreason^9)", nil, (settings.get("g_standalone") == 0))
commands.addadmin("slap", commandSlap, auth.PERM_SLAP, "give a player a specified amount of damage for a specified reason", "^9[^3name|slot#^9] (^hdamage^9) (^hreason^9)", nil, (config.get("g_standalone") == 0))

View file

@ -16,15 +16,11 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local admin = wolfa_requireModule("admin.admin")
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local constants = wolfa_requireModule("util.constants")
local settings = wolfa_requireModule("util.settings")
function commandSpec999(clientId, command)
local count = 0
@ -43,4 +39,4 @@ function commandSpec999(clientId, command)
return true
end
commands.addadmin("spec999", commandSpec999, auth.PERM_SPEC999, "moves 999 pingers to the spectator team", nil, nil, (settings.get("g_standalone") == 0))
commands.addadmin("spec999", commandSpec999, auth.PERM_SPEC999, "moves 999 pingers to the spectator team", nil, nil, (config.get("g_standalone") == 0))

View file

@ -17,7 +17,7 @@
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
function commandSwap(clientId, command)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dswap: ^9teams swapped.\";")
@ -26,4 +26,4 @@ function commandSwap(clientId, command)
return true
end
commands.addadmin("swap", commandSwap, auth.PERM_SWAP, "swap teams", nil, nil, (settings.get("g_standalone") == 0))
commands.addadmin("swap", commandSwap, auth.PERM_SWAP, "swap teams", nil, nil, (config.get("g_standalone") == 0))

View file

@ -16,13 +16,10 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local constants = wolfa_requireModule("util.constants")
local settings = wolfa_requireModule("util.settings")
local vectors = wolfa_requireModule("util.vectors")
function commandThrow(clientId, command, victim)
@ -77,4 +74,4 @@ function commandThrow(clientId, command, victim)
return true
end
commands.addadmin("throw", commandThrow, auth.PERM_THROW, "throws a player forward", "^9[^3name|slot#^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("throw", commandThrow, auth.PERM_THROW, "throws a player forward", "^9[^3name|slot#^9]", nil, (config.get("g_standalone") == 0))

View file

@ -17,11 +17,11 @@
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
function commandTime(clientId, command)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dtime: ^9current time is ^7"..os.date("%H:%M:%S").."^9.\";")
return true
end
commands.addadmin("time", commandTime, auth.PERM_TIME, "displays the local time", nil, nil, (settings.get("g_standalone") == 0))
commands.addadmin("time", commandTime, auth.PERM_TIME, "displays the local time", nil, nil, (config.get("g_standalone") == 0))

View file

@ -16,17 +16,13 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local bans = wolfa_requireModule("admin.bans")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local db = wolfa_requireModule("db.db")
local settings = wolfa_requireModule("util.settings")
function commandRemoveBan(clientId, command, banId)
if settings.get("g_standalone") == 0 or not db.isConnected() then
if config.get("g_standalone") == 0 or not db.isConnected() then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..clientId.." \"^dunban: ^9bans are disabled.\";")
return true
@ -46,4 +42,4 @@ function commandRemoveBan(clientId, command, banId)
return true
end
commands.addadmin("unban", commandRemoveBan, auth.PERM_BAN, "unbans a player specified ban number as seen in ^2!showbans^9", "^9[^3ban#^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("unban", commandRemoveBan, auth.PERM_BAN, "unbans a player specified ban number as seen in ^2!showbans^9", "^9[^3ban#^9]", nil, (config.get("g_standalone") == 0))

View file

@ -16,14 +16,11 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local teams = wolfa_requireModule("game.teams")
local util = wolfa_requireModule("util.util")
local constants = wolfa_requireModule("util.constants")
local settings = wolfa_requireModule("util.settings")
function commandUnlock(clientId, command, team)
if team == nil or (team ~= constants.TEAM_AXIS_SC and team ~= constants.TEAM_ALLIES_SC and team ~= constants.TEAM_SPECTATORS_SC and team ~= "all") then
@ -42,7 +39,7 @@ function commandUnlock(clientId, command, team)
return false
end
commands.addadmin("unlock", commandUnlock, auth.PERM_LOCKTEAM, "unlock one or all locked teams", "^9[^3r|b|s|all#^9]", true, (settings.get("g_standalone") ~= 0))
commands.addadmin("unlock", commandUnlock, auth.PERM_LOCKTEAM, "unlock one or all locked teams", "^9[^3r|b|s|all#^9]", true, (config.get("g_standalone") ~= 0))
function commandUnlock(clientId, command, team)
if team == nil or (team ~= constants.TEAM_AXIS_SC and team ~= constants.TEAM_ALLIES_SC and team ~= constants.TEAM_SPECTATORS_SC and team ~= "all") then
@ -68,4 +65,4 @@ function commandUnlock(clientId, command, team)
return false
end
commands.addadmin("unlock", commandUnlock, auth.PERM_LOCKTEAM, "unlock one or all locked teams", "^9[^3r|b|s|all#^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("unlock", commandUnlock, auth.PERM_LOCKTEAM, "unlock one or all locked teams", "^9[^3r|b|s|all#^9]", nil, (config.get("g_standalone") == 0))

View file

@ -16,15 +16,11 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local mutes = wolfa_requireModule("admin.mutes")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local settings = wolfa_requireModule("util.settings")
function commandUnmute(clientId, command, victim)
local cmdClient
@ -60,4 +56,4 @@ function commandUnmute(clientId, command, victim)
return true
end
commands.addadmin("unmute", commandUnmute, auth.PERM_MUTE, "unmutes a player (text and voice chat)", "^9[^3name|slot#^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("unmute", commandUnmute, auth.PERM_MUTE, "unmutes a player (text and voice chat)", "^9[^3name|slot#^9]", nil, (config.get("g_standalone") == 0))

View file

@ -16,10 +16,8 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
function commandUnpause(clientId, command)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dpause: ^9map unpaused.\";")
@ -28,4 +26,4 @@ function commandUnpause(clientId, command)
return true
end
commands.addadmin("unpause", commandUnpause, auth.PERM_PAUSE, "pauses the game for all players", nil, nil, (settings.get("g_standalone") == 0))
commands.addadmin("unpause", commandUnpause, auth.PERM_PAUSE, "pauses the game for all players", nil, nil, (config.get("g_standalone") == 0))

View file

@ -16,16 +16,12 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local history = wolfa_requireModule("admin.history")
local mutes = wolfa_requireModule("admin.mutes")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local util = wolfa_requireModule("util.util")
local settings = wolfa_requireModule("util.settings")
function commandVoiceMute(clientId, command, victim, ...)
local cmdClient
@ -87,7 +83,7 @@ function commandVoiceMute(clientId, command, victim, ...)
mutes.add(cmdClient, clientId, players.MUTE_VOICE, duration, reason)
if settings.get("g_playerHistory") ~= 0 then
if config.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "vmute", reason)
end

View file

@ -16,21 +16,16 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local history = wolfa_requireModule("admin.history")
local db = wolfa_requireModule("db.db")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local db = wolfa_requireModule("db.db")
local players = wolfa_requireModule("players.players")
local settings = wolfa_requireModule("util.settings")
function commandWarn(clientId, command, victim, ...)
local cmdClient
if not db.isConnected() or settings.get("g_playerHistory") == 0 then
if not db.isConnected() or config.get("g_playerHistory") == 0 then
return false
elseif not victim or not ... then
return false
@ -50,7 +45,7 @@ function commandWarn(clientId, command, victim, ...)
return false
end
commands.addadmin("warn", commandWarn, auth.PERM_WARN, "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", true, (settings.get("g_standalone") ~= 0 or settings.get("g_playerHistory") == 0))
commands.addadmin("warn", commandWarn, auth.PERM_WARN, "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", true, (config.get("g_standalone") ~= 0 or config.get("g_playerHistory") == 0))
function commandWarn(clientId, command, victim, ...)
local cmdClient
@ -83,7 +78,7 @@ function commandWarn(clientId, command, victim, ...)
local reason = table.concat({...}, " ")
if settings.get("g_playerHistory") ~= 0 then
if config.get("g_playerHistory") ~= 0 then
history.add(cmdClient, clientId, "warn", reason)
end
@ -94,4 +89,4 @@ function commandWarn(clientId, command, victim, ...)
return true
end
commands.addadmin("warn", commandWarn, auth.PERM_WARN, "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", nil, (settings.get("g_standalone") == 0))
commands.addadmin("warn", commandWarn, auth.PERM_WARN, "warns a player by displaying the reason", "^9[^3name|slot#^9] ^9[^3reason^9]", nil, (config.get("g_standalone") == 0))

View file

@ -16,11 +16,9 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local logs = wolfa_requireModule("util.logs")
local settings = wolfa_requireModule("util.settings")
local util = wolfa_requireModule("util.util")
function commandPersonalMessage(clientId, command, recipient, ...)
@ -40,8 +38,8 @@ function commandPersonalMessage(clientId, command, recipient, ...)
end
end
end
commands.addclient("pm", commandPersonalMessage, "", "", true, (settings.get("fs_game") == "legacy"))
commands.addclient("m", commandPersonalMessage, "", "", true, (settings.get("fs_game") == "legacy"))
commands.addclient("pm", commandPersonalMessage, "", "", true, (config.get("fs_game") == "legacy"))
commands.addclient("m", commandPersonalMessage, "", "", true, (config.get("fs_game") == "legacy"))
function commandPersonalMessageLegacy(clientId, command, target, ...)
if not target or not ... then
@ -91,5 +89,5 @@ function commandPersonalMessageLegacy(clientId, command, target, ...)
return true
end
commands.addclient("pm", commandPersonalMessageLegacy, "", "[^2name^7|^2slot#^7] [^2message^7]", true, (settings.get("fs_game") ~= "legacy"))
commands.addclient("m", commandPersonalMessageLegacy, "", "[^2name^7|^2slot#^7] [^2message^7]", true, (settings.get("fs_game") ~= "legacy"))
commands.addclient("pm", commandPersonalMessageLegacy, "", "[^2name^7|^2slot#^7] [^2message^7]", true, (config.get("fs_game") ~= "legacy"))
commands.addclient("m", commandPersonalMessageLegacy, "", "[^2name^7|^2slot#^7] [^2message^7]", true, (config.get("fs_game") ~= "legacy"))

View file

@ -16,15 +16,11 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local censor = wolfa_requireModule("admin.censor")
local auth = wolfa_requireModule("auth.auth")
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local logs = wolfa_requireModule("util.logs")
local settings = wolfa_requireModule("util.settings")
local util = wolfa_requireModule("util.util")
local types = {
@ -44,7 +40,7 @@ function commandSay(clientId, command, ...)
return true
end
if settings.get("g_censor") ~= 0 and not auth.isPlayerAllowed(clientId, auth.PERM_NOCENSOR) then
if config.get("g_censor") ~= 0 and not auth.isPlayerAllowed(clientId, auth.PERM_NOCENSOR) then
local censored, message = censor.filterMessage(...)
if censored then
@ -56,14 +52,14 @@ function commandSay(clientId, command, ...)
end
end
if settings.get("fs_game") == "legacy" then
if config.get("fs_game") == "legacy" then
logs.writeChat(clientId, types[command], ...)
end
end
commands.addclient("say", commandSay, "", "", false, (settings.get("g_standalone") == 0))
commands.addclient("say_team", commandSay, "", "", false, (settings.get("g_standalone") == 0))
commands.addclient("say_teamnl", commandSay, "", "", false, (settings.get("g_standalone") == 0))
commands.addclient("say_buddy", commandSay, "", "", false, (settings.get("g_standalone") == 0))
commands.addclient("say", commandSay, "", "", false, (config.get("g_standalone") == 0))
commands.addclient("say_team", commandSay, "", "", false, (config.get("g_standalone") == 0))
commands.addclient("say_teamnl", commandSay, "", "", false, (config.get("g_standalone") == 0))
commands.addclient("say_buddy", commandSay, "", "", false, (config.get("g_standalone") == 0))
function commandVoiceSay(clientId, command, ...)
if players.isMuted(clientId, players.MUTE_VOICE) then
@ -72,7 +68,7 @@ function commandVoiceSay(clientId, command, ...)
return true
end
if settings.get("fs_game") == "legacy" then
if config.get("fs_game") == "legacy" then
logs.writeChat(clientId, types[command], ...)
end
end

View file

@ -16,13 +16,10 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local commands = wolfa_requireModule("commands.commands")
local config = wolfa_requireModule("config.config")
local teams = wolfa_requireModule("game.teams")
local players = wolfa_requireModule("players.players")
local util = wolfa_requireModule("util.util")
local settings = wolfa_requireModule("util.settings")
function commandTeam(clientId, command)
if players.isTeamLocked(clientId) then
@ -36,7 +33,7 @@ function commandTeam(clientId, command)
end
local team = util.getTeamFromCode(et.trap_Argv(1))
if settings.get("g_standalone") ~= 0 and teams.isLocked(team) then
if config.get("g_standalone") ~= 0 and teams.isLocked(team) then
local teamName = util.getTeamName(team)
local teamColor = util.getTeamColor(team)

View file

@ -16,13 +16,10 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local acl = wolfa_requireModule("auth.acl")
local config = wolfa_requireModule("config.config")
local db = wolfa_requireModule("db.db")
local commands = wolfa_requireModule("commands.commands")
local settings = wolfa_requireModule("util.settings")
function commandAclListLevels()
for _, level in ipairs(acl.getLevels()) do
et.G_Print(string.format("%5d %30s %6d players", level["id"], level["name"], level["players"]).."\n")
@ -207,4 +204,4 @@ function commandAcl(command, action, ...)
return true
end
commands.addserver("acl", commandAcl, (settings.get("g_standalone") == 0 or not db.isConnected()))
commands.addserver("acl", commandAcl, (config.get("g_standalone") == 0 or not db.isConnected()))

View file

@ -18,7 +18,7 @@
local toml = wolfa_requireLib("toml")
local events = wolfa_requireModule("util.events")
local settings = {}
local config = {}
local data = {
["g_logChat"] = "chat.log",
@ -151,15 +151,15 @@ local cfgStructure = {
}
}
function settings.get(name)
function config.get(name)
return data[name]
end
function settings.set(name, value)
function config.set(name, value)
data[name] = value
end
function settings.load()
function config.load()
-- compatibility for 1.1.* and lower
for setting, default in pairs(data) do
local cvar = et.trap_Cvar_Get(setting)
@ -179,8 +179,8 @@ function settings.load()
et.trap_FS_FCloseFile(fileDescriptor)
local fileTable = toml.parse(fileString)
for module, settings in pairs(fileTable) do
for setting, value in pairs(settings) do
for module, config in pairs(fileTable) do
for setting, value in pairs(config) do
if cfgStructure[module] and cfgStructure[module][setting] then
data[cfgStructure[module][setting]] = value
end
@ -198,22 +198,22 @@ function settings.load()
local files = wolfa_requireModule("util.files")
local _, array = files.loadFromCFG("wolfadmin.cfg", "[a-z]+")
for blocksname, settings in pairs(array) do
for k, v in pairs(settings[1]) do
for blocksname, config in pairs(array) do
for k, v in pairs(config[1]) do
data[cfgStructure[blocksname][k]] = v
end
end
end
settings.determineOS()
settings.determineMode()
config.determineOS()
config.determineMode()
outputDebug("WolfAdmin running in "..(settings.get("g_standalone") ~= 0 and "standalone" or "add-on").." mode on "..settings.get("sv_os")..".")
outputDebug("WolfAdmin running in "..(config.get("g_standalone") ~= 0 and "standalone" or "add-on").." mode on "..config.get("sv_os")..".")
end
function settings.determineOS()
function config.determineOS()
-- OS has been manually specified
local os = settings.get("sv_os") and string.lower(settings.get("sv_os")) or nil
local os = config.get("sv_os") and string.lower(config.get("sv_os")) or nil
if os == "unix" or os == "windows" then
return
@ -227,7 +227,7 @@ function settings.determineOS()
-- 'uname' is available on Unix systems
local uname = io.popen("uname -s 2>nul"):read("*l")
if uname then
settings.set("sv_os", "unix")
config.set("sv_os", "unix")
return
end
@ -235,38 +235,38 @@ function settings.determineOS()
-- 'ver' is available on Windows systems
local ver = io.popen("ver 2>nul"):read("*l")
if ver then
settings.set("sv_os", "windows")
config.set("sv_os", "windows")
return
end
outputDebug("Operating system could not be determined, falling back to 'unix'.", 3)
settings.set("sv_os", "unix")
config.set("sv_os", "unix")
end
function settings.determineMode()
settings.set("fs_game", et.trap_Cvar_Get("fs_game"))
function config.determineMode()
config.set("fs_game", et.trap_Cvar_Get("fs_game"))
-- mode has been manually specified
if settings.get("g_standalone") then
if config.get("g_standalone") then
return
end
local shrubbot = et.trap_Cvar_Get("g_shrubbot") -- etpub, nq
local dbDir = et.trap_Cvar_Get("g_dbDirectory") -- silent
if settings.get("fs_game") == "legacy" or settings.get("fs_game") == "etpro" then
settings.set("g_standalone", 1)
if config.get("fs_game") == "legacy" or config.get("fs_game") == "etpro" then
config.set("g_standalone", 1)
elseif (not shrubbot or shrubbot == "") and (not dbDir or dbDir == "") then
settings.set("g_standalone", 1)
config.set("g_standalone", 1)
else
settings.set("g_standalone", 0)
config.set("g_standalone", 0)
end
end
function settings.oninit(levelTime, randomSeed, restartMap)
settings.load()
function config.oninit(levelTime, randomSeed, restartMap)
config.load()
end
events.handle("onGameInit", settings.oninit)
events.handle("onGameInit", config.oninit)
return settings
return config

View file

@ -15,8 +15,8 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local config = wolfa_requireModule("config.config")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local db = {}
@ -30,10 +30,10 @@ end
-- system in this function. might have to think of a better way to implement
-- this, but it will suffice.
function db.oninit()
if settings.get("db_type") ~= "none" then
if settings.get("db_type") == "sqlite3" then
if config.get("db_type") ~= "none" then
if config.get("db_type") == "sqlite3" then
con = wolfa_requireModule("db.sqlite3")
elseif settings.get("db_type") == "mysql" then
elseif config.get("db_type") == "mysql" then
con = wolfa_requireModule("db.mysql")
else
outputDebug("Invalid database system (none|sqlite3|mysql), defaulting to 'none'.")

View file

@ -15,11 +15,10 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local constants = wolfa_requireModule("util.constants")
local util = wolfa_requireModule("util.util")
local settings = wolfa_requireModule("util.settings")
local tables = wolfa_requireModule("util.tables")
local luasql = require "luasql.mysql"
@ -32,7 +31,7 @@ local cur
-- config
function mysql.isSchemaExistent()
cur = assert(con:execute("SELECT * FROM `information_schema`.`tables` WHERE `table_schema`='"..con:escape(settings.get("db_database")).."' AND `table_name`='config' LIMIT 1"))
cur = assert(con:execute("SELECT * FROM `information_schema`.`tables` WHERE `table_schema`='"..con:escape(config.get("db_database")).."' AND `table_name`='config' LIMIT 1"))
local tbl = cur:fetch({}, "a")
cur:close()
@ -528,7 +527,7 @@ function mysql.isConnected()
end
function mysql.start()
con = env:connect(settings.get("db_database"), settings.get("db_username"), settings.get("db_password"), settings.get("db_hostname"), settings.get("db_port"))
con = env:connect(config.get("db_database"), config.get("db_username"), config.get("db_password"), config.get("db_hostname"), config.get("db_port"))
if not con then
outputDebug("Could not connect to database.", 3)

View file

@ -15,13 +15,11 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local constants = wolfa_requireModule("util.constants")
local util = wolfa_requireModule("util.util")
local settings = wolfa_requireModule("util.settings")
local tables = wolfa_requireModule("util.tables")
local luasql = require "luasql.sqlite3"
local sqlite3 = {}
@ -528,7 +526,7 @@ function sqlite3.isConnected()
end
function sqlite3.start()
local uri, file = nil, settings.get("db_file")
local uri, file = nil, config.get("db_file")
if string.find(file, ":memory:%?cache=shared") then
uri = file

View file

@ -15,10 +15,9 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local config = wolfa_requireModule("config.config")
local players = wolfa_requireModule("players.players")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local util = wolfa_requireModule("util.util")
local bots = {}
@ -27,7 +26,7 @@ function bots.put(team)
local team = util.getTeamCode(team)
local command
if settings.get("g_standalone") ~= 0 then
if config.get("g_standalone") ~= 0 then
command = "forceteam"
else
command = "!put"
@ -43,7 +42,7 @@ end
function bots.enable(enable)
if enable then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "bot minbots -1;")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "bot maxbots "..settings.get("omnibot_maxbots")..";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "bot maxbots "..config.get("omnibot_maxbots")..";")
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "bot minbots -1;")
et.trap_SendConsoleCommand(et.EXEC_APPEND, "bot maxbots -1;")

View file

@ -15,16 +15,13 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local config = wolfa_requireModule("config.config")
local db = wolfa_requireModule("db.db")
local game = wolfa_requireModule("game.game")
local players = wolfa_requireModule("players.players")
local bits = wolfa_requireModule("util.bits")
local constants = wolfa_requireModule("util.constants")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local timers = wolfa_requireModule("util.timers")
local toml = wolfa_requireLib("toml")
@ -70,7 +67,7 @@ function combis.load()
combiMessagesByType[i] = {}
end
local fileName = settings.get("g_fileCombis")
local fileName = config.get("g_fileCombis")
if fileName == "" then
return 0
@ -112,14 +109,14 @@ end
function combis.printCombi(clientId, type)
local currentCombi = playerCombis[clientId][type]["total"]
if bits.hasbit(settings.get("g_combiMessages"), 2^type) and #combiMessagesByType[type] > 0 then
if bits.hasbit(config.get("g_combiMessages"), 2^type) and #combiMessagesByType[type] > 0 then
local combiMessage = combiMessages[type][currentCombi]
if combiMessage then
local msg = string.gsub(combiMessage["msg"], "%[N%]", players.getName(clientId))
if settings.get("g_combiSounds") > 0 and combiMessage["sound"] and combiMessage["sound"] ~= "" then
if bits.hasbit(settings.get("g_combiSounds"), combis.SOUND_PLAY_PUBLIC) then
if config.get("g_combiSounds") > 0 and combiMessage["sound"] and combiMessage["sound"] ~= "" then
if bits.hasbit(config.get("g_combiSounds"), combis.SOUND_PLAY_PUBLIC) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound \"sound/combi/"..combiMessage["sound"].."\";")
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound "..clientId.." \"sound/combi/"..combiMessage["sound"].."\";")
@ -161,7 +158,7 @@ function combis.onGameStateChange(gameState)
end
function combis.onPlayerCombi(clientId, type, sourceId)
if not playerCombis[clientId][type]["last"] or et.trap_Milliseconds() - playerCombis[clientId][type]["last"] > settings.get("g_combiTime") then
if not playerCombis[clientId][type]["last"] or et.trap_Milliseconds() - playerCombis[clientId][type]["last"] > config.get("g_combiTime") then
playerCombis[clientId][type]["total"] = 0
elseif playerCombis[clientId][type]["timer"] then
timers.remove(playerCombis[clientId][type]["timer"])
@ -169,7 +166,7 @@ function combis.onPlayerCombi(clientId, type, sourceId)
playerCombis[clientId][type]["last"] = et.trap_Milliseconds()
playerCombis[clientId][type]["total"] = playerCombis[clientId][type]["total"] + 1
playerCombis[clientId][type]["timer"] = timers.add(combis.printCombi, settings.get("g_combiTime"), 1, clientId, type)
playerCombis[clientId][type]["timer"] = timers.add(combis.printCombi, config.get("g_combiTime"), 1, clientId, type)
end
function combis.onPlayerDeath(victimId, attackerId, meansOfDeath)

View file

@ -15,8 +15,8 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local config = wolfa_requireModule("config.config")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local util = wolfa_requireModule("util.util")
local players = wolfa_requireModule("players.players")
@ -98,7 +98,7 @@ end
events.handle("onPlayerDeath", game.ondeath)
function game.onrevive(clientMedic, clientVictim)
if settings.get("g_announceRevives") ~= 0 then
if config.get("g_announceRevives") ~= 0 then
for playerId = 0, et.trap_Cvar_Get("sv_maxclients") - 1 do
if players.isConnected(playerId) and tonumber(et.gentity_get(playerId, "sess.sessionTeam")) == tonumber(et.gentity_get(clientMedic, "sess.sessionTeam")) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat "..playerId.." \"^drevive: ^7"..et.gentity_get(clientMedic, "pers.netname").." ^9revived ^7"..et.gentity_get(clientVictim, "pers.netname").."^9.\";")

View file

@ -16,17 +16,13 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local db = wolfa_requireModule("db.db")
local config = wolfa_requireModule("config.config")
local game = wolfa_requireModule("game.game")
local players = wolfa_requireModule("players.players")
local bits = wolfa_requireModule("util.bits")
local constants = wolfa_requireModule("util.constants")
local events = wolfa_requireModule("util.events")
local files = wolfa_requireModule("util.files")
local settings = wolfa_requireModule("util.settings")
local toml = wolfa_requireLib("toml")
local sprees = {}
@ -88,7 +84,7 @@ function sprees.reset(truncate)
end
function sprees.load()
if db.isConnected() and settings.get("g_spreeRecords") ~= 0 then
if db.isConnected() and config.get("g_spreeRecords") ~= 0 then
local map = db.getMap(game.getMap())
if map then
@ -114,7 +110,7 @@ function sprees.load()
spreeMessagesByType[i] = {}
end
local fileName = settings.get("g_fileSprees")
local fileName = config.get("g_fileSprees")
if fileName == "" then
return 0
@ -176,7 +172,7 @@ function sprees.load()
end
function sprees.save()
if db.isConnected() and settings.get("g_spreeRecords") ~= 0 then
if db.isConnected() and config.get("g_spreeRecords") ~= 0 then
for i = 0, sprees.TYPE_NUM - 1 do
if currentRecords[i] and currentRecords[i]["record"] > 0 then
if db.getRecord(currentMapId, i) then
@ -190,7 +186,7 @@ function sprees.save()
end
function sprees.printRecords()
if db.isConnected() and settings.get("g_spreeRecords") ~= 0 then
if db.isConnected() and config.get("g_spreeRecords") ~= 0 then
for i = 0, sprees.TYPE_NUM - 1 do
if currentRecords[i] and currentRecords[i]["record"] > 0 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "cchat -1 \"^dsprees: ^9longest "..sprees.getRecordNameByType(i).." spree (^7"..currentRecords[i]["record"].."^9) by ^7"..db.getLastAlias(currentRecords[i]["player"])["alias"].."^9.\";")
@ -242,10 +238,10 @@ function sprees.onPlayerSpree(clientId, causeId, type)
local currentSpree = playerSprees[clientId][type]
if db.isConnected() and settings.get("g_spreeRecords") ~= 0 and
(bits.hasbit(settings.get("g_botRecords"), sprees.RECORD_BOTS_PLAYING) or tonumber(et.trap_Cvar_Get("omnibot_playing")) == 0) and
(bits.hasbit(settings.get("g_botRecords"), sprees.RECORD_BOTS) or not players.isBot(clientId)) and
(bits.hasbit(settings.get("g_botRecords"), sprees.RECORD_BOTS) or not players.isBot(causeId)) and
if db.isConnected() and config.get("g_spreeRecords") ~= 0 and
(bits.hasbit(config.get("g_botRecords"), sprees.RECORD_BOTS_PLAYING) or tonumber(et.trap_Cvar_Get("omnibot_playing")) == 0) and
(bits.hasbit(config.get("g_botRecords"), sprees.RECORD_BOTS) or not players.isBot(clientId)) and
(bits.hasbit(config.get("g_botRecords"), sprees.RECORD_BOTS) or not players.isBot(causeId)) and
(not currentRecords[type] or currentSpree > currentRecords[type]["record"])
then
currentRecords[type] = {
@ -266,8 +262,8 @@ function sprees.onPlayerSpree(clientId, causeId, type)
currentSpree,
spreeNames[type])
if settings.get("g_spreeSounds") > 0 and spreeMessage["sound"] and spreeMessage["sound"] ~= "" and files.exists("sound/spree/"..spreeMessage["sound"]) then
if bits.hasbit(settings.get("g_spreeSounds"), sprees.SOUND_PLAY_PUBLIC) then
if config.get("g_spreeSounds") > 0 and spreeMessage["sound"] and spreeMessage["sound"] ~= "" and files.exists("sound/spree/"..spreeMessage["sound"]) then
if bits.hasbit(config.get("g_spreeSounds"), sprees.SOUND_PLAY_PUBLIC) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound \"sound/spree/"..spreeMessage["sound"].."\";")
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound "..clientId.." \"sound/spree/"..spreeMessage["sound"].."\";")
@ -283,8 +279,8 @@ function sprees.onPlayerSpree(clientId, causeId, type)
currentSpree,
spreeNames[type])
if settings.get("g_spreeSounds") > 0 and maxSpreeMessage["sound"] and maxSpreeMessage["sound"] ~= "" and files.exists("sound/spree/"..maxSpreeMessage["sound"]) then
if bits.hasbit(settings.get("g_spreeSounds"), sprees.SOUND_PLAY_PUBLIC) then
if config.get("g_spreeSounds") > 0 and maxSpreeMessage["sound"] and maxSpreeMessage["sound"] ~= "" and files.exists("sound/spree/"..maxSpreeMessage["sound"]) then
if bits.hasbit(config.get("g_spreeSounds"), sprees.SOUND_PLAY_PUBLIC) then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound \"sound/spree/"..maxSpreeMessage["sound"].."\";")
else
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound "..clientId.." \"sound/spree/"..maxSpreeMessage["sound"].."\";")
@ -384,7 +380,7 @@ function sprees.onPlayerRevive(clientMedic, clientVictim)
end
function sprees.isSpreeEnabled(type)
return bits.hasbit(settings.get("g_spreeMessages"), 2^type)
return bits.hasbit(config.get("g_spreeMessages"), 2^type)
end
function sprees.isPlayerOnSpree(clientId, type)

View file

@ -16,10 +16,9 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local config = wolfa_requireModule("config.config")
local constants = wolfa_requireModule("util.constants")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local timers = wolfa_requireModule("util.timers")
local util = wolfa_requireModule("util.util")
@ -63,7 +62,7 @@ function voting.load()
forced[type] = 0
end
local restrictedVotes = util.split(settings.get("g_restrictedVotes"), ",")
local restrictedVotes = util.split(config.get("g_restrictedVotes"), ",")
for _, type in pairs(restrictedVotes) do
restricted[type] = 1
@ -73,15 +72,15 @@ end
function voting.onGameInit(levelTime, randomSeed, restartMap)
voting.load()
if settings.get("g_voteNextMapTimeout") > 0 then
if config.get("g_voteNextMapTimeout") > 0 then
voting.allow("nextmap", 1)
end
end
events.handle("onGameInit", voting.onGameInit)
function voting.onGameStateChange(gameState)
if gameState == 0 and settings.get("g_voteNextMapTimeout") > 0 then
timers.add(voting.disableNextMap, settings.get("g_voteNextMapTimeout") * 1000, 1)
if gameState == 0 and config.get("g_voteNextMapTimeout") > 0 then
timers.add(voting.disableNextMap, config.get("g_voteNextMapTimeout") * 1000, 1)
end
end
events.handle("onGameStateChange", voting.onGameStateChange)

View file

@ -30,6 +30,8 @@ local db
local commands
local config
local bots
local combis
local fireteams
@ -48,7 +50,6 @@ local events
local files
local logs
local pagination
local settings
local tables
local timers
local vectors
@ -124,6 +125,8 @@ function et_InitGame(levelTime, randomSeed, restartMap)
commands = wolfa_requireModule("commands.commands")
config = wolfa_requireModule("config.config")
bots = wolfa_requireModule("game.bots")
combis = wolfa_requireModule("game.combis")
game = wolfa_requireModule("game.game")
@ -142,7 +145,6 @@ function et_InitGame(levelTime, randomSeed, restartMap)
files = wolfa_requireModule("util.files")
logs = wolfa_requireModule("util.logs")
pagination = wolfa_requireModule("util.pagination")
settings = wolfa_requireModule("util.settings")
tables = wolfa_requireModule("util.tables")
timers = wolfa_requireModule("util.timers")
vectors = wolfa_requireModule("util.vectors")

View file

@ -16,15 +16,12 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local auth = wolfa_requireModule("auth.auth")
local config = wolfa_requireModule("config.config")
local db = wolfa_requireModule("db.db")
local players = wolfa_requireModule("players.players")
local constants = wolfa_requireModule("util.constants")
local util = wolfa_requireModule("util.util")
local events = wolfa_requireModule("util.events")
local settings = wolfa_requireModule("util.settings")
local files = wolfa_requireModule("util.files")
local toml = wolfa_requireLib("toml")
@ -54,11 +51,11 @@ function greetings.show(clientId)
local greeting = greetings.get(clientId)
if greeting then
local prefix = (util.getAreaName(settings.get("g_greetingArea")) ~= "cp") and "^dgreeting: ^9" or "^7"
local prefix = (util.getAreaName(config.get("g_greetingArea")) ~= "cp") and "^dgreeting: ^9" or "^7"
local text = prefix..greeting["text"]:gsub("%[N%]", et.gentity_get(clientId, "pers.netname"))
local out = ""
while util.getAreaName(settings.get("g_greetingArea")) == "cp" and string.len(text) > constants.MAX_LENGTH_CP do
while util.getAreaName(config.get("g_greetingArea")) == "cp" and string.len(text) > constants.MAX_LENGTH_CP do
local sub = text:sub(1, constants.MAX_LENGTH_CP)
local rev = sub:reverse()
@ -79,12 +76,12 @@ function greetings.show(clientId)
et.trap_SendConsoleCommand(et.EXEC_APPEND, "playsound \"/sound/"..greeting["sound"].."\";")
end
et.trap_SendConsoleCommand(et.EXEC_APPEND, util.getAreaName(settings.get("g_greetingArea")).." \""..out..text.."\";")
et.trap_SendConsoleCommand(et.EXEC_APPEND, util.getAreaName(config.get("g_greetingArea")).." \""..out..text.."\";")
end
end
function greetings.load()
local fileName = settings.get("g_fileGreetings")
local fileName = config.get("g_fileGreetings")
if fileName == "" then
return 0
@ -163,7 +160,7 @@ function greetings.load()
end
function greetings.oninit(levelTime, randomSeed, restartMap)
if settings.get("g_fileGreetings") ~= "" then
if config.get("g_fileGreetings") ~= "" then
greetings.load()
events.handle("onPlayerReady", greetings.onready)
@ -172,7 +169,7 @@ end
events.handle("onGameInit", greetings.oninit)
function greetings.onready(clientId, firstTime)
if firstTime and (not players.isBot(clientId) or settings.get("g_botGreetings") == 1) then
if firstTime and (not players.isBot(clientId) or config.get("g_botGreetings") == 1) then
greetings.show(clientId)
end
end

View file

@ -15,7 +15,7 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
local COLOURS_CHAT = {
[1] = "^_", -- termination
@ -43,7 +43,7 @@ function outputDebug(msg, severity)
et.G_Print("[WolfAdmin] "..COLOURS_CONSOLE[severity]..msg.."\n")
for playerId = 0, et.trap_Cvar_Get("sv_maxclients") - 1 do
if settings.get("g_debugWolfAdmin") ~= 0 then
if config.get("g_debugWolfAdmin") ~= 0 then
et.trap_SendConsoleCommand(et.EXEC_APPEND, "csay "..playerId.." \"^:[WolfAdmin DEBUG] "..COLOURS_CHAT[severity]..msg.."\";")
end
end

View file

@ -15,12 +15,12 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local settings = wolfa_requireModule("util.settings")
local config = wolfa_requireModule("config.config")
local files = {}
function files.ls(directory)
local platform, command = settings.get("sv_os"), ""
local platform, command = config.get("sv_os"), ""
local entries = {}
if platform == "unix" then

View file

@ -16,24 +16,23 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local players = wolfa_requireModule("players.players")
local config = wolfa_requireModule("config.config")
local files = wolfa_requireModule("util.files")
local settings = wolfa_requireModule("util.settings")
local logs = {}
function logs.writeChat(clientId, type, ...)
if settings.get("g_logChat") == "" then
if config.get("g_logChat") == "" then
return
end
if not files.exists(settings.get("g_logChat")) then
local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logChat"), et.FS_WRITE)
if not files.exists(config.get("g_logChat")) then
local fileDescriptor, _ = et.trap_FS_FOpenFile(config.get("g_logChat"), et.FS_WRITE)
et.trap_FS_FCloseFile(fileDescriptor)
end
local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logChat"), et.FS_APPEND)
local fileDescriptor, _ = et.trap_FS_FOpenFile(config.get("g_logChat"), et.FS_APPEND)
local logLine
@ -55,17 +54,17 @@ function logs.writeChat(clientId, type, ...)
end
function logs.writeAdmin(clientId, command, victimId, ...)
if settings.get("g_logAdmin") == "" then
if config.get("g_logAdmin") == "" then
return
end
if not files.exists(settings.get("g_logAdmin")) then
local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logAdmin"), et.FS_WRITE)
if not files.exists(config.get("g_logAdmin")) then
local fileDescriptor, _ = et.trap_FS_FOpenFile(config.get("g_logAdmin"), et.FS_WRITE)
et.trap_FS_FCloseFile(fileDescriptor)
end
local fileDescriptor, _ = et.trap_FS_FOpenFile(settings.get("g_logAdmin"), et.FS_APPEND)
local fileDescriptor, _ = et.trap_FS_FOpenFile(config.get("g_logAdmin"), et.FS_APPEND)
local logLine
@ -74,7 +73,7 @@ function logs.writeAdmin(clientId, command, victimId, ...)
local clientFlags = ""
local args = table.concat({...}, " ")
if settings.get("g_standalone") ~= 0 then
if config.get("g_standalone") ~= 0 then
if victimId then
local victimName = players.getName(victimId)
logLine = string.format("[%s] %s: %s: %s: %s: \"%s\"\n", os.date("%Y-%m-%d %H:%M:%S"), clientGUID, clientName, command, victimName, args)