Fixed shrubbot flags for other mods (refs #46, #69, #62)

* changed !greeting flag from 'Q' to 'j' to maintain consistency across mods
* changed !cointoss flag to 'Z' so we do not take up another flag
* moved flags to separate files for each mod that includes shrubbot, autoloads on game init
This commit is contained in:
Timo Smit 2018-02-16 12:20:23 +01:00
parent 6a3459d988
commit de27a4172b
5 changed files with 335 additions and 88 deletions

View file

@ -55,6 +55,7 @@ auth.PERM_THROW = "throw"
auth.PERM_GLOW = "glow"
auth.PERM_PANTS = "pants"
auth.PERM_POP = "pop"
auth.PERM_NADE = "nade"
auth.PERM_WARN = "warn"
auth.PERM_MUTE = "mute"
@ -86,6 +87,9 @@ auth.PERM_UPTIME = "uptime"
auth.PERM_SETLEVEL = "setlevel"
auth.PERM_READCONFIG = "readconfig"
auth.PERM_CRAZYSETTINGS = "crazysettings"
auth.PERM_WARSETTINGS = "warsettings"
auth.PERM_CHEATS = "cheats"
auth.PERM_DISGUISE = "disguise" -- legacy
auth.PERM_AMMOPACK = "ammopack" -- legacy
@ -117,6 +121,8 @@ function auth.onGameInit()
srv.readPermissions()
else
srv = require (wolfa_getLuaPath()..".auth.shrubbot")
srv.loadFlags(et.trap_Cvar_Get("fs_game"))
end
if settings.get("g_standalone") == 1 and et.trap_Cvar_Get("g_shrubbot") ~= "" then

View file

@ -15,99 +15,21 @@
-- 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 auth = require (wolfa_getLuaPath()..".auth.auth")
local shrubbot = {}
-- available shrubflags: lyFHY
local flags = {
[auth.PERM_ADMINTEST] = "a",
[auth.PERM_HELP] = "h",
[auth.PERM_TIME] = "C",
[auth.PERM_GREETING] = "Q",
local flags
[auth.PERM_LISTPLAYERS] = "i",
[auth.PERM_LISTTEAMS] = "l",
[auth.PERM_LISTMAPS] = "C",
[auth.PERM_LISTSPREES] = "I",
[auth.PERM_LISTRULES] = "C",
[auth.PERM_LISTHISTORY] = "f",
[auth.PERM_LISTBANS] = "B",
[auth.PERM_LISTALIASES] = "f",
[auth.PERM_LISTSTATS] = "I",
[auth.PERM_FINGER] = "f",
[auth.PERM_RESETXP] = "X",
[auth.PERM_RESETXP_SELF] = "M",
[auth.PERM_ADMINCHAT] = "~",
[auth.PERM_PUT] = "p",
[auth.PERM_DROPWEAPONS] = "D",
[auth.PERM_RENAME] = "N",
[auth.PERM_FREEZE] = "E",
[auth.PERM_DISORIENT] = "d",
[auth.PERM_BURN] = "U",
[auth.PERM_SLAP] = "A",
[auth.PERM_GIB] = "g",
[auth.PERM_THROW] = "L",
[auth.PERM_GLOW] = "o",
[auth.PERM_PANTS] = "t",
[auth.PERM_POP] = "z",
[auth.PERM_WARN] = "R",
[auth.PERM_MUTE] = "m",
[auth.PERM_VOICEMUTE] = "m",
[auth.PERM_KICK] = "k",
[auth.PERM_BAN] = "b",
[auth.PERM_SPEC999] = "P",
[auth.PERM_BALANCE] = "p",
[auth.PERM_LOCKPLAYER] = "L",
[auth.PERM_LOCKTEAM] = "L",
[auth.PERM_SHUFFLE] = "S",
[auth.PERM_SWAP] = "w",
[auth.PERM_COINTOSS] = "q",
[auth.PERM_PAUSE] = "Z",
[auth.PERM_NEXTMAP] = "n",
[auth.PERM_RESTART] = "r",
[auth.PERM_BOTADMIN] = "O",
[auth.PERM_ENABLEVOTE] = "c",
[auth.PERM_CANCELVOTE] = "c",
[auth.PERM_PASSVOTE] = "V",
[auth.PERM_NEWS] = "W",
[auth.PERM_UPTIME] = "u",
[auth.PERM_SETLEVEL] = "s",
[auth.PERM_READCONFIG] = "G",
[auth.PERM_CHEATS] = "e",
[auth.PERM_DISGUISE] = "T",
[auth.PERM_AMMOPACK] = "J",
[auth.PERM_MEDPACK] = "J",
[auth.PERM_REVIVE] = "v",
[auth.PERM_NOINACTIVITY] = "0",
[auth.PERM_NOVOTE] = "1",
[auth.PERM_NOCENSOR] = "2",
[auth.PERM_NOBALANCE] = "5",
[auth.PERM_NOVOTELIMIT] = "7",
[auth.PERM_NOREASON] = "6",
[auth.PERM_PERMA] = "8",
[auth.PERM_TEAMCMDS] = "9",
[auth.PERM_SILENTCMDS] = "3",
[auth.PERM_SPY] = "4",
[auth.PERM_INCOGNITO] = "@",
[auth.PERM_IMMUNE] = "!",
}
function shrubbot.loadFlags(mod)
flags = require (wolfa_getLuaPath()..".auth.shrubbot."..mod)
end
function shrubbot.isPlayerAllowed(clientId, permission)
if not flags[permission] then
outputDebug("shrubbot.isPlayerAllowed requested for unknown permission ("..tostring(permission)..")", 3)
return false
end
return et.G_shrubbot_permission(clientId, flags[permission]) == 1
end

View file

@ -0,0 +1,104 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2018 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- 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 auth = require (wolfa_getLuaPath()..".auth.auth")
-- ETPub shrubbot flags
-- left by mod: fjlovyDHJOTY
-- left by WA: flovyDHJTY
local flags = {
[auth.PERM_ADMINTEST] = "a",
[auth.PERM_HELP] = "h",
[auth.PERM_TIME] = "C",
[auth.PERM_GREETING] = "j",
[auth.PERM_LISTPLAYERS] = "i",
[auth.PERM_LISTTEAMS] = "I",
[auth.PERM_LISTMAPS] = "C",
[auth.PERM_LISTSPREES] = "E",
[auth.PERM_LISTRULES] = "C",
[auth.PERM_LISTHISTORY] = "e",
[auth.PERM_LISTBANS] = "B",
[auth.PERM_LISTALIASES] = "e",
[auth.PERM_LISTSTATS] = "t",
[auth.PERM_FINGER] = "e",
[auth.PERM_RESETXP] = "X",
[auth.PERM_RESETXP_SELF] = "M",
[auth.PERM_ADMINCHAT] = "~",
[auth.PERM_PUT] = "p",
[auth.PERM_RENAME] = "N",
[auth.PERM_FREEZE] = "F",
[auth.PERM_DISORIENT] = "d",
[auth.PERM_BURN] = "U",
[auth.PERM_SLAP] = "A",
[auth.PERM_GIB] = "Q", -- g: individual, Q: all players
[auth.PERM_THROW] = "L", -- l: individual, L: all players
[auth.PERM_POP] = "z",
[auth.PERM_NADE] = "x",
[auth.PERM_WARN] = "R",
[auth.PERM_MUTE] = "m",
[auth.PERM_VOICEMUTE] = "m",
[auth.PERM_KICK] = "k",
[auth.PERM_BAN] = "b",
[auth.PERM_SPEC999] = "P",
[auth.PERM_BALANCE] = "S",
[auth.PERM_LOCKPLAYER] = "K",
[auth.PERM_LOCKTEAM] = "K",
[auth.PERM_SHUFFLE] = "S",
[auth.PERM_SWAP] = "w",
[auth.PERM_COINTOSS] = "Z",
[auth.PERM_PAUSE] = "Z",
[auth.PERM_NEXTMAP] = "n",
[auth.PERM_RESTART] = "r",
[auth.PERM_BOTADMIN] = "O",
[auth.PERM_ENABLEVOTE] = "c",
[auth.PERM_CANCELVOTE] = "c",
[auth.PERM_PASSVOTE] = "V",
[auth.PERM_NEWS] = "W",
[auth.PERM_UPTIME] = "u",
[auth.PERM_SETLEVEL] = "s",
[auth.PERM_READCONFIG] = "G",
[auth.PERM_WARSETTINGS] = "q",
[auth.PERM_NOINACTIVITY] = "0",
[auth.PERM_NOVOTE] = "1",
[auth.PERM_NOCENSOR] = "2",
[auth.PERM_NOBALANCE] = "5",
[auth.PERM_NOVOTELIMIT] = "7",
[auth.PERM_NOREASON] = "6",
[auth.PERM_PERMA] = "8",
[auth.PERM_TEAMCMDS] = "9",
[auth.PERM_SILENTCMDS] = "3",
[auth.PERM_SPY] = "4",
[auth.PERM_INCOGNITO] = "@",
[auth.PERM_IMMUNE] = "!",
}
return flags

View file

@ -0,0 +1,110 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2018 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- 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 auth = require (wolfa_getLuaPath()..".auth.auth")
-- NoQuarter shrubbot flags
-- left by mod: jlqyFHOQY
-- left by WA: lyFHQY
local flags = {
[auth.PERM_ADMINTEST] = "a",
[auth.PERM_HELP] = "h",
[auth.PERM_TIME] = "C",
[auth.PERM_GREETING] = "j",
[auth.PERM_LISTPLAYERS] = "i",
[auth.PERM_LISTTEAMS] = "I",
[auth.PERM_LISTMAPS] = "C",
[auth.PERM_LISTSPREES] = "I",
[auth.PERM_LISTRULES] = "C",
[auth.PERM_LISTHISTORY] = "f",
[auth.PERM_LISTBANS] = "B",
[auth.PERM_LISTALIASES] = "f",
[auth.PERM_LISTSTATS] = "I",
[auth.PERM_FINGER] = "f",
[auth.PERM_RESETXP] = "X",
[auth.PERM_RESETXP_SELF] = "M",
[auth.PERM_ADMINCHAT] = "~",
[auth.PERM_PUT] = "p",
[auth.PERM_DROPWEAPONS] = "D",
[auth.PERM_RENAME] = "N",
[auth.PERM_FREEZE] = "E",
[auth.PERM_DISORIENT] = "d",
[auth.PERM_BURN] = "U",
[auth.PERM_SLAP] = "A",
[auth.PERM_GIB] = "g",
[auth.PERM_THROW] = "L",
[auth.PERM_GLOW] = "o",
[auth.PERM_PANTS] = "t",
[auth.PERM_POP] = "z",
[auth.PERM_WARN] = "R",
[auth.PERM_MUTE] = "m",
[auth.PERM_VOICEMUTE] = "m",
[auth.PERM_KICK] = "k",
[auth.PERM_BAN] = "b",
[auth.PERM_SPEC999] = "P",
[auth.PERM_BALANCE] = "p",
[auth.PERM_LOCKPLAYER] = "L",
[auth.PERM_LOCKTEAM] = "L",
[auth.PERM_SHUFFLE] = "S",
[auth.PERM_SWAP] = "w",
[auth.PERM_COINTOSS] = "Z",
[auth.PERM_PAUSE] = "Z",
[auth.PERM_NEXTMAP] = "n",
[auth.PERM_RESTART] = "r",
[auth.PERM_BOTADMIN] = "O",
[auth.PERM_ENABLEVOTE] = "c",
[auth.PERM_CANCELVOTE] = "c",
[auth.PERM_PASSVOTE] = "V",
[auth.PERM_NEWS] = "W",
[auth.PERM_UPTIME] = "u",
[auth.PERM_SETLEVEL] = "s",
[auth.PERM_READCONFIG] = "G",
[auth.PERM_CHEATS] = "e",
[auth.PERM_DISGUISE] = "T",
[auth.PERM_AMMOPACK] = "J",
[auth.PERM_MEDPACK] = "J",
[auth.PERM_REVIVE] = "v",
[auth.PERM_NOINACTIVITY] = "0",
[auth.PERM_NOVOTE] = "1",
[auth.PERM_NOCENSOR] = "2",
[auth.PERM_NOBALANCE] = "5",
[auth.PERM_NOVOTELIMIT] = "7",
[auth.PERM_NOREASON] = "6",
[auth.PERM_PERMA] = "8",
[auth.PERM_TEAMCMDS] = "9",
[auth.PERM_SILENTCMDS] = "3",
[auth.PERM_SPY] = "4",
[auth.PERM_INCOGNITO] = "@",
[auth.PERM_IMMUNE] = "!",
}
return flags

View file

@ -0,0 +1,105 @@
-- WolfAdmin module for Wolfenstein: Enemy Territory servers.
-- Copyright (C) 2015-2018 Timo 'Timothy' Smit
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- at your option any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- 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 auth = require (wolfa_getLuaPath()..".auth.auth")
-- silEnT shrubbot flags
-- left by mod: fhjovyDHJOTY
-- left by WA: fhovyDHJTY
local flags = {
[auth.PERM_ADMINTEST] = "a",
[auth.PERM_HELP] = "", -- left blank intentionally
[auth.PERM_TIME] = "", -- left blank intentionally
[auth.PERM_GREETING] = "j",
[auth.PERM_LISTPLAYERS] = "i",
[auth.PERM_LISTTEAMS] = "I",
[auth.PERM_LISTMAPS] = "h",
[auth.PERM_LISTSPREES] = "E",
[auth.PERM_LISTRULES] = "h",
[auth.PERM_LISTHISTORY] = "e",
[auth.PERM_LISTBANS] = "B",
[auth.PERM_LISTALIASES] = "e",
[auth.PERM_LISTSTATS] = "t",
[auth.PERM_FINGER] = "e",
[auth.PERM_RESETXP] = "X",
[auth.PERM_RESETXP_SELF] = "M",
[auth.PERM_ADMINCHAT] = "~",
[auth.PERM_PUT] = "p",
[auth.PERM_RENAME] = "N",
[auth.PERM_FREEZE] = "F",
[auth.PERM_DISORIENT] = "d",
[auth.PERM_BURN] = "U",
[auth.PERM_SLAP] = "A",
[auth.PERM_GIB] = "Q", -- g: individual, Q: all players
[auth.PERM_THROW] = "L", -- l: individual, L: all players
[auth.PERM_POP] = "z",
[auth.PERM_NADE] = "x",
[auth.PERM_WARN] = "R",
[auth.PERM_MUTE] = "m",
[auth.PERM_VOICEMUTE] = "m",
[auth.PERM_KICK] = "k",
[auth.PERM_BAN] = "b", -- TODO: subnet ban, flag . (dot)
[auth.PERM_SPEC999] = "P",
[auth.PERM_BALANCE] = "I",
[auth.PERM_LOCKPLAYER] = "K",
[auth.PERM_LOCKTEAM] = "K",
[auth.PERM_SHUFFLE] = "S",
[auth.PERM_SWAP] = "w",
[auth.PERM_COINTOSS] = "Z",
[auth.PERM_PAUSE] = "Z",
[auth.PERM_NEXTMAP] = "n",
[auth.PERM_RESTART] = "r",
[auth.PERM_BOTADMIN] = "O",
[auth.PERM_ENABLEVOTE] = "c",
[auth.PERM_CANCELVOTE] = "c",
[auth.PERM_PASSVOTE] = "V",
[auth.PERM_NEWS] = "W",
[auth.PERM_UPTIME] = "u",
[auth.PERM_SETLEVEL] = "s",
[auth.PERM_READCONFIG] = "G",
[auth.PERM_CRAZYSETTINGS] = "C",
[auth.PERM_WARSETTINGS] = "q",
[auth.PERM_NOINACTIVITY] = "0",
[auth.PERM_NOVOTE] = "1",
[auth.PERM_NOCENSOR] = "2",
[auth.PERM_NOBALANCE] = "5",
[auth.PERM_NOVOTELIMIT] = "7",
[auth.PERM_NOREASON] = "6",
[auth.PERM_PERMA] = "8",
[auth.PERM_TEAMCMDS] = "9",
[auth.PERM_SILENTCMDS] = "3",
[auth.PERM_SPY] = "4",
[auth.PERM_INCOGNITO] = "@",
[auth.PERM_IMMUNE] = "!",
}
return flags