add $exit on game server
This commit is contained in:
@@ -231,7 +231,7 @@ Some commands only work on the game server and not on the proxy server. The chat
|
||||
* `$arrow <color-id>`: Changes your lobby arrow color.
|
||||
* `$secid <section-id>`: Sets your override section ID. After running this command, any games you create will use your override section ID for rare drops instead of your character's actual section ID. To revert to your actual section id, run `$secid` with no name after it.
|
||||
* `$rand <seed>`: Sets your override random seed (specified as a 32-bit hex value). This will make any games you create use the given seed for rare enemies. This also makes item drops deterministic in Blue Burst games hosted by newserv. On the proxy server, this command can cause desyncs with other players in the same game, since they will not see the overridden random seed. To remove the override, run `$rand` with no arguments.
|
||||
* `$exit` (proxy server only): Ends your proxy session and returns you to the main menu. Can only be used from the lobby.
|
||||
* `$exit`: If you're in a lobby, sends you to the main menu (which ends your proxy session, if you're in one). If you're in an Episode 3 game, sends you to the lobby (but does not end your proxy session if you're in one).
|
||||
|
||||
* Blue Burst player commands (game server only)
|
||||
* `$bbchar <username> <password> <1-4>`: Use this command when playing on a non-BB version of PSO. If the username and password are correct, this command converts your current character to BB format and saves it on the server in the given slot. Any character already in that slot is overwritten.
|
||||
|
||||
+28
-2
@@ -295,11 +295,37 @@ static void server_command_persist(shared_ptr<ServerState>, shared_ptr<Lobby> l,
|
||||
}
|
||||
}
|
||||
|
||||
static void server_command_exit(shared_ptr<ServerState> s, shared_ptr<Lobby> l,
|
||||
shared_ptr<Client> c, const std::u16string&) {
|
||||
if (l->is_game()) {
|
||||
if (c->flags & Client::Flag::IS_EPISODE_3) {
|
||||
c->channel.send(0xED, 0x00);
|
||||
} else {
|
||||
send_text_message(c, u"$C6You must return to\nthe lobby first");
|
||||
}
|
||||
} else {
|
||||
send_self_leave_notification(c);
|
||||
if (!(c->flags & Client::Flag::NO_D6)) {
|
||||
send_message_box(c, u"");
|
||||
}
|
||||
|
||||
const auto& port_name = version_to_login_port_name.at(
|
||||
static_cast<size_t>(c->version()));
|
||||
send_reconnect(c, s->connect_address_for_client(c),
|
||||
s->name_to_port_config.at(port_name)->port);
|
||||
}
|
||||
}
|
||||
|
||||
static void proxy_command_exit(shared_ptr<ServerState>,
|
||||
ProxyServer::LinkedSession& session, const std::u16string&) {
|
||||
if (session.is_in_game) {
|
||||
send_text_message(session.client_channel, u"$C6You must return to\nthe lobby first");
|
||||
if (session.newserv_client_config.cfg.flags & Client::Flag::IS_EPISODE_3) {
|
||||
session.client_channel.send(0xED, 0x00);
|
||||
} else {
|
||||
send_text_message(session.client_channel, u"$C6You must return to\nthe lobby first");
|
||||
}
|
||||
} else {
|
||||
session.close_on_disconnect = true;
|
||||
session.send_to_game_server();
|
||||
}
|
||||
}
|
||||
@@ -1154,7 +1180,7 @@ static const unordered_map<u16string, ChatCommandDefinition> chat_commands({
|
||||
{u"$dbgid", {server_command_dbgid, nullptr, u"Usage:\ndbgid"}},
|
||||
{u"$edit", {server_command_edit, nullptr , u"Usage:\nedit <stat> <value>"}},
|
||||
{u"$event", {server_command_lobby_event, proxy_command_lobby_event, u"Usage:\nevent <name>"}},
|
||||
{u"$exit", {nullptr, proxy_command_exit, u"Usage:\nexit"}},
|
||||
{u"$exit", {server_command_exit, proxy_command_exit, u"Usage:\nexit"}},
|
||||
{u"$gc", {server_command_get_self_card, proxy_command_get_player_card, u"Usage:\ngc"}},
|
||||
{u"$infhp", {server_command_infinite_hp, proxy_command_infinite_hp, u"Usage:\ninfhp"}},
|
||||
{u"$inftp", {server_command_infinite_tp, proxy_command_infinite_tp, u"Usage:\ninftp"}},
|
||||
|
||||
+1
-3
@@ -715,9 +715,7 @@ void ProxyServer::LinkedSession::send_to_game_server(const char* error_message)
|
||||
update_client_config_cmd.cfg = this->newserv_client_config.cfg;
|
||||
this->client_channel.send(0x04, 0x00, &update_client_config_cmd, sizeof(update_client_config_cmd));
|
||||
|
||||
static const vector<string> version_to_port_name({
|
||||
"bb-patch", "console-login", "pc-login", "console-login", "console-login", "bb-init"});
|
||||
const auto& port_name = version_to_port_name.at(static_cast<size_t>(
|
||||
const auto& port_name = version_to_login_port_name.at(static_cast<size_t>(
|
||||
this->version));
|
||||
|
||||
S_Reconnect_19 reconnect_cmd = {{
|
||||
|
||||
@@ -126,17 +126,13 @@ static vector<MenuItem> proxy_options_menu_for_client(
|
||||
|
||||
|
||||
static void send_client_to_lobby_server(shared_ptr<ServerState> s, shared_ptr<Client> c) {
|
||||
static const vector<string> version_to_port_name({
|
||||
"bb-lobby", "console-lobby", "pc-lobby", "console-lobby", "console-lobby", "bb-lobby"});
|
||||
const auto& port_name = version_to_port_name.at(static_cast<size_t>(c->version()));
|
||||
const auto& port_name = version_to_lobby_port_name.at(static_cast<size_t>(c->version()));
|
||||
send_reconnect(c, s->connect_address_for_client(c),
|
||||
s->name_to_port_config.at(port_name)->port);
|
||||
}
|
||||
|
||||
static void send_client_to_proxy_server(shared_ptr<ServerState> s, shared_ptr<Client> c) {
|
||||
static const vector<string> version_to_port_name({
|
||||
"", "dc-proxy", "pc-proxy", "gc-proxy", "xb-proxy", "bb-proxy"});
|
||||
const auto& port_name = version_to_port_name.at(static_cast<size_t>(c->version()));
|
||||
const auto& port_name = version_to_proxy_port_name.at(static_cast<size_t>(c->version()));
|
||||
uint16_t local_port = s->name_to_port_config.at(port_name)->port;
|
||||
|
||||
s->proxy_server->delete_session(c->license->serial_number);
|
||||
@@ -2215,9 +2211,7 @@ static void on_A0(shared_ptr<ServerState> s, shared_ptr<Client> c,
|
||||
send_message_box(c, u"");
|
||||
}
|
||||
|
||||
static const vector<string> version_to_port_name({
|
||||
"bb-patch", "console-login", "pc-login", "console-login", "console-login", "bb-init"});
|
||||
const auto& port_name = version_to_port_name.at(static_cast<size_t>(c->version()));
|
||||
const auto& port_name = version_to_login_port_name.at(static_cast<size_t>(c->version()));
|
||||
|
||||
send_reconnect(c, s->connect_address_for_client(c),
|
||||
s->name_to_port_config.at(port_name)->port);
|
||||
|
||||
+1
-3
@@ -875,9 +875,7 @@ void send_card_search_result_t(
|
||||
shared_ptr<Client> c,
|
||||
shared_ptr<Client> result,
|
||||
shared_ptr<Lobby> result_lobby) {
|
||||
static const vector<string> version_to_port_name({
|
||||
"bb-lobby", "console-lobby", "pc-lobby", "console-lobby", "console-lobby", "bb-lobby"});
|
||||
const auto& port_name = version_to_port_name.at(static_cast<size_t>(c->version()));
|
||||
const auto& port_name = version_to_lobby_port_name.at(static_cast<size_t>(c->version()));
|
||||
|
||||
S_GuildCardSearchResult<CommandHeaderT, CharT> cmd;
|
||||
cmd.player_tag = 0x00010000;
|
||||
|
||||
@@ -10,6 +10,13 @@ using namespace std;
|
||||
|
||||
|
||||
|
||||
const vector<string> version_to_login_port_name({
|
||||
"bb-patch", "console-login", "pc-login", "console-login", "console-login", "bb-init"});
|
||||
const vector<string> version_to_lobby_port_name({
|
||||
"bb-patch", "console-lobby", "pc-lobby", "console-lobby", "console-lobby", "bb-lobby"});
|
||||
const vector<string> version_to_proxy_port_name({
|
||||
"", "dc-proxy", "pc-proxy", "gc-proxy", "xb-proxy", "bb-proxy"});
|
||||
|
||||
uint16_t flags_for_version(GameVersion version, int64_t sub_version) {
|
||||
switch (sub_version) {
|
||||
case -1: // Initial check (before sub_version recognition)
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
enum class GameVersion {
|
||||
@@ -23,6 +26,10 @@ enum class ServerBehavior {
|
||||
PROXY_SERVER,
|
||||
};
|
||||
|
||||
extern const std::vector<std::string> version_to_login_port_name;
|
||||
extern const std::vector<std::string> version_to_lobby_port_name;
|
||||
extern const std::vector<std::string> version_to_proxy_port_name;
|
||||
|
||||
uint16_t flags_for_version(GameVersion version, int64_t sub_version);
|
||||
const char* name_for_version(GameVersion version);
|
||||
GameVersion version_for_name(const char* name);
|
||||
|
||||
Reference in New Issue
Block a user