From 33bbb15bf0603ff555103a59a715058bef2324b6 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Mon, 4 Dec 2023 18:23:41 -0800 Subject: [PATCH] fix stacked item bank deposit bug --- src/ReceiveSubcommands.cc | 2 +- src/SendCommands.cc | 8 ++++++-- src/SendCommands.hh | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index b8166d67..8372fa8d 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -1472,7 +1472,7 @@ static void on_ep3_private_word_select_bb_bank_action(shared_ptr c, uint } else { // Deposit item auto item = p->remove_item(cmd.item_id, cmd.item_amount, c->version() != Version::BB_V4); bank.add_item(item); - send_destroy_item(c, cmd.item_id, cmd.item_amount); + send_destroy_item(c, cmd.item_id, cmd.item_amount, true); string name = s->item_name_index->describe_item(Version::BB_V4, item); l->log.info("Player %hu deposited item %08" PRIX32 " (x%hhu) (%s) in the bank", diff --git a/src/SendCommands.cc b/src/SendCommands.cc index fe4b7ca9..30f5d808 100644 --- a/src/SendCommands.cc +++ b/src/SendCommands.cc @@ -2331,11 +2331,15 @@ void send_create_inventory_item(shared_ptr c, const ItemData& item) { send_command_t(l, 0x60, 0x00, cmd); } -void send_destroy_item(shared_ptr c, uint32_t item_id, uint32_t amount) { +void send_destroy_item(shared_ptr c, uint32_t item_id, uint32_t amount, bool exclude_c) { auto l = c->require_lobby(); uint16_t client_id = c->lobby_client_id; G_DeleteInventoryItem_6x29 cmd = {{0x29, 0x03, client_id}, item_id, amount}; - send_command_t(l, 0x60, 0x00, cmd); + if (exclude_c) { + send_command_excluding_client(l, c, 0x60, 0x00, &cmd, sizeof(cmd)); + } else { + send_command_t(l, 0x60, 0x00, cmd); + } } void send_item_identify_result(shared_ptr c) { diff --git a/src/SendCommands.hh b/src/SendCommands.hh index c629b855..7ece4ed4 100644 --- a/src/SendCommands.hh +++ b/src/SendCommands.hh @@ -308,7 +308,7 @@ void send_drop_stacked_item(std::shared_ptr s, Channel& ch, const I void send_drop_stacked_item(std::shared_ptr l, const ItemData& item, uint8_t floor, float x, float z); void send_pick_up_item(std::shared_ptr c, uint32_t id, uint8_t floor); void send_create_inventory_item(std::shared_ptr c, const ItemData& item); -void send_destroy_item(std::shared_ptr c, uint32_t item_id, uint32_t amount); +void send_destroy_item(std::shared_ptr c, uint32_t item_id, uint32_t amount, bool exclude_c = false); void send_item_identify_result(std::shared_ptr c); void send_bank(std::shared_ptr c); void send_shop(std::shared_ptr c, uint8_t shop_type);