Skip to content

Commit

Permalink
Fixed shrubbot flags for other mods (refs #46, #69, #62)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Timo Smit committed Feb 16, 2018
1 parent 6a3459d commit de27a41
Show file tree
Hide file tree
Showing 5 changed files with 334 additions and 87 deletions.
6 changes: 6 additions & 0 deletions luamods/wolfadmin/auth/auth.lua
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
96 changes: 9 additions & 87 deletions luamods/wolfadmin/auth/shrubbot.lua
Expand Up @@ -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",

[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",
local flags

[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",
function shrubbot.loadFlags(mod)
flags = require (wolfa_getLuaPath()..".auth.shrubbot."..mod)
end

[auth.PERM_TEAMCMDS] = "9",
[auth.PERM_SILENTCMDS] = "3",
function shrubbot.isPlayerAllowed(clientId, permission)
if not flags[permission] then
outputDebug("shrubbot.isPlayerAllowed requested for unknown permission ("..tostring(permission)..")", 3)

[auth.PERM_SPY] = "4",
[auth.PERM_INCOGNITO] = "@",
[auth.PERM_IMMUNE] = "!",
}
return false
end

function shrubbot.isPlayerAllowed(clientId, permission)
return et.G_shrubbot_permission(clientId, flags[permission]) == 1
end

Expand Down
104 changes: 104 additions & 0 deletions luamods/wolfadmin/auth/shrubbot/etpub.lua
@@ -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
110 changes: 110 additions & 0 deletions luamods/wolfadmin/auth/shrubbot/nq.lua
@@ -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

0 comments on commit de27a41

Please sign in to comment.