From 73eef4815b5a792b82b79d0a2b58f0d0f4ceaf87 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 16 Mar 2025 12:18:37 -0700 Subject: [PATCH] update 6x9A description --- src/CommandFormats.hh | 10 +++++----- src/SendCommands.cc | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/CommandFormats.hh b/src/CommandFormats.hh index 776abfd0..cabd2796 100644 --- a/src/CommandFormats.hh +++ b/src/CommandFormats.hh @@ -5459,11 +5459,11 @@ struct G_SelectChallengeModeFailureOption_6x97 { // 6x99: Unknown // This subcommand is completely ignored. -// 6x9A: Update player stat (not valid on Episode 3) +// 6x9A: Update entity stat (not valid on Episode 3) -struct G_UpdatePlayerStat_6x9A { - G_ClientIDHeader header; - le_uint16_t client_id2 = 0; +struct G_UpdateEntityStat_6x9A { + G_EntityIDHeader header; + le_uint16_t entity_index = 0; // Values for what: // 0 = subtract HP // 1 = subtract TP @@ -5472,7 +5472,7 @@ struct G_UpdatePlayerStat_6x9A { // 4 = add TP uint8_t what = 0; uint8_t amount = 0; -} __packed_ws__(G_UpdatePlayerStat_6x9A, 8); +} __packed_ws__(G_UpdateEntityStat_6x9A, 8); // 6x9B: Level up all techniques (protected on V3/V4) // Used in battle mode if the rules specify that techniques should level up diff --git a/src/SendCommands.cc b/src/SendCommands.cc index 0e9332c7..97f7f06f 100644 --- a/src/SendCommands.cc +++ b/src/SendCommands.cc @@ -2520,17 +2520,17 @@ void send_resume_game(shared_ptr l, shared_ptr ready_client) { //////////////////////////////////////////////////////////////////////////////// // Game/cheat commands -static vector generate_stats_change_subcommands( +static vector generate_stats_change_subcommands( uint16_t client_id, PlayerStatsChange stat, uint32_t amount) { - if (amount > (0x7BF8 * 0xFF) / sizeof(G_UpdatePlayerStat_6x9A)) { + if (amount > (0x7BF8 * 0xFF) / sizeof(G_UpdateEntityStat_6x9A)) { throw runtime_error("stats change command is too large"); } uint8_t stat_ch = static_cast(stat); - vector subs; + vector subs; while (amount > 0) { uint8_t sub_amount = min(amount, 0xFF); - subs.emplace_back(G_UpdatePlayerStat_6x9A{{0x9A, 0x02, client_id}, 0, stat_ch, sub_amount}); + subs.emplace_back(G_UpdateEntityStat_6x9A{{0x9A, 0x02, client_id}, 0, stat_ch, sub_amount}); amount -= sub_amount; } return subs; @@ -2539,12 +2539,12 @@ static vector generate_stats_change_subcommands( void send_player_stats_change(shared_ptr c, PlayerStatsChange stat, uint32_t amount) { auto l = c->require_lobby(); auto subs = generate_stats_change_subcommands(c->lobby_client_id, stat, amount); - send_command_vt(l, (subs.size() > 0x400 / sizeof(G_UpdatePlayerStat_6x9A)) ? 0x6C : 0x60, 0x00, subs); + send_command_vt(l, (subs.size() > 0x400 / sizeof(G_UpdateEntityStat_6x9A)) ? 0x6C : 0x60, 0x00, subs); } void send_player_stats_change(Channel& ch, uint16_t client_id, PlayerStatsChange stat, uint32_t amount) { auto subs = generate_stats_change_subcommands(client_id, stat, amount); - send_command_vt(ch, (subs.size() > 0x400 / sizeof(G_UpdatePlayerStat_6x9A)) ? 0x6C : 0x60, 0x00, subs); + send_command_vt(ch, (subs.size() > 0x400 / sizeof(G_UpdateEntityStat_6x9A)) ? 0x6C : 0x60, 0x00, subs); } void send_remove_negative_conditions(shared_ptr c) {