File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff 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+
196198export 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 ;
You can’t perform that action at this time.
0 commit comments