diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index f19a3ab3..8170499a 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -2348,9 +2348,10 @@ static void on_buy_shop_item_bb(shared_ptr c, uint8_t, uint8_t, const vo auto p = c->character(); p->remove_meseta(price, false); - item.id = l->generate_item_id(c->lobby_client_id); + item.id = cmd.shop_item_id; + l->on_item_id_generated_externally(item.id); p->add_item(item); - send_create_inventory_item(c, item); + send_create_inventory_item(c, item, true); if (l->log.should_log(LogLevel::INFO)) { auto s = c->require_server_state(); diff --git a/src/SendCommands.cc b/src/SendCommands.cc index b49ef225..03b3f162 100644 --- a/src/SendCommands.cc +++ b/src/SendCommands.cc @@ -2349,14 +2349,18 @@ void send_pick_up_item(shared_ptr c, uint32_t item_id, uint8_t floor) { send_command_t(l, 0x60, 0x00, cmd); } -void send_create_inventory_item(shared_ptr c, const ItemData& item) { +void send_create_inventory_item(shared_ptr c, const ItemData& item, bool exclude_c) { auto l = c->require_lobby(); if (c->version() != Version::BB_V4) { throw logic_error("6xBE can only be sent to BB clients"); } uint16_t client_id = c->lobby_client_id; G_CreateInventoryItem_BB_6xBE cmd = {{0xBE, 0x07, client_id}, item, 0}; - 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_destroy_item(shared_ptr c, uint32_t item_id, uint32_t amount, bool exclude_c) { diff --git a/src/SendCommands.hh b/src/SendCommands.hh index 10c9e79b..9f16284a 100644 --- a/src/SendCommands.hh +++ b/src/SendCommands.hh @@ -305,7 +305,7 @@ void send_drop_item(std::shared_ptr l, const ItemData& item, void send_drop_stacked_item(std::shared_ptr s, Channel& ch, const ItemData& item, uint8_t floor, float x, float z); 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_create_inventory_item(std::shared_ptr c, const ItemData& item, bool exclude_c = false); 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);