fix: leave restored city shops safely

This commit is contained in:
2026-07-28 18:20:05 +09:00
parent cf93ba7234
commit a9e6e952c8
2 changed files with 46 additions and 10 deletions

View File

@@ -168,7 +168,13 @@ async function verifyRenderer(browserInstance, baseUrl, rendererFixture) {
);
await reloadAndContinueCity(page);
await openMarketWithRealInteraction(page);
await page.waitForFunction(() => {
const state = window.__HEROS_DEBUG__?.cityStay?.();
return (
state?.shop?.open === true &&
state?.explorationCheckpoint?.overlay?.type === 'shop'
);
});
city = await readCity(page);
assertMarketReceipt(city, `${rendererFixture.renderer} reload`);
const restoredOffer = findOffer(city, offerId);
@@ -217,12 +223,28 @@ async function verifyRenderer(browserInstance, baseUrl, rendererFixture) {
const diagnostic = await page.evaluate(() => ({
activeScenes:
window.__HEROS_DEBUG__?.activeScenes?.() ?? [],
scenes:
window.__HEROS_GAME__?.scene
.getScenes(false)
.map((scene) => ({
key: scene.scene.key,
active:
window.__HEROS_GAME__?.scene.isActive(
scene.scene.key
) ?? false,
status: scene.sys.settings.status
})) ?? [],
city: window.__HEROS_DEBUG__?.cityStay?.(),
camp: window.__HEROS_DEBUG__?.camp?.()
}));
throw new Error(
`${error.message}\nEquipment routing diagnostic: ${JSON.stringify(
diagnostic
{
...diagnostic,
ctaClickProbe,
pageErrors,
consoleErrors
}
)}`,
{ cause: error }
);

View File

@@ -327,8 +327,8 @@ export class CityStayScene extends Phaser.Scene {
this.dialogueState = undefined;
this.campaignObjectiveJournal?.destroy();
this.campaignObjectiveJournal = undefined;
this.closeChoicePanel(false);
this.closeShop(false);
this.closeChoicePanel(false, false);
this.closeShop(false, false);
releaseExplorationCharacterTextureKeys(
this,
this.characterTextureKeys()
@@ -2593,8 +2593,13 @@ export class CityStayScene extends Phaser.Scene {
this.time.now + inputCarryoverGuardMs;
}
private closeChoicePanel(persistCheckpoint = true) {
this.restoreActorDirection(this.choiceSourceNpcId);
private closeChoicePanel(
persistCheckpoint = true,
updateInteractionPresentation = true
) {
if (updateInteractionPresentation) {
this.restoreActorDirection(this.choiceSourceNpcId);
}
this.choicePanel?.destroy();
this.choicePanel = undefined;
this.choiceViews = [];
@@ -2602,7 +2607,9 @@ export class CityStayScene extends Phaser.Scene {
if (persistCheckpoint) {
this.persistExplorationCheckpoint(true);
}
this.refreshInteractionPrompt();
if (updateInteractionPresentation) {
this.refreshInteractionPrompt();
}
}
private openShop(
@@ -2955,8 +2962,13 @@ export class CityStayScene extends Phaser.Scene {
return [graphics];
}
private closeShop(persistCheckpoint = true) {
this.restoreActorDirection(this.shopSourceNpcId);
private closeShop(
persistCheckpoint = true,
updateInteractionPresentation = true
) {
if (updateInteractionPresentation) {
this.restoreActorDirection(this.shopSourceNpcId);
}
this.shopPanel?.destroy();
this.shopPanel = undefined;
this.shopOfferViews = [];
@@ -2965,7 +2977,9 @@ export class CityStayScene extends Phaser.Scene {
if (persistCheckpoint) {
this.persistExplorationCheckpoint(true);
}
this.refreshInteractionPrompt();
if (updateInteractionPresentation) {
this.refreshInteractionPrompt();
}
}
private itemBonusText(item: ReturnType<typeof getItem>) {