mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 09:04:13 +02:00
Merge pull request #5 from gpittarelli/console-cmd-normalize
Give ConsoleCmd a Packet type
This commit is contained in:
commit
5a6bce25af
3 changed files with 13 additions and 3 deletions
|
|
@ -11,6 +11,11 @@ export interface StringTablePacket {
|
||||||
tables: StringTable[];
|
tables: StringTable[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ConsoleCmdPacket {
|
||||||
|
packetType: 'consoleCmd';
|
||||||
|
command: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface DataTablePacket {
|
export interface DataTablePacket {
|
||||||
packetType: 'dataTable';
|
packetType: 'dataTable';
|
||||||
tables: SendTable[];
|
tables: SendTable[];
|
||||||
|
|
@ -149,4 +154,5 @@ export type Packet = BSPDecalPacket |
|
||||||
VoiceInitPacket |
|
VoiceInitPacket |
|
||||||
VoiceDataPacket |
|
VoiceDataPacket |
|
||||||
MenuPacket |
|
MenuPacket |
|
||||||
|
ConsoleCmdPacket |
|
||||||
CmdKeyValuesPacket;
|
CmdKeyValuesPacket;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
|
import {ConsoleCmdPacket} from "../../Data/Packet";
|
||||||
import {Parser} from './Parser';
|
import {Parser} from './Parser';
|
||||||
|
|
||||||
export class ConsoleCmd extends Parser {
|
export class ConsoleCmd extends Parser {
|
||||||
parse() {
|
parse(): ConsoleCmdPacket[] {
|
||||||
return this.stream.readUTF8String();
|
return [{
|
||||||
|
packetType: 'consoleCmd',
|
||||||
|
command: this.stream.readUTF8String()
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,5 +21,5 @@ export abstract class Parser {
|
||||||
this.skippedPackets = skippedPacket;
|
this.skippedPackets = skippedPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract parse(): Packet[]|string;
|
abstract parse(): Packet[];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue