51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import Packet from "../packet";
|
|
import Stream from "../stream";
|
|
|
|
export class PacketUserInfo extends Packet {
|
|
private privateKey : string = "";
|
|
private username: string = "";
|
|
private title: string = "";
|
|
|
|
public getPacketId(): number {
|
|
return 0x01;
|
|
}
|
|
|
|
public _receive(stream: Stream): void {
|
|
this.username = stream.readString();
|
|
this.title = stream.readString();
|
|
this.privateKey = stream.readString();
|
|
}
|
|
|
|
public _send(): Stream {
|
|
const stream = new Stream();
|
|
stream.writeInt16(this.getPacketId());
|
|
stream.writeString(this.username);
|
|
stream.writeString(this.title);
|
|
stream.writeString(this.privateKey);
|
|
return stream;
|
|
}
|
|
|
|
public getUsername(): string {
|
|
return this.username;
|
|
}
|
|
|
|
public setUsername(username: string): void {
|
|
this.username = username;
|
|
}
|
|
|
|
public getTitle(): string {
|
|
return this.title;
|
|
}
|
|
|
|
public setTitle(title: string): void {
|
|
this.title = title;
|
|
}
|
|
|
|
public setPrivateKey(privateKey: string): void {
|
|
this.privateKey = privateKey;
|
|
}
|
|
|
|
public getPrivateKey(): string {
|
|
return this.privateKey;
|
|
}
|
|
} |