rewrite chat command system

This commit is contained in:
Martin Michelsen
2025-01-12 16:27:02 -08:00
parent b028532db3
commit 9033fb6a5d
10 changed files with 2615 additions and 2622 deletions
-3
View File
@@ -569,9 +569,7 @@ Some commands only work on the game server and not on the proxy server. The chat
* `$sc <data>`: Send a command to yourself.
* `$ss <data>`: Send a command to the remote server (if in a proxy session) or to the game server.
* `$sb <data>`: Send a command to yourself, and to the remote server or game server.
* `$meseta <amount>` (game server only; Episode 3 only): Add the given amount to your Meseta total.
* `$auction` (Episode 3 only): Bring up the CARD Auction menu, regardless of how many players are in the game or if you have a VIP card.
* `$ep3battledebug` (game server only; Episode 3 only): Enable or disable TCard00_Select. If enabled, the game will enter the debug menu when you start a battle.
* Personal state commands
* `$arrow <color-id>`: Change your lobby arrow color.
@@ -628,7 +626,6 @@ Some commands only work on the game server and not on the proxy server. The chat
* Administration commands (game server only)
* `$ann <message>`: Send an announcement message. The message is sent as temporary on-screen text to all players in all games and lobbies. On BB, the message appears in the scrolling top bar.
* `$ann!`, `$ann?`, `$ann?!`: Same as `$ann`, but with `?`, omits the sender's name, and with `!`, sends the message as a Simple Mail message instead of on-screen text.
* `$ax <message>`: Send a message to the server's terminal. This cannot be used to run server shell commands; it only prints text to stderr.
* `$silence <identifier>`: Silence a player (remove their ability to chat) or unsilence a player. The identifier may be the player's name or Guild Card number.
* `$kick <identifier>`: Disconnect a player. The identifier may be the player's name or Guild Card number.
* `$ban <duration> <identifier>`: Ban a player. The duration should be of the form `10m` (minutes), `10h` (hours), `10d` (days), `10w` (weeks), `10M` (months), or `10y` (years). (Numbers other than 10 may be used, of course.) As with `$kick`, the identifier may be the player's name or Guild Card number.
+2609 -2607
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -10,5 +10,5 @@
#include "ProxyServer.hh"
#include "ServerState.hh"
void on_chat_command(std::shared_ptr<Client> c, const std::string& text);
void on_chat_command(std::shared_ptr<ProxyServer::LinkedSession> ses, const std::string& text);
void on_chat_command(std::shared_ptr<Client> c, const std::string& text, bool check_permissions);
void on_chat_command(std::shared_ptr<ProxyServer::LinkedSession> ses, const std::string& text, bool check_permissions);
-1
View File
@@ -1214,7 +1214,6 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests
// 19 = View Battle waiting room
// 1A = TCard00_Select (debug battle setup menu)
// 1B = nothing (softlocks at black screen)
// TCard00_Select is accessible on newserv with the $ep3battledebug command.
/* 000A */ uint8_t environment_number;
// This field specifies how many of the camera_zone_maps are used.
-2
View File
@@ -4,7 +4,6 @@
using namespace std;
phosg::PrefixedLogger ax_messages_log("[$ax message] ", phosg::LogLevel::USE_DEFAULT);
phosg::PrefixedLogger channel_exceptions_log("[Channel] ", phosg::LogLevel::USE_DEFAULT);
phosg::PrefixedLogger client_log("", phosg::LogLevel::USE_DEFAULT);
phosg::PrefixedLogger command_data_log("[Commands] ", phosg::LogLevel::USE_DEFAULT);
@@ -30,7 +29,6 @@ static void set_log_level_from_json(
}
void set_log_levels_from_json(const phosg::JSON& json) {
set_log_level_from_json(ax_messages_log, json, "AXMessages");
set_log_level_from_json(channel_exceptions_log, json, "ChannelExceptions");
set_log_level_from_json(client_log, json, "Clients");
set_log_level_from_json(command_data_log, json, "CommandData");
-1
View File
@@ -3,7 +3,6 @@
#include <phosg/JSON.hh>
#include <phosg/Strings.hh>
extern phosg::PrefixedLogger ax_messages_log;
extern phosg::PrefixedLogger channel_exceptions_log;
extern phosg::PrefixedLogger client_log;
extern phosg::PrefixedLogger command_data_log;
+1 -1
View File
@@ -1954,7 +1954,7 @@ static HandlerResult C_06(shared_ptr<ProxyServer::LinkedSession> ses, uint16_t,
send_chat_message_from_client(ses->server_channel, text.substr(1), private_flags);
return HandlerResult::Type::SUPPRESS;
} else {
on_chat_command(ses, text);
on_chat_command(ses, text, true);
return HandlerResult::Type::SUPPRESS;
}
+1 -1
View File
@@ -3538,7 +3538,7 @@ static void on_06(shared_ptr<Client> c, uint16_t, uint32_t, string& data) {
if (text[1] == command_sentinel) {
text = text.substr(1);
} else {
on_chat_command(c, text);
on_chat_command(c, text, true);
return;
}
}
+2 -2
View File
@@ -908,7 +908,7 @@ ShellCommand c_cc(
}
if (ses.get()) {
on_chat_command(ses, args.args);
on_chat_command(ses, args.args, false);
} else {
shared_ptr<Client> c;
if (args.session_name.empty()) {
@@ -925,7 +925,7 @@ ShellCommand c_cc(
}
if (c) {
on_chat_command(c, args.args);
on_chat_command(c, args.args, false);
} else {
throw runtime_error("no client available");
}
-2
View File
@@ -246,8 +246,6 @@
// see only the log messages you care about. The log levels are, in decreasing
// order of verbosity, "DEBUG", "INFO", "WARNING", "ERROR", and "DISABLED".
"LogLevels": {
// AX messages are messages sent to the terminal with the $ax command.
"AXMessages": "INFO",
// Channel exceptions are messages about clients disconnecting unexpectedly,
// or other unexpected network-level events.
"ChannelExceptions": "INFO",