diff --git a/src/Lobby.cc b/src/Lobby.cc index 7396f1c7..22c1ac63 100644 --- a/src/Lobby.cc +++ b/src/Lobby.cc @@ -480,11 +480,7 @@ void Lobby::add_client(shared_ptr c, ssize_t required_client_id) { this->next_game_item_id = m.reassign_all_item_ids(this->next_game_item_id); } } - // On DC NTE and 11/2000, the game assigns item IDs immediately when a - // player joins a game, then assigns them again after the 6x6D equivalent is - // received. For this reason, we consume item IDs here only if the client is - // NTE or 11/2000. - this->assign_inventory_and_bank_item_ids(c, is_pre_v1(c->version())); + this->assign_inventory_and_bank_item_ids(c); // On BB, we send artificial flag state to fix an Episode 2 bug where the // CCA door lock state is overwritten by quests. if (c->version() == Version::BB_V4) { @@ -711,16 +707,12 @@ void Lobby::on_item_id_generated_externally(uint32_t item_id) { } } -void Lobby::assign_inventory_and_bank_item_ids(shared_ptr c, bool consume_ids) { +void Lobby::assign_inventory_and_bank_item_ids(shared_ptr c) { auto p = c->character(); - uint32_t start_item_id = this->next_item_id_for_client[c->lobby_client_id]; for (size_t z = 0; z < p->inventory.num_items; z++) { p->inventory.items[z].data.id = this->generate_item_id(c->lobby_client_id); } - if (!consume_ids) { - this->next_item_id_for_client[c->lobby_client_id] = start_item_id; - } - if (c->log.info("Assigned inventory item IDs%s", consume_ids ? "" : " but did not mark IDs as used")) { + if (c->log.info("Assigned inventory item IDs")) { p->print_inventory(stderr, c->version(), c->require_server_state()->item_name_index); if (p->bank.num_items) { p->bank.assign_ids(0x99000000 + (c->lobby_client_id << 20)); diff --git a/src/Lobby.hh b/src/Lobby.hh index 3377bd97..3efacc4b 100644 --- a/src/Lobby.hh +++ b/src/Lobby.hh @@ -233,7 +233,7 @@ struct Lobby : public std::enable_shared_from_this { uint32_t generate_item_id(uint8_t client_id); void on_item_id_generated_externally(uint32_t item_id); - void assign_inventory_and_bank_item_ids(std::shared_ptr c, bool consume_ids); + void assign_inventory_and_bank_item_ids(std::shared_ptr c); QuestIndex::IncludeCondition quest_include_condition() const; diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index f927137a..9037f241 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -1957,7 +1957,7 @@ static void on_quest_loaded(shared_ptr l) { lc->use_default_bank(); lc->create_challenge_overlay(lc->version(), l->quest->challenge_template_index, s->level_table); lc->log.info("Created challenge overlay"); - l->assign_inventory_and_bank_item_ids(lc, true); + l->assign_inventory_and_bank_item_ids(lc); } } } @@ -3536,7 +3536,7 @@ static void on_DF_BB(shared_ptr c, uint16_t command, uint32_t, string& d lc->use_default_bank(); lc->create_challenge_overlay(lc->version(), l->quest->challenge_template_index, s->level_table); lc->log.info("Created challenge overlay"); - l->assign_inventory_and_bank_item_ids(lc, true); + l->assign_inventory_and_bank_item_ids(lc); } } @@ -4270,10 +4270,6 @@ static void on_6F(shared_ptr c, uint16_t command, uint32_t, string& data } c->config.clear_flag(Client::Flag::LOADING); - if (command == 0x006F) { - l->assign_inventory_and_bank_item_ids(c, true); - } - send_server_time(c); if (l->base_version == Version::BB_V4) { send_set_exp_multiplier(l); diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index aae4c1db..c2c8c421 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -904,12 +904,13 @@ static void on_set_player_visible(shared_ptr c, uint8_t command, uint8_t static void on_change_floor_6x1F(shared_ptr c, uint8_t command, uint8_t flag, void* data, size_t size) { if (is_pre_v1(c->version())) { check_size_t(data, size); - // DC NTE and 11/2000 don't send 6F when they're done loading, so we do the - // relevant things 6F would do here instead. + // DC NTE and 11/2000 don't send 6F when they're done loading, so we clear + // the loading flag here instead. On these versions, it also seems to be + // necessary to assign item IDs again here. if (c->config.check_flag(Client::Flag::LOADING)) { c->config.clear_flag(Client::Flag::LOADING); auto l = c->require_lobby(); - l->assign_inventory_and_bank_item_ids(c, true); + l->assign_inventory_and_bank_item_ids(c); } } else {