From a211bd07ac1a9eca6bd04e55791393b61a7346b0 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Thu, 19 Oct 2023 15:44:31 -0700 Subject: [PATCH] implement 6xD2 command --- src/CommandFormats.hh | 8 ++++---- src/Player.hh | 2 +- src/QuestScript.cc | 2 +- src/ReceiveSubcommands.cc | 7 ++++++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/CommandFormats.hh b/src/CommandFormats.hh index 19f5b321..9901e971 100644 --- a/src/CommandFormats.hh +++ b/src/CommandFormats.hh @@ -3089,7 +3089,7 @@ struct SC_SyncCharacterSaveFile_BB_00E7 { /* 2CB8 */ PlayerRecordsBB_Challenge challenge_records; /* 2DF8 */ parray tech_menu_config; // player /* 2E20 */ parray unknown_a6; - /* 2E4C */ parray quest_data2; // player + /* 2E4C */ parray quest_data2; // player /* 2EA4 */ KeyAndTeamConfigBB key_config; // account /* 3994 */ } __attribute__((packed)); @@ -5646,11 +5646,11 @@ struct G_BlackPaperDealPhotonCrystalExchange_BB_6xDF { struct G_BlackPaperDealRewards_BB_6xE0 { G_ClientIDHeader header; uint8_t unknown_a1; - uint8_t unknown_a2; + uint8_t unknown_a2; // argsA[0] uint8_t unknown_a3; uint8_t unknown_a4; - le_uint32_t unknown_a5; - le_uint32_t unknown_a6; + le_float unknown_a5; // argsA[1] + le_float unknown_a6; // argsA[2] } __packed__; // 6xE1: Gallon's Plan quest (BB; handled by server) diff --git a/src/Player.hh b/src/Player.hh index 0cd53041..f6e1dbdc 100644 --- a/src/Player.hh +++ b/src/Player.hh @@ -44,7 +44,7 @@ struct SavedPlayerDataBB { // .nsc file format /* 185C */ ptext info_board; /* 19B4 */ PlayerInventory inventory; /* 1D00 */ parray quest_data1; - /* 1F08 */ parray quest_data2; + /* 1F08 */ parray quest_data2; /* 1F60 */ parray tech_menu_config; /* 1F88 */ diff --git a/src/QuestScript.cc b/src/QuestScript.cc index badf11ba..1d832ed0 100644 --- a/src/QuestScript.cc +++ b/src/QuestScript.cc @@ -838,7 +838,7 @@ static const QuestScriptOpcodeDefinition opcode_defs[] = { {0xF95B, "bb_send_6xD9", {INT32, INT32, INT32, INT32, LABEL16, LABEL16}, F_V4 | F_ARGS}, // Sends 6xD9 {0xF95C, "bb_exchange_slt", {INT32, INT32, INT32, INT32}, F_V4 | F_ARGS}, // Sends 6xDE {0xF95D, "bb_exchange_pc", {}, F_V4}, // Sends 6xDF - {0xF95E, "bb_box_create_bp", {INT32, INT32, INT32}, F_V4 | F_ARGS}, // Sends 6xE0 + {0xF95E, "bb_box_create_bp", {INT32, FLOAT32, FLOAT32}, F_V4 | F_ARGS}, // Sends 6xE0 {0xF95F, "bb_exchange_pt", {INT32, INT32, INT32, INT32, INT32}, F_V4 | F_ARGS}, // Sends 6xE1 {0xF960, "bb_send_6xE2", {INT32}, F_V4 | F_ARGS}, // Sends 6xE2 {0xF961, "bb_get_6xE3_status", {REG}, F_V4}, // Returns 0 if 6xE3 hasn't been received, 1 if the received item is valid, 2 if the received item is invalid diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index cddf7fe4..1e269667 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -1950,6 +1950,11 @@ static void on_upgrade_weapon_attribute_bb(shared_ptr c, uint8_t, uint8_ } } +static void on_write_quest_data2_bb(shared_ptr c, uint8_t, uint8_t, const void* data, size_t size) { + const auto& cmd = check_size_t(data, size); + c->game_data.player()->quest_data2[cmd.index] = cmd.value; +} + //////////////////////////////////////////////////////////////////////////////// typedef void (*subcommand_handler_t)(shared_ptr c, uint8_t command, uint8_t flag, const void* data, size_t size); @@ -2165,7 +2170,7 @@ subcommand_handler_t subcommand_handlers[0x100] = { /* 6xCF */ on_battle_restart_bb, /* 6xD0 */ on_battle_level_up_bb, /* 6xD1 */ nullptr, - /* 6xD2 */ nullptr, + /* 6xD2 */ on_write_quest_data2_bb, /* 6xD3 */ nullptr, /* 6xD4 */ nullptr, /* 6xD5 */ on_quest_exchange_item_bb,