add $battle command for dcv1

This commit is contained in:
Martin Michelsen
2024-11-03 22:51:07 -08:00
parent 2d1544edf4
commit e6a6e862db
5 changed files with 21 additions and 3 deletions
+16
View File
@@ -2293,6 +2293,21 @@ static void proxy_command_item(shared_ptr<ProxyServer::LinkedSession> ses, const
}
}
static void server_command_enable_battle_mode_v1(shared_ptr<Client> c, const std::string&) {
check_is_game(c->require_lobby(), false);
if (!is_v1(c->version())) {
send_text_message(c, "$C6This command can\nonly be used on\nDC v1 and earlier");
return;
}
c->config.toggle_flag(Client::Flag::FORCE_BATTLE_MODE_GAME);
if (c->config.check_flag(Client::Flag::FORCE_BATTLE_MODE_GAME)) {
send_text_message(c, "$C6Battle mode enabled\nfor next game");
} else {
send_text_message(c, "$C6Battle mode disabled\nfor next game");
}
}
static void server_command_enable_ep3_battle_debug_menu(shared_ptr<Client> c, const std::string& args) {
check_debug_enabled(c);
@@ -2625,6 +2640,7 @@ static const unordered_map<string, ChatCommandDefinition> chat_commands({
{"$ax", {server_command_ax, nullptr}},
{"$ban", {server_command_ban, nullptr}},
{"$bank", {server_command_change_bank, nullptr}},
{"$battle", {server_command_enable_battle_mode_v1, nullptr}},
{"$bbchar", {server_command_bbchar, nullptr}},
{"$cheat", {server_command_cheat, nullptr}},
{"$debug", {server_command_debug, nullptr}},
+2 -1
View File
@@ -35,7 +35,7 @@ public:
// TODO: It'd be nice to use a pattern here (e.g. all server-side flags are
// in the high bits) but that would require re-recording or manually
// rewriting all the tests
CLIENT_SIDE_MASK = 0xFF3CFFFF7C0BFFFB,
CLIENT_SIDE_MASK = 0xF73CFFFF7C0BFFFB,
// Version-related flags
CHECKED_FOR_DC_V1_PROTOTYPE = 0x0000000000000002,
@@ -80,6 +80,7 @@ public:
DEBUG_ENABLED = 0x0000000800000000,
ITEM_DROP_NOTIFICATIONS_1 = 0x0010000000000000,
ITEM_DROP_NOTIFICATIONS_2 = 0x0020000000000000,
FORCE_BATTLE_MODE_GAME = 0x0800000000000000,
// Proxy option flags
PROXY_SAVE_FILES = 0x0000001000000000,
+2 -1
View File
@@ -4570,8 +4570,9 @@ static void on_0C_C1_E7_EC(shared_ptr<Client> c, uint16_t command, uint32_t, str
GameMode mode = GameMode::NORMAL;
bool spectators_forbidden = false;
if (cmd.battle_mode) {
if (cmd.battle_mode || c->config.check_flag(Client::Flag::FORCE_BATTLE_MODE_GAME)) {
mode = GameMode::BATTLE;
c->config.clear_flag(Client::Flag::FORCE_BATTLE_MODE_GAME);
}
if (cmd.challenge_mode) {
if (client_is_ep3) {