From 724186a8c0d0d5be61288d8149cebe2e46dd7836 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Tue, 31 Oct 2023 09:57:29 -0700 Subject: [PATCH] make $edit level also set stats --- TODO.md | 3 +-- src/ChatCommands.cc | 4 +++- src/CommandFormats.hh | 30 ++++++++++++++++++++++-------- src/ReceiveCommands.cc | 1 - 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/TODO.md b/TODO.md index 1d621f8a..7e23fc09 100644 --- a/TODO.md +++ b/TODO.md @@ -34,7 +34,6 @@ - Find any remaining mismatches in enemy IDs / experience - Support EXP multipliers - Sale prices for non-rare weapons with specials are computed incorrectly when buying/selling at shops -- Replace enemy list, game episode, etc. with quest data when loading a quest - Implement trade window - Fix some edge cases on the BB proxy server (e.g. Change Ship) - Implement less-common subcommands @@ -45,4 +44,4 @@ - 6xDE: Good Luck quest - 6xE0 - 6xE1: Gallon's Plan quest -- Implement team commands +- Implement teams diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index 77c5d0ab..965fad34 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -831,7 +831,9 @@ static void server_command_edit(shared_ptr c, const std::string& args) { } else if (tokens.at(0) == "exp") { p->disp.stats.experience = stoul(tokens.at(1)); } else if (tokens.at(0) == "level") { - p->disp.stats.level = stoul(tokens.at(1)) - 1; + uint32_t level = stoul(tokens.at(1)) - 1; + p->disp.stats.reset_to_base(p->disp.visual.char_class, s->level_table); + p->disp.stats.advance_to_level(p->disp.visual.char_class, level, s->level_table); } else if (tokens.at(0) == "namecolor") { uint32_t new_color; sscanf(tokens.at(1).c_str(), "%8X", &new_color); diff --git a/src/CommandFormats.hh b/src/CommandFormats.hh index bec5f149..28c9a1ef 100644 --- a/src/CommandFormats.hh +++ b/src/CommandFormats.hh @@ -3215,7 +3215,8 @@ struct C_CreateTeam_BB_01EA { } __packed__; // 02EA (S->C): Unknown -// This command behaves exactly like 1FEA. +// header.flag must be in the range [0, 6]. If it isn't, the command is ignored. +// No other arguments. // 03EA (C->S): Add team member @@ -3274,11 +3275,9 @@ struct S_Unknown_BB_0CEA { struct S_Unknown_BB_0EEA { parray unused; - // Text follows here + pstring team_name; } __packed__; -// 0EEA (S->C): Unknown - // 0FEA (C->S): Set team flag // The client also accepts this command but completely ignores it. @@ -3315,10 +3314,10 @@ struct S_TeamMembershipInformation_BB_12EA { pstring team_name; } __packed__; -// 13EA: Unknown +// 13EA: Team info for lobby players // header.flag specifies the number of entries. -struct S_Unknown_BB_13EA_15EA_Entry { +struct S_TeamInfoForPlayer_BB_13EA_15EA_Entry { le_uint32_t guild_card_number = 0; le_uint32_t team_id = 0; le_uint32_t unknown_a3 = 0; @@ -3343,10 +3342,26 @@ struct S_Unknown_BB_13EA_15EA_Entry { // 18EA: Membership information // No arguments (C->S) +// TODO: Document S->C format + +struct S_TeamMembershipInformation_BB_18EA { + parray unknown_a1; + le_uint32_t unknown_a2 = 1; + le_uint32_t unknown_a3 = 1; + le_uint32_t privilege_level = 0; + le_uint32_t guild_card_number; + pstring player_name; + le_uint32_t unknown_a4 = 0; + le_uint32_t unknown_a5 = 2; +} __packed__; // 19EA: Privilege list // No arguments (C->S) +struct S_TeamPrivilegeList_BB_19EA { + le_uint32_t unknown_a1 = 0; +} __packed__; + // 1AEA: Unknown // 1BEA (C->S): Unknown @@ -3366,8 +3381,7 @@ struct C_Unknown_BB_1EEA { } __packed__; // 1FEA (S->C): Unknown -// header.flag must be in the range [0, 6]. If it isn't, the command is ignored. -// No other arguments. +// This command behaves exactly like 02EA. // 20EA: Unknown // header.flag is used, but no other arguments diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index f1a3707a..4f1f4152 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -3934,7 +3934,6 @@ static void on_EF_Ep3(shared_ptr c, uint16_t, uint32_t, string& data) { } static void on_xxEA_BB(shared_ptr c, uint16_t command, uint32_t, string&) { - // TODO: Implement teams. This command has a very large number of subcommands // (up to 20EA!). if (command == 0x01EA) {