import { EntityAttributes } from '../../../phaser/entities/cc-entity' ; import { AbstractEvent , EventType } from './abstract-event' ; export interface OpenQuestDialogData extends EventType { quest : string ; npc ? : string ; map ? : string ; accepted : AbstractEvent < any > [ ] ; declined : AbstractEvent < any > [ ] ; acceptVar ? : string ; cancelVar ? : string ; activate ? : boolean ; } export class OpenQuestDialog extends AbstractEvent < OpenQuestDialogData > { private attributes : EntityAttributes = { quest : { type : 'Quest' , ignoreSubs : true , description : 'The quest to open' } , npc : { type : 'Character' , optional : true , description : 'Character to use as quest giver, override default and can be used in event triggers.' } , map : { type : 'Maps' , optional : true , description : 'Map to show instead of the automated one' } , } ; getAttributes ( ) { return this . attributes ; } update ( ) { this . info = this . combineStrings ( this . getTypeString ( '#7ea3ff' ) , this . getPropString ( 'quest' ) , this . getPropString ( 'npc' ) , this . getPropString ( 'map' ) ) ; this . children = [ { title : this . getColoredString ( 'Quest. Accepted' , '#838383' ) , events : this . data . accepted , draggable : false } , { title : this . getColoredString ( 'Quest. Declined' , '#838383' ) , events : this . data . declined , draggable : false } ] ; } export ( ) { const out = { type : this . data . type , quest : this . data . quest ?? '' , npc : this . data . npc , map : this . data . map , activate : this . data . activate , acceptVar : this . data . acceptVar , cancelVar : this . data . cancelVar , accepted : this . data . accepted . map ( v => v . export ( ) ) , declined : this . data . declined . map ( v => v . export ( ) ) , } ; return out ; } protected generateNewDataInternal ( ) { return { quest : '' , accepted : [ ] , declined : [ ] , } ; } }