31 lines
643 B
TypeScript
31 lines
643 B
TypeScript
|
import OutputPacket from '@lastres/output-packet'
|
||
|
|
||
|
export interface OutputPacketTalkData {
|
||
|
npc: string
|
||
|
word?: string
|
||
|
}
|
||
|
|
||
|
export default class OutputPacketTalk extends OutputPacket {
|
||
|
npc: string
|
||
|
word: string | null
|
||
|
constructor (npc: string, word: string | null = null) {
|
||
|
super()
|
||
|
this.npc = npc
|
||
|
this.word = word
|
||
|
}
|
||
|
|
||
|
command (): string {
|
||
|
return 'talk'
|
||
|
}
|
||
|
|
||
|
data (): OutputPacketTalkData {
|
||
|
const output: OutputPacketTalkData = {
|
||
|
npc: this.npc
|
||
|
}
|
||
|
if (this.word !== null) {
|
||
|
output.word = this.word
|
||
|
}
|
||
|
return output
|
||
|
}
|
||
|
}
|