teeworlds 2.0.9 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/MsgUnpacker.js +32 -13
- package/lib/MsgUnpacker.ts +32 -16
- package/lib/client.js +22 -24
- package/lib/client.ts +48 -30
- package/lib/snapshot.js +2 -2
- package/lib/snapshot.ts +1 -1
- package/package.json +1 -1
package/lib/MsgUnpacker.js
CHANGED
|
@@ -1,37 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MsgUnpacker = exports.unpackString = exports.unpackInt = void 0;
|
|
2
4
|
var decoder = new TextDecoder('utf-8');
|
|
3
5
|
function unpackInt(pSrc) {
|
|
4
6
|
var result = 0;
|
|
5
7
|
var len = 1;
|
|
6
8
|
var iter = pSrc[Symbol.iterator]();
|
|
7
9
|
var src = iter.next();
|
|
8
|
-
// if (src.done)
|
|
9
|
-
// console.warn("Unexpected end", src)
|
|
10
10
|
src = src.value;
|
|
11
11
|
var sign = ((src >> 6) & 1);
|
|
12
12
|
result |= (src & 63);
|
|
13
13
|
for (var i = 0; i < 4; i++) {
|
|
14
|
-
if ((src & 128)
|
|
14
|
+
if ((src & 128) === 0)
|
|
15
15
|
break;
|
|
16
16
|
src = iter.next();
|
|
17
|
-
// console.log(src & 0b1000_0000)
|
|
18
|
-
// if (src.done)
|
|
19
|
-
// console.warn("Unexpected end", src);
|
|
20
17
|
src = src.value;
|
|
21
|
-
len
|
|
22
|
-
if (i == 3 && (src & 240) != 0)
|
|
23
|
-
console.warn("NonZeroIntPadding");
|
|
18
|
+
len++;
|
|
24
19
|
result |= ((src & 127)) << (6 + 7 * i);
|
|
25
20
|
}
|
|
26
|
-
if (len > 1 && src == 0) {
|
|
27
|
-
console.warn("OverlongIntEncoding");
|
|
28
|
-
}
|
|
29
21
|
result ^= -sign;
|
|
30
22
|
return { result: result, remaining: Array.from(iter) };
|
|
31
23
|
}
|
|
24
|
+
exports.unpackInt = unpackInt;
|
|
32
25
|
function unpackString(pSrc) {
|
|
33
26
|
var result = pSrc.slice(0, pSrc.indexOf(0));
|
|
34
27
|
pSrc = pSrc.slice(pSrc.indexOf(0), pSrc.length);
|
|
35
28
|
return { result: decoder.decode(new Uint8Array(result)), remaining: pSrc };
|
|
36
29
|
}
|
|
37
|
-
|
|
30
|
+
exports.unpackString = unpackString;
|
|
31
|
+
var MsgUnpacker = /** @class */ (function () {
|
|
32
|
+
function MsgUnpacker(pSrc) {
|
|
33
|
+
this.remaining = pSrc;
|
|
34
|
+
}
|
|
35
|
+
MsgUnpacker.prototype.unpackInt = function (_unpacked) {
|
|
36
|
+
if (_unpacked === void 0) { _unpacked = false; }
|
|
37
|
+
var unpacked;
|
|
38
|
+
if (!_unpacked) {
|
|
39
|
+
unpacked = unpackInt(this.remaining);
|
|
40
|
+
this.remaining = unpacked.remaining;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
unpacked = { result: this.remaining[0] };
|
|
44
|
+
this.remaining = this.remaining.slice(1);
|
|
45
|
+
}
|
|
46
|
+
return unpacked.result;
|
|
47
|
+
};
|
|
48
|
+
MsgUnpacker.prototype.unpackString = function () {
|
|
49
|
+
var unpacked = unpackString(this.remaining);
|
|
50
|
+
this.remaining = unpacked.remaining;
|
|
51
|
+
return unpacked.result;
|
|
52
|
+
};
|
|
53
|
+
return MsgUnpacker;
|
|
54
|
+
}());
|
|
55
|
+
exports.MsgUnpacker = MsgUnpacker;
|
|
56
|
+
// export = {MsgUnpacker, unpackInt, unpackString}
|
package/lib/MsgUnpacker.ts
CHANGED
|
@@ -1,44 +1,60 @@
|
|
|
1
1
|
var decoder = new TextDecoder('utf-8');
|
|
2
|
-
function unpackInt(pSrc: number[]): {result: number, remaining: number[]} {
|
|
2
|
+
export function unpackInt(pSrc: number[]): {result: number, remaining: number[]} {
|
|
3
3
|
var result = 0;
|
|
4
4
|
var len = 1;
|
|
5
5
|
|
|
6
6
|
var iter = pSrc[Symbol.iterator]()
|
|
7
7
|
var src: any = iter.next()
|
|
8
|
-
// if (src.done)
|
|
9
|
-
// console.warn("Unexpected end", src)
|
|
10
8
|
src = src.value
|
|
11
9
|
var sign = ((src >> 6) & 1)
|
|
12
10
|
|
|
13
11
|
result |= (src & 0b0011_1111)
|
|
14
12
|
for (let i = 0; i < 4; i++) {
|
|
15
13
|
|
|
16
|
-
if ((src & 0b1000_0000)
|
|
14
|
+
if ((src & 0b1000_0000) === 0)
|
|
17
15
|
break;
|
|
18
16
|
src = iter.next()
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// console.warn("Unexpected end", src);
|
|
23
|
-
src = src.value
|
|
24
|
-
len += 1;
|
|
25
|
-
if (i == 3 && (src & 0b1111_0000) != 0)
|
|
26
|
-
console.warn("NonZeroIntPadding")
|
|
18
|
+
src = src.value;
|
|
19
|
+
len++;
|
|
27
20
|
result |= ((src & 0b0111_1111)) << (6+7*i)
|
|
28
21
|
|
|
29
22
|
}
|
|
30
|
-
if (len > 1 && src == 0b0000_0000) {
|
|
31
|
-
console.warn("OverlongIntEncoding")
|
|
32
|
-
}
|
|
33
23
|
result ^= -sign;
|
|
34
24
|
|
|
35
25
|
return {result, remaining: Array.from(iter)};
|
|
36
26
|
}
|
|
37
|
-
function unpackString(pSrc: number[]): {result: string, remaining: number[]} {
|
|
27
|
+
export function unpackString(pSrc: number[]): {result: string, remaining: number[]} {
|
|
38
28
|
var result = pSrc.slice(0, pSrc.indexOf(0))
|
|
39
29
|
pSrc = pSrc.slice(pSrc.indexOf(0), pSrc.length)
|
|
40
30
|
return {result: decoder.decode(new Uint8Array(result)), remaining: pSrc}
|
|
41
31
|
}
|
|
42
32
|
|
|
33
|
+
export class MsgUnpacker {
|
|
34
|
+
remaining: number[];
|
|
35
|
+
constructor(pSrc: number[]) {
|
|
36
|
+
this.remaining = pSrc;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
unpackInt(_unpacked = false): number {
|
|
40
|
+
let unpacked;
|
|
41
|
+
if (!_unpacked) {
|
|
42
|
+
unpacked = unpackInt(this.remaining);
|
|
43
|
+
this.remaining = unpacked.remaining;
|
|
44
|
+
} else {
|
|
45
|
+
unpacked = {result: this.remaining[0]};
|
|
46
|
+
this.remaining = this.remaining.slice(1);
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
return unpacked.result;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
unpackString(): string {
|
|
53
|
+
let unpacked = unpackString(this.remaining);
|
|
54
|
+
this.remaining = unpacked.remaining;
|
|
55
|
+
return unpacked.result;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
43
59
|
|
|
44
|
-
export = {unpackInt, unpackString}
|
|
60
|
+
// export = {MsgUnpacker, unpackInt, unpackString}
|
package/lib/client.js
CHANGED
|
@@ -54,7 +54,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
54
54
|
var crypto_1 = require("crypto");
|
|
55
55
|
var dgram_1 = __importDefault(require("dgram"));
|
|
56
56
|
var stream_1 = require("stream");
|
|
57
|
-
var MsgUnpacker_1 =
|
|
57
|
+
var MsgUnpacker_1 = require("./MsgUnpacker");
|
|
58
58
|
var MsgPacker_1 = __importDefault(require("./MsgPacker"));
|
|
59
59
|
var snapshot_1 = require("./snapshot");
|
|
60
60
|
var huffman_1 = __importDefault(require("./huffman"));
|
|
@@ -306,11 +306,11 @@ var Client = /** @class */ (function (_super) {
|
|
|
306
306
|
chat.forEach(function (a) {
|
|
307
307
|
if (a.msg == "SV_CHAT") {
|
|
308
308
|
var unpacked = {};
|
|
309
|
-
unpacked.team = MsgUnpacker_1.
|
|
310
|
-
var remaining = MsgUnpacker_1.
|
|
311
|
-
unpacked.client_id = MsgUnpacker_1.
|
|
312
|
-
remaining = MsgUnpacker_1.
|
|
313
|
-
unpacked.message = MsgUnpacker_1.
|
|
309
|
+
unpacked.team = MsgUnpacker_1.unpackInt(a.raw.toJSON().data).result;
|
|
310
|
+
var remaining = MsgUnpacker_1.unpackInt(a.raw.toJSON().data).remaining;
|
|
311
|
+
unpacked.client_id = MsgUnpacker_1.unpackInt(remaining).result;
|
|
312
|
+
remaining = MsgUnpacker_1.unpackInt(remaining).remaining;
|
|
313
|
+
unpacked.message = MsgUnpacker_1.unpackString(remaining).result;
|
|
314
314
|
if (unpacked.client_id != -1)
|
|
315
315
|
unpacked.author = { ClientInfo: _this.client_infos[unpacked.client_id], PlayerInfo: _this.player_infos[unpacked.client_id] };
|
|
316
316
|
// console.log(unpacked)
|
|
@@ -323,13 +323,11 @@ var Client = /** @class */ (function (_super) {
|
|
|
323
323
|
chat.forEach(function (a) {
|
|
324
324
|
if (a.msg == "SV_KILL_MSG") {
|
|
325
325
|
var unpacked = {};
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
unpacked.victim_id =
|
|
329
|
-
|
|
330
|
-
unpacked.
|
|
331
|
-
remaining = MsgUnpacker_1.default.unpackInt(remaining).remaining;
|
|
332
|
-
unpacked.special_mode = MsgUnpacker_1.default.unpackInt(remaining).result;
|
|
326
|
+
var unpacker = new MsgUnpacker_1.MsgUnpacker(a.raw.toJSON().data);
|
|
327
|
+
unpacked.killer_id = unpacker.unpackInt();
|
|
328
|
+
unpacked.victim_id = unpacker.unpackInt();
|
|
329
|
+
unpacked.weapon = unpacker.unpackInt();
|
|
330
|
+
unpacked.special_mode = unpacker.unpackInt();
|
|
333
331
|
if (unpacked.victim_id != -1)
|
|
334
332
|
unpacked.victim = { ClientInfo: _this.client_infos[unpacked.victim_id], PlayerInfo: _this.player_infos[unpacked.victim_id] };
|
|
335
333
|
if (unpacked.killer_id != -1)
|
|
@@ -360,7 +358,7 @@ var Client = /** @class */ (function (_super) {
|
|
|
360
358
|
else if (a.toJSON().data[3] == 0x4) {
|
|
361
359
|
// disconnected
|
|
362
360
|
this.State = 0;
|
|
363
|
-
reason = (MsgUnpacker_1.
|
|
361
|
+
reason = (MsgUnpacker_1.unpackString(a.toJSON().data.slice(4)).result);
|
|
364
362
|
this.State = -1;
|
|
365
363
|
this.emit("disconnect", reason);
|
|
366
364
|
}
|
|
@@ -407,19 +405,19 @@ var Client = /** @class */ (function (_super) {
|
|
|
407
405
|
num_parts_1 = 1;
|
|
408
406
|
chunks.forEach(function (chunk) {
|
|
409
407
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
410
|
-
var AckGameTick = (MsgUnpacker_1.
|
|
411
|
-
chunk.raw = Buffer.from(MsgUnpacker_1.
|
|
412
|
-
var DeltaTick = MsgUnpacker_1.
|
|
408
|
+
var AckGameTick = (MsgUnpacker_1.unpackInt(chunk.raw.toJSON().data).result);
|
|
409
|
+
chunk.raw = Buffer.from(MsgUnpacker_1.unpackInt((_a = chunk === null || chunk === void 0 ? void 0 : chunk.raw) === null || _a === void 0 ? void 0 : _a.toJSON().data).remaining);
|
|
410
|
+
var DeltaTick = MsgUnpacker_1.unpackInt((_b = chunk === null || chunk === void 0 ? void 0 : chunk.raw) === null || _b === void 0 ? void 0 : _b.toJSON().data).result;
|
|
413
411
|
if (chunk.msg == "SNAP") {
|
|
414
|
-
chunk.raw = Buffer.from(MsgUnpacker_1.
|
|
415
|
-
num_parts_1 = (MsgUnpacker_1.
|
|
416
|
-
chunk.raw = Buffer.from(MsgUnpacker_1.
|
|
417
|
-
part_1 = (MsgUnpacker_1.
|
|
412
|
+
chunk.raw = Buffer.from(MsgUnpacker_1.unpackInt((_c = chunk === null || chunk === void 0 ? void 0 : chunk.raw) === null || _c === void 0 ? void 0 : _c.toJSON().data).remaining); // delta tick
|
|
413
|
+
num_parts_1 = (MsgUnpacker_1.unpackInt((_d = chunk === null || chunk === void 0 ? void 0 : chunk.raw) === null || _d === void 0 ? void 0 : _d.toJSON().data).result);
|
|
414
|
+
chunk.raw = Buffer.from(MsgUnpacker_1.unpackInt((_e = chunk === null || chunk === void 0 ? void 0 : chunk.raw) === null || _e === void 0 ? void 0 : _e.toJSON().data).remaining); // num parts
|
|
415
|
+
part_1 = (MsgUnpacker_1.unpackInt((_f = chunk === null || chunk === void 0 ? void 0 : chunk.raw) === null || _f === void 0 ? void 0 : _f.toJSON().data).result);
|
|
418
416
|
}
|
|
419
|
-
chunk.raw = Buffer.from(MsgUnpacker_1.
|
|
417
|
+
chunk.raw = Buffer.from(MsgUnpacker_1.unpackInt((_g = chunk === null || chunk === void 0 ? void 0 : chunk.raw) === null || _g === void 0 ? void 0 : _g.toJSON().data).remaining); // part
|
|
420
418
|
if (chunk.msg != "SNAP_EMPTY")
|
|
421
|
-
chunk.raw = Buffer.from(MsgUnpacker_1.
|
|
422
|
-
chunk.raw = Buffer.from(MsgUnpacker_1.
|
|
419
|
+
chunk.raw = Buffer.from(MsgUnpacker_1.unpackInt((_h = chunk === null || chunk === void 0 ? void 0 : chunk.raw) === null || _h === void 0 ? void 0 : _h.toJSON().data).remaining); // crc
|
|
420
|
+
chunk.raw = Buffer.from(MsgUnpacker_1.unpackInt((_j = chunk === null || chunk === void 0 ? void 0 : chunk.raw) === null || _j === void 0 ? void 0 : _j.toJSON().data).remaining); // crc
|
|
423
421
|
if (part_1 == 0 || _this.snaps.length > 30) {
|
|
424
422
|
_this.snaps = [];
|
|
425
423
|
}
|
package/lib/client.ts
CHANGED
|
@@ -4,7 +4,10 @@ import net from 'dgram';
|
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import { EventEmitter } from 'stream';
|
|
6
6
|
import { spawn } from 'child_process';
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import { unpackInt, unpackString, MsgUnpacker } from "./MsgUnpacker";
|
|
9
|
+
|
|
10
|
+
|
|
8
11
|
import MsgPacker from './MsgPacker';
|
|
9
12
|
import { Snapshot } from './snapshot';
|
|
10
13
|
import Huffman from "./huffman";
|
|
@@ -114,14 +117,31 @@ function arrStartsWith(arr: number[], arrStart: number[], start = 0) {
|
|
|
114
117
|
}
|
|
115
118
|
return true;
|
|
116
119
|
}
|
|
117
|
-
interface
|
|
120
|
+
declare interface PlayerInfo {
|
|
121
|
+
local: number,
|
|
122
|
+
client_id: number,
|
|
123
|
+
team: number,
|
|
124
|
+
score: number,
|
|
125
|
+
latency: number,
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
declare interface ClientInfo {
|
|
129
|
+
name: string,
|
|
130
|
+
clan: string,
|
|
131
|
+
country: number,
|
|
132
|
+
skin: string,
|
|
133
|
+
use_custom_color: number,
|
|
134
|
+
color_body: number,
|
|
135
|
+
color_feet: number,
|
|
136
|
+
}
|
|
137
|
+
declare interface iMessage {
|
|
118
138
|
team: number,
|
|
119
139
|
client_id: number,
|
|
120
140
|
author?: { ClientInfo: ClientInfo, PlayerInfo: PlayerInfo },
|
|
121
141
|
message: string
|
|
122
142
|
}
|
|
123
143
|
|
|
124
|
-
interface iKillMsg {
|
|
144
|
+
declare interface iKillMsg {
|
|
125
145
|
killer_id: number,
|
|
126
146
|
killer?: { ClientInfo: ClientInfo, PlayerInfo: PlayerInfo },
|
|
127
147
|
victim_id: number,
|
|
@@ -149,11 +169,11 @@ declare interface Client {
|
|
|
149
169
|
player_infos: PlayerInfo[];
|
|
150
170
|
|
|
151
171
|
|
|
152
|
-
on(event: 'connected'): this;
|
|
153
|
-
on(event: 'disconnect', reason: string): this;
|
|
172
|
+
on(event: 'connected', listener: () => void): this;
|
|
173
|
+
on(event: 'disconnect', listener: (reason: string) => void): this;
|
|
154
174
|
|
|
155
|
-
on(event: 'message', message: iMessage): this;
|
|
156
|
-
on(event: 'kill', kill: iKillMsg): this;
|
|
175
|
+
on(event: 'message', listener: (message: iMessage) => void): this;
|
|
176
|
+
on(event: 'kill', listener: (kill: iKillMsg) => void): this;
|
|
157
177
|
|
|
158
178
|
}
|
|
159
179
|
class Client extends EventEmitter {
|
|
@@ -312,11 +332,11 @@ class Client extends EventEmitter {
|
|
|
312
332
|
chat.forEach(a => {
|
|
313
333
|
if (a.msg == "SV_CHAT") {
|
|
314
334
|
var unpacked: iMessage = {} as iMessage;
|
|
315
|
-
unpacked.team =
|
|
316
|
-
var remaining: number[] =
|
|
317
|
-
unpacked.client_id =
|
|
318
|
-
remaining =
|
|
319
|
-
unpacked.message =
|
|
335
|
+
unpacked.team = unpackInt(a.raw.toJSON().data).result;
|
|
336
|
+
var remaining: number[] = unpackInt(a.raw.toJSON().data).remaining;
|
|
337
|
+
unpacked.client_id = unpackInt(remaining).result;
|
|
338
|
+
remaining = unpackInt(remaining).remaining;
|
|
339
|
+
unpacked.message = unpackString(remaining).result;
|
|
320
340
|
if (unpacked.client_id != -1)
|
|
321
341
|
unpacked.author = { ClientInfo: this.client_infos[unpacked.client_id], PlayerInfo: this.player_infos[unpacked.client_id] }
|
|
322
342
|
// console.log(unpacked)
|
|
@@ -329,13 +349,11 @@ class Client extends EventEmitter {
|
|
|
329
349
|
chat.forEach(a => {
|
|
330
350
|
if (a.msg == "SV_KILL_MSG") {
|
|
331
351
|
var unpacked: iKillMsg = {} as iKillMsg;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
unpacked.victim_id =
|
|
335
|
-
|
|
336
|
-
unpacked.
|
|
337
|
-
remaining = MsgUnpacker.unpackInt(remaining).remaining;
|
|
338
|
-
unpacked.special_mode = MsgUnpacker.unpackInt(remaining).result;
|
|
352
|
+
let unpacker = new MsgUnpacker(a.raw.toJSON().data);
|
|
353
|
+
unpacked.killer_id = unpacker.unpackInt();
|
|
354
|
+
unpacked.victim_id = unpacker.unpackInt();
|
|
355
|
+
unpacked.weapon = unpacker.unpackInt();
|
|
356
|
+
unpacked.special_mode = unpacker.unpackInt();
|
|
339
357
|
if (unpacked.victim_id != -1)
|
|
340
358
|
unpacked.victim = { ClientInfo: this.client_infos[unpacked.victim_id], PlayerInfo: this.player_infos[unpacked.victim_id] }
|
|
341
359
|
if (unpacked.killer_id != -1)
|
|
@@ -369,7 +387,7 @@ class Client extends EventEmitter {
|
|
|
369
387
|
} else if (a.toJSON().data[3] == 0x4) {
|
|
370
388
|
// disconnected
|
|
371
389
|
this.State = 0;
|
|
372
|
-
let reason: string = (
|
|
390
|
+
let reason: string = (unpackString(a.toJSON().data.slice(4)).result);
|
|
373
391
|
this.State = -1;
|
|
374
392
|
this.emit("disconnect", reason);
|
|
375
393
|
}
|
|
@@ -417,19 +435,19 @@ class Client extends EventEmitter {
|
|
|
417
435
|
let part = 0;
|
|
418
436
|
let num_parts = 1;
|
|
419
437
|
chunks.forEach(chunk => {
|
|
420
|
-
let AckGameTick = (
|
|
421
|
-
chunk.raw = Buffer.from(
|
|
422
|
-
let DeltaTick =
|
|
438
|
+
let AckGameTick = (unpackInt(chunk.raw.toJSON().data).result);
|
|
439
|
+
chunk.raw = Buffer.from(unpackInt(chunk?.raw?.toJSON().data).remaining);
|
|
440
|
+
let DeltaTick = unpackInt(chunk?.raw?.toJSON().data).result
|
|
423
441
|
if (chunk.msg == "SNAP") {
|
|
424
|
-
chunk.raw = Buffer.from(
|
|
425
|
-
num_parts = (
|
|
426
|
-
chunk.raw = Buffer.from(
|
|
427
|
-
part = (
|
|
442
|
+
chunk.raw = Buffer.from(unpackInt(chunk?.raw?.toJSON().data).remaining); // delta tick
|
|
443
|
+
num_parts = (unpackInt(chunk?.raw?.toJSON().data).result)
|
|
444
|
+
chunk.raw = Buffer.from(unpackInt(chunk?.raw?.toJSON().data).remaining); // num parts
|
|
445
|
+
part = (unpackInt(chunk?.raw?.toJSON().data).result)
|
|
428
446
|
}
|
|
429
|
-
chunk.raw = Buffer.from(
|
|
447
|
+
chunk.raw = Buffer.from(unpackInt(chunk?.raw?.toJSON().data).remaining); // part
|
|
430
448
|
if (chunk.msg != "SNAP_EMPTY")
|
|
431
|
-
chunk.raw = Buffer.from(
|
|
432
|
-
chunk.raw = Buffer.from(
|
|
449
|
+
chunk.raw = Buffer.from(unpackInt(chunk?.raw?.toJSON().data).remaining); // crc
|
|
450
|
+
chunk.raw = Buffer.from(unpackInt(chunk?.raw?.toJSON().data).remaining); // crc
|
|
433
451
|
if (part == 0 || this.snaps.length > 30) {
|
|
434
452
|
this.snaps = [];
|
|
435
453
|
}
|
package/lib/snapshot.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Snapshot = void 0;
|
|
4
|
-
var
|
|
4
|
+
var MsgUnpacker_1 = require("./MsgUnpacker");
|
|
5
5
|
var decoder = new TextDecoder('utf-8');
|
|
6
6
|
var itemAppendix = [
|
|
7
7
|
{ "type_id": 0, "size": 0, "name": "obj_ex" },
|
|
@@ -291,7 +291,7 @@ var Snapshot = /** @class */ (function () {
|
|
|
291
291
|
Snapshot.prototype.unpackSnapshot = function (snap, lost) {
|
|
292
292
|
if (lost === void 0) { lost = 0; }
|
|
293
293
|
// var size = unpackInt(snap).result;
|
|
294
|
-
var unpacker = new MsgUnpacker(snap);
|
|
294
|
+
var unpacker = new MsgUnpacker_1.MsgUnpacker(snap);
|
|
295
295
|
// snap = unpackInt(snap).remaining; // size
|
|
296
296
|
/* key = (((type_id) << 16) | (id))
|
|
297
297
|
* key_to_id = ((key) & 0xffff)
|
package/lib/snapshot.ts
CHANGED