Browse Source

RenX.Core: Game commands can now be disabled by setting a negative access level.

RenXGameCommands.ini: Minor typo correction
RenX.ModSystem: Minor DevBot related tweak
pull/3/head
Jessica James 8 years ago
parent
commit
2ba04558d5
  1. BIN
      Release/Plugins/RenX.Core.lib
  2. 17
      RenX.Core/RenX_Server.cpp
  3. 2
      RenX.ModSystem/RenX_ModSystem.cpp
  4. 4
      RenXGameCommands.ini

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

17
RenX.Core/RenX_Server.cpp

@ -17,7 +17,6 @@
*/ */
#include <ctime> #include <ctime>
#include <WinSock2.h>
#include "Jupiter/INIFile.h" #include "Jupiter/INIFile.h"
#include "Jupiter/String.h" #include "Jupiter/String.h"
#include "ServerManager.h" #include "ServerManager.h"
@ -1090,13 +1089,23 @@ unsigned int RenX::Server::triggerCommand(const Jupiter::ReadableString &trigger
void RenX::Server::addCommand(RenX::GameCommand *command) void RenX::Server::addCommand(RenX::GameCommand *command)
{ {
RenX::Server::commands.add(command); int access_level;
if (RenX::Server::commandAccessLevels != nullptr) if (RenX::Server::commandAccessLevels != nullptr)
{ {
const Jupiter::ReadableString &accessLevel = RenX::Server::commandAccessLevels->get(command->getTrigger()); const Jupiter::ReadableString &accessLevel = RenX::Server::commandAccessLevels->get(command->getTrigger());
if (accessLevel.isNotEmpty()) if (accessLevel.isNotEmpty())
command->setAccessLevel(accessLevel.asInt()); {
access_level = accessLevel.asInt();
if (access_level < 0) // Disabled command
{
delete command;
return;
}
command->setAccessLevel(access_level);
}
} }
if (RenX::Server::commandAliases != nullptr) if (RenX::Server::commandAliases != nullptr)
{ {
const Jupiter::ReadableString &aliasList = RenX::Server::commandAliases->get(command->getTrigger()); const Jupiter::ReadableString &aliasList = RenX::Server::commandAliases->get(command->getTrigger());
@ -1104,6 +1113,8 @@ void RenX::Server::addCommand(RenX::GameCommand *command)
while (j != 0) while (j != 0)
command->addTrigger(Jupiter::ReferenceString::getWord(aliasList, --j, WHITESPACE)); command->addTrigger(Jupiter::ReferenceString::getWord(aliasList, --j, WHITESPACE));
} }
RenX::Server::commands.add(command);
} }
bool RenX::Server::removeCommand(RenX::GameCommand *command) bool RenX::Server::removeCommand(RenX::GameCommand *command)

2
RenX.ModSystem/RenX_ModSystem.cpp

@ -175,7 +175,7 @@ int RenX_ModSystemPlugin::auth(RenX::Server *server, const RenX::PlayerInfo *pla
if (player->access != 0) if (player->access != 0)
{ {
server->sendMessage(player, Jupiter::StringS::Format("You are now authenticated with access level %d; group: %.*s.", player->access, group->name.size(), group->name.ptr())); server->sendMessage(player, Jupiter::StringS::Format("You are now authenticated with access level %d; group: %.*s.", player->access, group->name.size(), group->name.ptr()));
if (server->isDevBot()) if (server->isDevBot() && player->access > 1)
{ {
if (server->getVersion() >= 4) if (server->getVersion() >= 4)
server->sendData(Jupiter::StringS::Format("dset_dev %d\n", player->id)); server->sendData(Jupiter::StringS::Format("dset_dev %d\n", player->id));

4
RenXGameCommands.ini

@ -16,8 +16,8 @@
[Default.Basic] [Default.Basic]
irc=Please set or remove the "irc" command in Jupiter's RenXGameCommands.ini file. irc=Please set or remove the "irc" command in Jupiter's RenXGameCommands.ini file.
ts=Please set or remove the "irc" command in Jupiter's RenXGameCommands.ini file. ts=Please set or remove the "ts" command in Jupiter's RenXGameCommands.ini file.
web=Please set or remove the "irc" command in Jupiter's RenXGameCommands.ini file. web=Please set or remove the "web" command in Jupiter's RenXGameCommands.ini file.
[Server.Basic] [Server.Basic]

Loading…
Cancel
Save