mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-10-23 18:23:15 +02:00
33 lines
834 B
TypeScript
33 lines
834 B
TypeScript
|
import { Reviver,
|
||
|
Generic_toJSON,
|
||
|
Generic_fromJSON } from "../../utils/JSONReviver";
|
||
|
|
||
|
export class Message {
|
||
|
// Initializes a Message Object from a JSON save state
|
||
|
static fromJSON(value: any): Message {
|
||
|
return Generic_fromJSON(Message, value.data);
|
||
|
}
|
||
|
|
||
|
// Name of Message file
|
||
|
filename: string = "";
|
||
|
|
||
|
// The text contains in the Message
|
||
|
msg: string = "":
|
||
|
|
||
|
// Flag indicating whether this Message has been received by the player
|
||
|
recvd: boolean = false;
|
||
|
|
||
|
constructor(filename="", msg="") {
|
||
|
this.filename = filename;
|
||
|
this.msg = msg;
|
||
|
this.recvd = false;
|
||
|
}
|
||
|
|
||
|
// Serialize the current object to a JSON save state
|
||
|
toJSON(): any {
|
||
|
return Generic_toJSON("Message", this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Reviver.constructors.Message = Message;
|