From 95e4124b0c02b4e5be383c41ed4241566f40e6e6 Mon Sep 17 00:00:00 2001 From: David Skoland Date: Sat, 7 Feb 2026 21:53:59 +0100 Subject: Prefetch char.ini for characters present in area via playerlist Store player data (charId, area) in an in-memory Map on the client, updated by PR/PU packet handlers. Use this to eagerly load char.ini when a player's character appears in our area or when switching areas, eliminating the lazy-load delay on first IC message. Co-Authored-By: Claude Opus 4.6 --- webAO/dom/areaClick.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'webAO/dom/areaClick.ts') diff --git a/webAO/dom/areaClick.ts b/webAO/dom/areaClick.ts index 1e41f4b..19953a5 100644 --- a/webAO/dom/areaClick.ts +++ b/webAO/dom/areaClick.ts @@ -1,5 +1,6 @@ import { client } from "../client"; import { updatePlayerAreas } from "./updatePlayerAreas"; +import { ensureCharIni } from "../client/handleCharacterInfo"; /** * Triggered when an item on the area list is clicked. * @param {HTMLElement} el @@ -14,5 +15,12 @@ export function area_click(el: HTMLElement) { document.getElementById("client_log")!.appendChild(areaHr); client.area = Number(el.id.substring(4)); updatePlayerAreas(client.area); + + // Prefetch char.ini for all characters present in the new area + for (const player of client.players.values()) { + if (player.area === client.area && player.charId >= 0) { + ensureCharIni(player.charId); + } + } } window.area_click = area_click; -- cgit