enable item tracking on NTE and 11/2000 and make $item work

This commit is contained in:
Martin Michelsen
2023-12-16 17:44:17 -08:00
parent 74604788c9
commit f14f7dd93b
10 changed files with 466 additions and 469 deletions
+6 -5
View File
@@ -479,10 +479,11 @@ void Lobby::add_client(shared_ptr<Client> c, ssize_t required_client_id) {
this->next_game_item_id = m.reassign_all_item_ids(this->next_game_item_id);
}
}
// We don't consume item IDs here because the 6F handler will do it for
// real; we just want to see what they would be when the join command is
// sent
this->assign_inventory_and_bank_item_ids(c, false);
// 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()));
}
// If the lobby is recording a battle record, add the player join event
@@ -713,7 +714,7 @@ void Lobby::assign_inventory_and_bank_item_ids(shared_ptr<Client> c, bool consum
if (!consume_ids) {
this->next_item_id_for_client[c->lobby_client_id] = start_item_id;
}
if (c->log.info("Assigned inventory item IDs")) {
if (c->log.info("Assigned inventory item IDs%s", consume_ids ? "" : " but did not mark IDs as used")) {
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));