From 6136f8dfb3b13f95057dfdd17942a1aeb508ab5f Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Thu, 7 Dec 2023 20:08:46 -0800 Subject: [PATCH] implement $edit on v1/v2 --- README.md | 4 ++-- TODO.md | 4 ---- src/ChatCommands.cc | 9 +++++++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6e0a50c4..427dfdea 100644 --- a/README.md +++ b/README.md @@ -276,9 +276,9 @@ Some commands only work on the game server and not on the proxy server. The chat * Character data commands * `$savechar `: Saves your current character data on the server in the specified slot (each serial number has 4 slots, numbered 1-4). These slots are separate from BB character slots; using this command does not affect BB characters. - * `$loadchar ` (v1 and v2 only): Loads your character data from the specified slot. + * `$loadchar ` (v1 and v2 only): Loads your character data from the specified slot. The changes will be undone if you join a game - to save your changes, disconnect from the lobby. * `$bbchar `: 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 (1-4). Any character already in that slot is overwritten. (This command is similar to `$savechar`, except it overwrites a BB character slot, and can transfer characters across accounts.) Note that the character's chat data, quick menu config, and bank contents are not copied, since there is no way for the server to request those types of data. - * `$edit `: Modifies your character data. If the server does not allow cheat mode anywhere (that is, "CheatModeBehavior" is "Off" in config.json), this command does nothing. + * `$edit `: Modifies your character data. If you are on V3 (GameCube/Xbox), or if the server does not allow cheat mode anywhere (that is, "CheatModeBehavior" is "Off" in config.json), this command does nothing. If you are on V1 or V2 (DC or PC, not BB), your changes will be undone if you join a game - to save your changes, disconnect from the lobby. * Blue Burst player commands (game server only) * `$bank [number]`: Switches your current bank, so you can access your other character's banks (if `number` is 1-4) or your shared account bank (if `number` is 0). If `number` is not given, switches back to your current character's bank. diff --git a/TODO.md b/TODO.md index 8c09e6e8..499067fb 100644 --- a/TODO.md +++ b/TODO.md @@ -1,15 +1,12 @@ ## General -- Find a way to silence audio in RunDOL.s - Encapsulate BB server-side random state and make replays deterministic - Write a simple status API - Implement per-game logging -- Build an exception-handling abstraction in ChatCommands that shows formatted error messages in all cases - Make reloading happen on separate threads so compression doesn't block active clients - Implement decrypt/encrypt actions for VMS files - Make UI strings localizable (e.g. entries in menus, welcome message, etc.) - Figure out what causes the corruption message on PC proxy sessions and fix it -- Make $edit for DC/PC - Add an idle connection timeout for proxy sessions ## Episode 3 @@ -22,7 +19,6 @@ ## PSO XBOX - Fix receiving Guild Cards from non-Xbox players -- Make the Guild Card description field in SavedPlayerDataBB longer to accommodate XB descriptions (0x200 bytes) - Research the F94D quest opcode ## PSOBB diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index 197b833d..5a960314 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -892,7 +892,9 @@ static void server_command_edit(shared_ptr c, const std::string& args) { auto s = c->require_server_state(); auto l = c->require_lobby(); check_is_game(l, false); - check_version(c, Version::BB_V4); + if (!is_v1_or_v2(c->version()) && (c->version() != Version::BB_V4)) { + throw precondition_failed("$C6This command cannot\nbe used for your\nversion of PSO."); + } if ((s->cheat_mode_behavior == ServerState::BehaviorSwitch::OFF) && !(c->license->flags & License::Flag::CHEAT_ANYWHERE)) { send_text_message(l, "$C6Cheats are disabled\non this server"); @@ -986,7 +988,10 @@ static void server_command_edit(shared_ptr c, const std::string& args) { // Reload the client in the lobby send_player_leave_notification(l, c->lobby_client_id); - send_complete_player_bb(c); + if (c->version() == Version::BB_V4) { + send_complete_player_bb(c); + } + c->v1_v2_last_reported_disp.reset(); s->send_lobby_join_notifications(l, c); }