Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Give ConsoleCmd a Packet type #5

Merged
merged 1 commit into from
Mar 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Data/Packet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export interface StringTablePacket {
tables: StringTable[];
}

export interface ConsoleCmdPacket {
packetType: 'consoleCmd';
command: string;
}

export interface DataTablePacket {
packetType: 'dataTable';
tables: SendTable[];
Expand Down Expand Up @@ -149,4 +154,5 @@ export type Packet = BSPDecalPacket |
VoiceInitPacket |
VoiceDataPacket |
MenuPacket |
ConsoleCmdPacket |
CmdKeyValuesPacket;
8 changes: 6 additions & 2 deletions src/Parser/Message/ConsoleCmd.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import {ConsoleCmdPacket} from "../../Data/Packet";
import {Parser} from './Parser';

export class ConsoleCmd extends Parser {
parse() {
return this.stream.readUTF8String();
parse(): ConsoleCmdPacket[] {
return [{
packetType: 'consoleCmd',
command: this.stream.readUTF8String()
}];
}
}
2 changes: 1 addition & 1 deletion src/Parser/Message/Parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ export abstract class Parser {
this.skippedPackets = skippedPacket;
}

abstract parse(): Packet[]|string;
abstract parse(): Packet[];
}