Skip to content

Commit 0d0af46

Browse files
committed
Fix lint errors
1 parent c07096e commit 0d0af46

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎src/runtime/domain/state/StateDialogManager.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,16 @@ class StateDialogManager {
5454

5555
markNpcDialogAsRead(npcId: string, variantKey: string | null) {
5656
const state = this.npcDialogReadState;
57-
if (!state || !npcId || !variantKey) return;
58-
state[npcId] = state[npcId] || {};
59-
state[npcId][variantKey] = true;
57+
if (!state || !variantKey) return;
58+
const npcState = state[npcId] ?? {};
59+
npcState[variantKey] = true;
60+
state[npcId] = npcState;
6061
}
6162

6263
hasReadNpcDialogVariant(npcId: string, variantKey: string | null): boolean {
6364
const state = this.npcDialogReadState;
64-
if (!state || !npcId || !variantKey) return false;
65-
return Boolean(state[npcId]?.[variantKey]);
65+
if (!state || !variantKey) return false;
66+
return state[npcId]?.[variantKey] === true;
6667
}
6768

6869
hasUnreadNpcDialog(npcId: string, variantKey: string | null): boolean {

‎src/types/gameState.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,12 @@ export type GameDefinition = {
193193
skillCustomizations?: SkillCustomizationMap;
194194
};
195195

196+
export type NpcDialogReadState = Partial<Record<string, Partial<Record<string, true>>>>;
197+
196198
export type RuntimeState = {
197199
player: PlayerRuntimeState;
198200
dialog: DialogState;
199-
npcDialogReadState: Record<string, Record<string, true>>;
201+
npcDialogReadState: NpcDialogReadState;
200202
enemies: EnemyDefinition[];
201203
variables: VariableDefinition[];
202204
gameOver: boolean;

0 commit comments

Comments
 (0)