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 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); city = await readCity(page);
assertMarketReceipt(city, `${rendererFixture.renderer} reload`); assertMarketReceipt(city, `${rendererFixture.renderer} reload`);
const restoredOffer = findOffer(city, offerId); const restoredOffer = findOffer(city, offerId);
@@ -217,12 +223,28 @@ async function verifyRenderer(browserInstance, baseUrl, rendererFixture) {
const diagnostic = await page.evaluate(() => ({ const diagnostic = await page.evaluate(() => ({
activeScenes: activeScenes:
window.__HEROS_DEBUG__?.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?.(), city: window.__HEROS_DEBUG__?.cityStay?.(),
camp: window.__HEROS_DEBUG__?.camp?.() camp: window.__HEROS_DEBUG__?.camp?.()
})); }));
throw new Error( throw new Error(
`${error.message}\nEquipment routing diagnostic: ${JSON.stringify( `${error.message}\nEquipment routing diagnostic: ${JSON.stringify(
diagnostic {
...diagnostic,
ctaClickProbe,
pageErrors,
consoleErrors
}
)}`, )}`,
{ cause: error } { cause: error }
); );

View File

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