i missed a spot...

This commit is contained in:
TheLostTree 2022-07-28 18:44:34 -07:00
parent 400bb016b8
commit d0881c9f91
2 changed files with 5 additions and 2 deletions

View File

@ -17,6 +17,8 @@ const packetIds: { [key: string]: PacketType } = (function () {
})();
console.log(packetIds.PlayerGetTokenReq)
const c = new Logger("Packet")
export default class Packet {
@ -30,6 +32,7 @@ export default class Packet {
this.data = rawData.subarray(12 + metadataLength, 12 + metadataLength + rawData.readUInt32BE(8));
this.cmdid = this.rawData.readUInt16BE(4);
this.protoName = this.protoName || packetIds[this.cmdid.toString()];
if (this.protoName) {
try {

View File

@ -3,7 +3,7 @@ import { RemoteInfo } from 'dgram';
import { resolve } from 'path';
import fs from 'fs';
import KCP from 'node-kcp-token';
import Packet from './Packet';
import Packet, { PacketType } from './Packet';
import Logger, { VerboseLevel } from '../../util/Logger';
import defaultHandler from '../packets/PacketHandler';
@ -71,7 +71,7 @@ export default class Session {
});
}
public send(name: string, body: {}) {
public send(name: PacketType, body: {}) {
const packet = Packet.encode(name, body);
if (!packet) return;
if (Logger.VERBOSE_LEVEL >= VerboseLevel.WARNS) this.c.log(packet.protoName);