add $qcheck command

This commit is contained in:
Martin Michelsen
2023-12-04 22:54:47 -08:00
parent 9dfdbc624b
commit 3075370975
2 changed files with 13 additions and 1 deletions
+1
View File
@@ -258,6 +258,7 @@ Some commands only work on the game server and not on the proxy server. The chat
* `$debug` (game server only): Enable or disable debug. You need the DEBUG permission in your user license to use this command. When debug is enabled, you'll see in-game messages from the server when you take certain actions. You'll also be placed into the highest available slot in lobbies and games instead of the lowest, which is useful for finding commands for which newserv doesn't handle client IDs properly. This setting also disables certain safeguards and allows you to do some things that might crash your client.
* `$quest <number>`: Load a quest by quest number. Can be used to load battle or challenge quests with only one player present.
* `$qcall <function-id>`: Call a quest function on your client.
* `$qcheck <flag-num>`: Show the value of a quest flag.
* `$qset <flag-num>` or `$qclear <flag-num>`: Set or clear a global quest flag for everyone in the game.
* `$qsync <reg-num> <value>`: Set a quest register's value on your client. `<reg-num>` should be either rXX (e.g. r60) or fXX (e.g. f60); if the latter, `<value>` is parsed as a floating-point value instead of as an integer.
* `$gc` (game server only): Send your own Guild Card to yourself.
+12 -1
View File
@@ -269,6 +269,16 @@ static void server_command_quest(shared_ptr<Client> c, const std::string& args)
set_lobby_quest(c->require_lobby(), q);
}
static void server_command_qcheck(shared_ptr<Client> c, const std::string& args) {
auto l = c->require_lobby();
uint16_t flag_num = stoul(args, nullptr, 0);
send_text_message_printf(c, "$C7Quest flag 0x%hX (%hu)\nis %s on %s",
flag_num, flag_num,
c->game_data.character()->quest_flags.get(l->difficulty, flag_num) ? "set" : "not set",
name_for_difficulty(l->difficulty));
}
static void server_command_qset_qclear(shared_ptr<Client> c, const std::string& args, bool should_set) {
if (!c->config.check_flag(Client::Flag::DEBUG_ENABLED)) {
send_text_message(c, "$C6This command can only\nbe run in debug mode\n(run %sdebug first)");
@@ -292,7 +302,7 @@ static void server_command_qset_qclear(shared_ptr<Client> c, const std::string&
G_SetQuestFlag_DC_PC_6x75 cmd = {{0x75, 0x02, 0x0000}, flag_num, should_set ? 0 : 1};
send_command_t(l, 0x60, 0x00, cmd);
} else {
G_SetQuestFlag_V3_BB_6x75 cmd = {{{0x75, 0x02, 0x0000}, flag_num, should_set ? 0 : 1}, l->difficulty, 0x0000};
G_SetQuestFlag_V3_BB_6x75 cmd = {{{0x75, 0x03, 0x0000}, flag_num, should_set ? 0 : 1}, l->difficulty, 0x0000};
send_command_t(l, 0x60, 0x00, cmd);
}
}
@@ -1722,6 +1732,7 @@ static const unordered_map<string, ChatCommandDefinition> chat_commands({
{"$ping", {server_command_ping, nullptr}},
{"$playrec", {server_command_playrec, nullptr}},
{"$qcall", {server_command_qcall, proxy_command_qcall}},
{"$qcheck", {server_command_qcheck, nullptr}},
{"$qclear", {server_command_qclear, nullptr}},
{"$qset", {server_command_qset, nullptr}},
{"$qsync", {server_command_qsync, nullptr}},