require cheats to be allowed on the server for $rand and $secid commands
This commit is contained in:
@@ -282,21 +282,22 @@ Some commands only work on the game server and not on the proxy server. The chat
|
||||
|
||||
* Personal state commands
|
||||
* `$arrow <color-id>`: Changes your lobby arrow color.
|
||||
* `$secid <section-id>`: Sets your override section ID. After running this command, any games you create will use your override section ID for rare drops instead of your character's actual section ID. To revert to your actual section id, run `$secid` with no name after it. On the proxy server, this will not work if the remote server controls item drops (e.g. on BB, or on Schtserv with server drops enabled).
|
||||
* `$rand <seed>`: Sets your override random seed (specified as a 32-bit hex value). This will make any games you create use the given seed for rare enemies. This also makes item drops deterministic in Blue Burst games hosted by newserv. On the proxy server, this command can cause desyncs with other players in the same game, since they will not see the overridden random seed. To remove the override, run `$rand` with no arguments.
|
||||
* `$secid <section-id>`: Sets your override section ID. After running this command, any games you create will use your override section ID for rare drops instead of your character's actual section ID. To revert to your actual section id, run `$secid` with no name after it. On the proxy server, this will not work if the remote server controls item drops (e.g. on BB, or on Schtserv with server drops enabled). If the server does not allow cheat mode anywhere (that is, "CheatModeBehavior" is "Off" in config.json), this command does nothing.
|
||||
* `$rand <seed>`: Sets your override random seed (specified as a 32-bit hex value). This will make any games you create use the given seed for rare enemies. This also makes item drops deterministic in Blue Burst games hosted by newserv. On the proxy server, this command can cause desyncs with other players in the same game, since they will not see the overridden random seed. To remove the override, run `$rand` with no arguments. If the server does not allow cheat mode anywhere (that is, "CheatModeBehavior" is "Off" in config.json), this command does nothing.
|
||||
* `$ln [name-or-type]`: Sets the lobby number. Visible only to you. This command exists because some non-lobby maps can be loaded as lobbies with invalid lobby numbers. See the "GC lobby types" and "Ep3 lobby types" entries in the information menu for acceptable values here. Note that non-lobby maps do not have a lobby counter, so there's no way to exit the lobby without using either `$ln` again or `$exit`. On the game server, `$ln` reloads the lobby immediately; on the proxy server, it doesn't take effect until you load another lobby yourself (which means you'll like have to use `$exit` to escape). Run this command with no argument to return to the default lobby.
|
||||
* `$exit`: If you're in a lobby, sends you to the main menu (which ends your proxy session, if you're in one). If you're in a game or spectator team, sends you to the lobby (but does not end your proxy session if you're in one). Does nothing if you're in a non-Episode 3 game and no quest is in progress.
|
||||
* `$patch <name>`: Run a patch on your client. `<name>` must exactly match the name of a patch on the server.
|
||||
|
||||
* Blue Burst player commands (game server only)
|
||||
* `$bbchar <username> <password> <1-4>`: Use this command when playing on a non-BB version of PSO. If the username and password are correct, this command converts your current character to BB format and saves it on the server in the given slot. Any character already in that slot is overwritten.
|
||||
* `$edit <stat> <value>`: Modifies your character data.
|
||||
* `$edit <stat> <value>`: Modifies your character data. If the server does not allow cheat mode anywhere (that is, "CheatModeBehavior" is "Off" in config.json), this command does nothing.
|
||||
|
||||
* Game state commands (game server only)
|
||||
* `$maxlevel <level>`: Sets the maximum level for players to join the current game. (This only applies when joining; if a player joins and then levels up past this level during the game, they are not kicked out, but won't be able to rejoin if they leave.)
|
||||
* `$minlevel <level>`: Sets the minimum level for players to join the current game.
|
||||
* `$password <password>`: Sets the game's join password. To unlock the game, run `$password` with nothing after it.
|
||||
* `$raretable`: Switches between using the client's or the server's drop table. No effect on BB (the server's drop table is always used). The server's rare tables are defined in JSON files in the system/item-tables directory.
|
||||
* `$itemtable`: Switches between using the client's or the server's drop table. No effect on BB (the server's drop table is always used). The server's rare tables are defined in JSON files in the system/item-tables directory.
|
||||
* `$drop`: Enables or disables all item drops from boxes and enemies in the current game.
|
||||
|
||||
* Episode 3 commands (game server only)
|
||||
* `$spec`: Toggles the allow spectators flag for Episode 3 games. If any players are spectating when this flag is disabled, they will be sent back to the lobby.
|
||||
|
||||
+27
-11
@@ -76,9 +76,15 @@ static void check_cheats_enabled(shared_ptr<Lobby> l) {
|
||||
}
|
||||
}
|
||||
|
||||
static void check_proxy_cheats_enabled(shared_ptr<ServerState> s) {
|
||||
static void check_cheats_allowed(shared_ptr<ServerState> s) {
|
||||
if (s->cheat_mode_behavior == ServerState::BehaviorSwitch::OFF) {
|
||||
throw precondition_failed("$C6Cheats are disabled\non this server.");
|
||||
}
|
||||
}
|
||||
|
||||
static void check_proxy_cheats_allowed(shared_ptr<ServerState> s) {
|
||||
if (s->cheat_mode_behavior != ServerState::BehaviorSwitch::OFF) {
|
||||
throw precondition_failed("$C6This command can\nonly be used in\ncheat mode.");
|
||||
throw precondition_failed("$C6Cheats are disabled\non this proxy.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,6 +648,7 @@ static void server_command_meseta(shared_ptr<Client> c, const std::string& args)
|
||||
static void server_command_secid(shared_ptr<Client> c, const std::string& args) {
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, false);
|
||||
check_cheats_allowed(c->require_server_state());
|
||||
|
||||
if (!args[0]) {
|
||||
c->options.override_section_id = -1;
|
||||
@@ -659,6 +666,7 @@ static void server_command_secid(shared_ptr<Client> c, const std::string& args)
|
||||
}
|
||||
|
||||
static void proxy_command_secid(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args) {
|
||||
check_cheats_allowed(ses->require_server_state());
|
||||
if (!args[0]) {
|
||||
ses->options.override_section_id = -1;
|
||||
send_text_message(ses->client_channel, "$C6Override section ID\nremoved");
|
||||
@@ -675,8 +683,10 @@ static void proxy_command_secid(shared_ptr<ProxyServer::LinkedSession> ses, cons
|
||||
}
|
||||
|
||||
static void server_command_rand(shared_ptr<Client> c, const std::string& args) {
|
||||
auto s = c->require_server_state();
|
||||
auto l = c->require_lobby();
|
||||
check_is_game(l, false);
|
||||
check_cheats_allowed(s);
|
||||
|
||||
if (!args[0]) {
|
||||
c->options.override_random_seed = -1;
|
||||
@@ -688,6 +698,7 @@ static void server_command_rand(shared_ptr<Client> c, const std::string& args) {
|
||||
}
|
||||
|
||||
static void proxy_command_rand(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args) {
|
||||
check_proxy_cheats_allowed(ses->require_server_state());
|
||||
if (!args[0]) {
|
||||
ses->options.override_random_seed = -1;
|
||||
send_text_message(ses->client_channel, "$C6Override seed\nremoved");
|
||||
@@ -751,7 +762,7 @@ static void server_command_min_level(shared_ptr<Client> c, const std::string& ar
|
||||
check_is_leader(l, c);
|
||||
|
||||
l->min_level = stoull(args) - 1;
|
||||
send_text_message_printf(l, "$C6Minimum level set to %" PRIu32, l->min_level + 1);
|
||||
send_text_message_printf(l, "$C6Minimum level set\nto %" PRIu32, l->min_level + 1);
|
||||
}
|
||||
|
||||
static void server_command_max_level(shared_ptr<Client> c, const std::string& args) {
|
||||
@@ -765,9 +776,9 @@ static void server_command_max_level(shared_ptr<Client> c, const std::string& ar
|
||||
}
|
||||
|
||||
if (l->max_level == 0xFFFFFFFF) {
|
||||
send_text_message(l, "$C6Maximum level set to unlimited");
|
||||
send_text_message(l, "$C6Maximum level set\nto unlimited");
|
||||
} else {
|
||||
send_text_message_printf(l, "$C6Maximum level set to %" PRIu32, l->max_level + 1);
|
||||
send_text_message_printf(l, "$C6Maximum level set\nto %" PRIu32, l->max_level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -780,6 +791,11 @@ static void server_command_edit(shared_ptr<Client> c, const std::string& args) {
|
||||
check_is_game(l, false);
|
||||
check_version(c, GameVersion::BB);
|
||||
|
||||
if (s->cheat_mode_behavior == ServerState::BehaviorSwitch::OFF) {
|
||||
send_text_message(l, "$C6Cheats are disabled on\nthis server");
|
||||
return;
|
||||
}
|
||||
|
||||
string encoded_args = tolower(args);
|
||||
vector<string> tokens = split(encoded_args, ' ');
|
||||
|
||||
@@ -1058,7 +1074,7 @@ static void server_command_warpall(shared_ptr<Client> c, const std::string& args
|
||||
|
||||
static void proxy_command_warp(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args, bool is_warpall) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_enabled(s);
|
||||
check_proxy_cheats_allowed(s);
|
||||
if (!ses->is_in_game) {
|
||||
send_text_message(ses->client_channel, "$C6You must be in a\ngame to use this\ncommand");
|
||||
return;
|
||||
@@ -1094,7 +1110,7 @@ static void server_command_next(shared_ptr<Client> c, const std::string&) {
|
||||
|
||||
static void proxy_command_next(shared_ptr<ProxyServer::LinkedSession> ses, const std::string&) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_enabled(s);
|
||||
check_proxy_cheats_allowed(s);
|
||||
if (!ses->is_in_game) {
|
||||
send_text_message(ses->client_channel, "$C6You must be in a\ngame to use this\ncommand");
|
||||
return;
|
||||
@@ -1167,7 +1183,7 @@ static void server_command_infinite_hp(shared_ptr<Client> c, const std::string&)
|
||||
|
||||
static void proxy_command_infinite_hp(shared_ptr<ProxyServer::LinkedSession> ses, const std::string&) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_enabled(s);
|
||||
check_proxy_cheats_allowed(s);
|
||||
ses->options.infinite_hp = !ses->options.infinite_hp;
|
||||
send_text_message_printf(ses->client_channel, "$C6Infinite HP %s", ses->options.infinite_hp ? "enabled" : "disabled");
|
||||
}
|
||||
@@ -1185,7 +1201,7 @@ static void server_command_infinite_tp(shared_ptr<Client> c, const std::string&)
|
||||
|
||||
static void proxy_command_infinite_tp(shared_ptr<ProxyServer::LinkedSession> ses, const std::string&) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_enabled(s);
|
||||
check_proxy_cheats_allowed(s);
|
||||
ses->options.infinite_tp = !ses->options.infinite_tp;
|
||||
send_text_message_printf(ses->client_channel, "$C6Infinite TP %s",
|
||||
ses->options.infinite_tp ? "enabled" : "disabled");
|
||||
@@ -1204,7 +1220,7 @@ static void server_command_switch_assist(shared_ptr<Client> c, const std::string
|
||||
|
||||
static void proxy_command_switch_assist(shared_ptr<ProxyServer::LinkedSession> ses, const std::string&) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_enabled(s);
|
||||
check_proxy_cheats_allowed(s);
|
||||
ses->options.switch_assist = !ses->options.switch_assist;
|
||||
send_text_message_printf(ses->client_channel, "$C6Switch assist %s",
|
||||
ses->options.switch_assist ? "enabled" : "disabled");
|
||||
@@ -1260,7 +1276,7 @@ static void server_command_item(shared_ptr<Client> c, const std::string& args) {
|
||||
|
||||
static void proxy_command_item(shared_ptr<ProxyServer::LinkedSession> ses, const std::string& args) {
|
||||
auto s = ses->require_server_state();
|
||||
check_proxy_cheats_enabled(s);
|
||||
check_proxy_cheats_allowed(s);
|
||||
if (ses->version() == GameVersion::BB) {
|
||||
send_text_message(ses->client_channel, "$C6This command cannot\nbe used on the proxy\nserver in BB games");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user