make switch assist a non-cheat command

This commit is contained in:
Martin Michelsen
2023-12-25 19:27:39 -08:00
parent c7059874d3
commit d59b59cd51
5 changed files with 14 additions and 17 deletions
+5 -7
View File
@@ -219,9 +219,6 @@ static void proxy_command_lobby_info(shared_ptr<ProxyServer::LinkedSession> ses,
}
vector<const char*> cheats_tokens;
if (ses->config.check_flag(Client::Flag::SWITCH_ASSIST_ENABLED)) {
cheats_tokens.emplace_back("SWA");
}
if (ses->config.check_flag(Client::Flag::INFINITE_HP_ENABLED)) {
cheats_tokens.emplace_back("HP");
}
@@ -234,14 +231,17 @@ static void proxy_command_lobby_info(shared_ptr<ProxyServer::LinkedSession> ses,
}
vector<const char*> behaviors_tokens;
if (ses->config.check_flag(Client::Flag::SWITCH_ASSIST_ENABLED)) {
behaviors_tokens.emplace_back("SWA");
}
if (ses->config.check_flag(Client::Flag::PROXY_SAVE_FILES)) {
behaviors_tokens.emplace_back("SAVE");
behaviors_tokens.emplace_back("SF");
}
if (ses->config.check_flag(Client::Flag::PROXY_SUPPRESS_REMOTE_LOGIN)) {
behaviors_tokens.emplace_back("SL");
}
if (ses->config.check_flag(Client::Flag::PROXY_BLOCK_FUNCTION_CALLS)) {
behaviors_tokens.emplace_back("BFC");
behaviors_tokens.emplace_back("BF");
}
if (!behaviors_tokens.empty()) {
msg += "\n$C7Flags: $C6";
@@ -1504,7 +1504,6 @@ static void server_command_switch_assist(shared_ptr<Client> c, const std::string
auto s = c->require_server_state();
auto l = c->require_lobby();
check_is_game(l, true);
check_cheats_enabled(l, c);
c->config.toggle_flag(Client::Flag::SWITCH_ASSIST_ENABLED);
send_text_message_printf(c, "$C6Switch assist %s",
@@ -1513,7 +1512,6 @@ 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_cheats_allowed(s, ses);
ses->config.toggle_flag(Client::Flag::SWITCH_ASSIST_ENABLED);
send_text_message_printf(ses->client_channel, "$C6Switch assist %s",
ses->config.check_flag(Client::Flag::SWITCH_ASSIST_ENABLED) ? "enabled" : "disabled");
+1 -1
View File
@@ -59,9 +59,9 @@ public:
SHOULD_SEND_ARTIFICIAL_ITEM_STATE = 0x0001000000000000,
SHOULD_SEND_ARTIFICIAL_FLAG_STATE = 0x0002000000000000,
SHOULD_SEND_ENABLE_SAVE = 0x0004000000000000,
SWITCH_ASSIST_ENABLED = 0x0000000100000000,
// Cheat mode flags
SWITCH_ASSIST_ENABLED = 0x0000000100000000,
INFINITE_HP_ENABLED = 0x0000000200000000,
INFINITE_TP_ENABLED = 0x0000000400000000,
DEBUG_ENABLED = 0x0000000800000000,
+6 -6
View File
@@ -53,14 +53,18 @@ static shared_ptr<const Menu> proxy_options_menu_for_client(shared_ptr<const Cli
"Player notifs", "Show a message\nwhen other players\njoin or leave");
add_option(ProxyOptionsMenuItemID::BLOCK_PINGS, Client::Flag::PROXY_SUPPRESS_CLIENT_PINGS,
"Block pings", "Block ping commands\nsent by the client");
add_bool_option(ProxyOptionsMenuItemID::BLOCK_EVENTS, (c->config.override_lobby_event != 0xFF),
"Block events", "Disable seasonal\nevents in the lobby\nand in games");
add_option(ProxyOptionsMenuItemID::BLOCK_PATCHES, Client::Flag::PROXY_BLOCK_FUNCTION_CALLS,
"Block patches", "Disable patches sent\nby the remote server");
add_option(ProxyOptionsMenuItemID::SWITCH_ASSIST, Client::Flag::SWITCH_ASSIST_ENABLED,
"Switch assist", "Automatically try\nto unlock 2-player\ndoors when you step\non both switches\nsequentially");
if ((s->cheat_mode_behavior != ServerState::BehaviorSwitch::OFF) || (c->license->flags & License::Flag::CHEAT_ANYWHERE)) {
if (!is_ep3(c->version())) {
add_option(ProxyOptionsMenuItemID::INFINITE_HP, Client::Flag::INFINITE_HP_ENABLED,
"Infinite HP", "Enable automatic HP\nrestoration when\nyou are hit by an\nenemy or trap\n\nCannot revive you\nfrom one-hit kills");
add_option(ProxyOptionsMenuItemID::INFINITE_TP, Client::Flag::INFINITE_TP_ENABLED,
"Infinite TP", "Enable automatic TP\nrestoration when\nyou cast any\ntechnique");
add_option(ProxyOptionsMenuItemID::SWITCH_ASSIST, Client::Flag::SWITCH_ASSIST_ENABLED,
"Switch assist", "Automatically try\nto unlock 2-player\ndoors when you step\non both switches\nsequentially");
} else {
// Note: This option's text is the maximum possible length for any menu item
add_option(ProxyOptionsMenuItemID::EP3_INFINITE_MESETA, Client::Flag::PROXY_EP3_INFINITE_MESETA_ENABLED,
@@ -71,10 +75,6 @@ static shared_ptr<const Menu> proxy_options_menu_for_client(shared_ptr<const Cli
"Unmask whispers", "Show contents of\nwhisper messages even\nif they are not for\nyou");
}
}
add_bool_option(ProxyOptionsMenuItemID::BLOCK_EVENTS, (c->config.override_lobby_event != 0xFF),
"Block events", "Disable seasonal\nevents in the lobby\nand in games");
add_option(ProxyOptionsMenuItemID::BLOCK_PATCHES, Client::Flag::PROXY_BLOCK_FUNCTION_CALLS,
"Block patches", "Disable patches sent\nby the remote server");
if (s->proxy_allow_save_files) {
add_option(ProxyOptionsMenuItemID::SAVE_FILES, Client::Flag::PROXY_SAVE_FILES,
"Save files", "Save local copies of\nfiles from the\nremote server\n(quests, etc.)");
+1 -2
View File
@@ -1047,8 +1047,7 @@ static void on_switch_state_changed(shared_ptr<Client> c, uint8_t command, uint8
forward_subcommand(c, command, flag, data, size);
if (cmd.flags && cmd.header.object_id != 0xFFFF) {
bool player_cheats_enabled = l->check_flag(Lobby::Flag::CHEATS_ENABLED) || (c->license->flags & License::Flag::CHEAT_ANYWHERE);
if (player_cheats_enabled &&
if (!l->quest &&
c->config.check_flag(Client::Flag::SWITCH_ASSIST_ENABLED) &&
(c->last_switch_enabled_command.header.subcommand == 0x05)) {
c->log.info("[Switch assist] Replaying previous enable command");