diff --git a/README.md b/README.md index a76dc7ee..22ab38ee 100644 --- a/README.md +++ b/README.md @@ -266,6 +266,7 @@ Some commands only work on the game server and not on the proxy server. The chat * Information commands * `$li`: Shows basic information about the lobby or game you're in. If you're on the proxy server, shows information about your connection instead (remote Guild Card number, client ID, etc.). * `$what` (game server only): Shows the type, name, and stats of the nearest item on the ground. + * `$matcount` (game server only): Shows how many of each type of material you've used. * Debugging commands * `$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. diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index c5c906a1..f4ff6917 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -236,6 +236,18 @@ static void server_command_debug(shared_ptr c, const std::u16string&) { c->options.debug ? "enabled" : "disabled"); } +static void server_command_show_material_counts(shared_ptr c, const std::u16string&) { + auto p = c->game_data.player(); + send_text_message_printf(c, "%hhu HP, %hhu TP, %hhu POW\n%hhu MIND, %hhu EVADE\n%hhu DEF, %hhu LUCK", + p->get_material_usage(SavedPlayerDataBB::MaterialType::HP), + p->get_material_usage(SavedPlayerDataBB::MaterialType::TP), + p->get_material_usage(SavedPlayerDataBB::MaterialType::POWER), + p->get_material_usage(SavedPlayerDataBB::MaterialType::MIND), + p->get_material_usage(SavedPlayerDataBB::MaterialType::EVADE), + p->get_material_usage(SavedPlayerDataBB::MaterialType::DEF), + p->get_material_usage(SavedPlayerDataBB::MaterialType::LUCK)); +} + static void server_command_auction(shared_ptr c, const std::u16string&) { check_license_flags(c, License::Flag::DEBUG); auto l = c->require_lobby(); @@ -1544,6 +1556,7 @@ static const unordered_map chat_commands({ {u"$li", {server_command_lobby_info, proxy_command_lobby_info}}, {u"$ln", {server_command_lobby_type, proxy_command_lobby_type}}, {u"$ep3battledebug", {server_command_enable_ep3_battle_debug_menu, nullptr}}, + {u"$matcount", {server_command_show_material_counts, nullptr}}, {u"$maxlevel", {server_command_max_level, nullptr}}, {u"$meseta", {server_command_meseta, nullptr}}, {u"$minlevel", {server_command_min_level, nullptr}},