implement savechar/loadchar on DCv2 and Xbox

This commit is contained in:
Martin Michelsen
2024-05-12 21:07:56 -07:00
parent 625e8e0624
commit 2ff75fe132
17 changed files with 350 additions and 10 deletions
+17 -4
View File
@@ -1469,7 +1469,10 @@ static void server_command_savechar(shared_ptr<Client> c, const std::string& arg
}
static void server_command_loadchar(shared_ptr<Client> c, const std::string& args) {
if (!is_v1_or_v2(c->version()) && (c->version() != Version::GC_V3) && (c->version() != Version::XB_V3)) {
if (!is_v1_or_v2(c->version()) &&
(c->version() != Version::GC_V3) &&
(c->version() != Version::XB_V3) &&
(c->version() != Version::BB_V4)) {
send_text_message(c, "$C7This command cannot\nbe used on your\ngame version");
return;
}
@@ -1487,12 +1490,19 @@ static void server_command_loadchar(shared_ptr<Client> c, const std::string& arg
}
c->load_backup_character(c->login->account->account_id, index);
if ((c->version() == Version::GC_V3) || (c->version() == Version::XB_V3)) {
if (c->version() == Version::BB_V4) {
// On BB, it suffices to simply send the character file again
auto s = c->require_server_state();
send_complete_player_bb(c);
send_player_leave_notification(l, c->lobby_client_id);
s->send_lobby_join_notifications(l, c);
} else if ((c->version() == Version::DC_V2) || (c->version() == Version::GC_V3) || (c->version() == Version::XB_V3)) {
// TODO: Support extended player info on other versions
auto s = c->require_server_state();
if (c->config.check_flag(Client::Flag::NO_SEND_FUNCTION_CALL) ||
c->config.check_flag(Client::Flag::SEND_FUNCTION_CALL_CHECKSUM_ONLY)) {
send_text_message_printf(c, "Can\'t load character\ndata on PSO Plus");
send_text_message_printf(c, "Can\'t load character\ndata on this game\nversion");
return;
}
@@ -1525,7 +1535,10 @@ static void server_command_loadchar(shared_ptr<Client> c, const std::string& arg
});
};
if (c->version() == Version::GC_V3) {
if (c->version() == Version::DC_V2) {
auto dc_char = make_shared<PSODCV2CharacterFile>(c->character()->to_dc_v2());
send_set_extended_player_info.operator()<PSODCV2CharacterFile>(c, dc_char);
} else if (c->version() == Version::GC_V3) {
auto gc_char = make_shared<PSOGCCharacterFile::Character>(c->character()->to_gc());
send_set_extended_player_info.operator()<PSOGCCharacterFile::Character>(c, gc_char);
} else if (c->version() == Version::XB_V3) {