teeworlds 2.5.4 → 2.5.6

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.
Files changed (54) hide show
  1. package/README.md +4 -3
  2. package/{index.ts → index.d.ts} +6 -6
  3. package/index.js +25 -24
  4. package/index.js.map +1 -0
  5. package/lib/MsgPacker.d.ts +11 -0
  6. package/lib/MsgPacker.js +47 -55
  7. package/lib/MsgPacker.js.map +1 -0
  8. package/lib/MsgUnpacker.d.ts +16 -0
  9. package/lib/MsgUnpacker.js +53 -53
  10. package/lib/MsgUnpacker.js.map +1 -0
  11. package/lib/UUIDManager.d.ts +27 -0
  12. package/lib/UUIDManager.js +45 -50
  13. package/lib/UUIDManager.js.map +1 -0
  14. package/lib/client.d.ts +135 -0
  15. package/lib/client.js +762 -830
  16. package/lib/client.js.map +1 -0
  17. package/lib/components/game.d.ts +32 -0
  18. package/lib/components/game.js +104 -106
  19. package/lib/components/game.js.map +1 -0
  20. package/lib/components/movement.d.ts +34 -0
  21. package/lib/components/movement.js +75 -82
  22. package/lib/components/movement.js.map +1 -0
  23. package/lib/components/rcon.d.ts +33 -0
  24. package/lib/components/rcon.js +92 -122
  25. package/lib/components/rcon.js.map +1 -0
  26. package/lib/components/snapshot.d.ts +59 -0
  27. package/lib/components/snapshot.js +144 -234
  28. package/lib/components/snapshot.js.map +1 -0
  29. package/lib/enums_types/protocol.d.ts +120 -0
  30. package/lib/enums_types/protocol.js +14 -13
  31. package/lib/enums_types/protocol.js.map +1 -0
  32. package/lib/huffman.d.ts +24 -0
  33. package/lib/huffman.js +187 -192
  34. package/lib/huffman.js.map +1 -0
  35. package/lib/snapshot.d.ts +49 -0
  36. package/lib/snapshot.js +599 -610
  37. package/lib/snapshot.js.map +1 -0
  38. package/package.json +21 -24
  39. package/docs/documentation.md +0 -368
  40. package/docs/examples/chat_bot.js +0 -25
  41. package/docs/examples/kill_on_freeze.js +0 -20
  42. package/lib/MsgPacker.ts +0 -45
  43. package/lib/MsgUnpacker.ts +0 -58
  44. package/lib/UUIDManager.ts +0 -45
  45. package/lib/client.ts +0 -926
  46. package/lib/components/game.ts +0 -133
  47. package/lib/components/movement.ts +0 -88
  48. package/lib/components/rcon.ts +0 -114
  49. package/lib/components/snapshot.ts +0 -187
  50. package/lib/enums_types/protocol.ts +0 -137
  51. package/lib/enums_types/types.d.ts +0 -236
  52. package/lib/huffman.ts +0 -226
  53. package/lib/snapshot.ts +0 -632
  54. package/tsconfig.json +0 -69
@@ -1,234 +1,144 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.SnapshotWrapper = void 0;
19
- var stream_1 = require("stream");
20
- var SnapshotWrapper = /** @class */ (function (_super) {
21
- __extends(SnapshotWrapper, _super);
22
- function SnapshotWrapper(_client) {
23
- var _this =
24
- // this.SendMsgEx = callback;
25
- _super.call(this) || this;
26
- _this._client = _client;
27
- return _this;
28
- }
29
- SnapshotWrapper.prototype.getParsed = function (type_id, id) {
30
- var _a;
31
- if (type_id == -1)
32
- return undefined;
33
- return (_a = this._client.rawSnapUnpacker.deltas.find(function (delta) { return delta.type_id == type_id && delta.id == id; })) === null || _a === void 0 ? void 0 : _a.parsed;
34
- };
35
- SnapshotWrapper.prototype.getAll = function (type_id) {
36
- var _all = [];
37
- if (type_id == -1)
38
- return _all;
39
- this._client.rawSnapUnpacker.deltas.forEach(function (delta) {
40
- if (delta.type_id == type_id)
41
- _all.push(delta.parsed);
42
- });
43
- return _all;
44
- // return this._client.rawSnapUnpacker.deltas.filter(delta => delta.type_id == type_id && delta.id == id).map(a => a.parsed);
45
- };
46
- SnapshotWrapper.prototype.getObjPlayerInput = function (player_id) {
47
- return this.getParsed(1 /* SnapshotItemIDs.OBJ_PLAYER_INPUT */, player_id);
48
- };
49
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjPlayerInput", {
50
- get: function () {
51
- return this.getAll(1 /* SnapshotItemIDs.OBJ_PLAYER_INPUT */);
52
- },
53
- enumerable: false,
54
- configurable: true
55
- });
56
- SnapshotWrapper.prototype.getObjProjectile = function (id) {
57
- return this.getParsed(2 /* SnapshotItemIDs.OBJ_PROJECTILE */, id);
58
- };
59
- Object.defineProperty(SnapshotWrapper.prototype, "AllProjectiles", {
60
- get: function () {
61
- return this.getAll(2 /* SnapshotItemIDs.OBJ_PROJECTILE */);
62
- },
63
- enumerable: false,
64
- configurable: true
65
- });
66
- SnapshotWrapper.prototype.getObjLaser = function (id) {
67
- return this.getParsed(3 /* SnapshotItemIDs.OBJ_LASER */, id);
68
- };
69
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjLaser", {
70
- get: function () {
71
- return this.getAll(3 /* SnapshotItemIDs.OBJ_LASER */);
72
- },
73
- enumerable: false,
74
- configurable: true
75
- });
76
- SnapshotWrapper.prototype.getObjPickup = function (id) {
77
- return this.getParsed(4 /* SnapshotItemIDs.OBJ_PICKUP */, id);
78
- };
79
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjPickup", {
80
- get: function () {
81
- return this.getAll(4 /* SnapshotItemIDs.OBJ_PICKUP */);
82
- },
83
- enumerable: false,
84
- configurable: true
85
- });
86
- SnapshotWrapper.prototype.getObjFlag = function (id) {
87
- return this.getParsed(5 /* SnapshotItemIDs.OBJ_FLAG */, id);
88
- };
89
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjFlag", {
90
- get: function () {
91
- return this.getAll(5 /* SnapshotItemIDs.OBJ_FLAG */);
92
- },
93
- enumerable: false,
94
- configurable: true
95
- });
96
- SnapshotWrapper.prototype.getObjGameInfo = function (id) {
97
- return this.getParsed(6 /* SnapshotItemIDs.OBJ_GAME_INFO */, id);
98
- };
99
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjGameInfo", {
100
- get: function () {
101
- return this.getAll(6 /* SnapshotItemIDs.OBJ_GAME_INFO */);
102
- },
103
- enumerable: false,
104
- configurable: true
105
- });
106
- SnapshotWrapper.prototype.getObjGameData = function (id) {
107
- return this.getParsed(7 /* SnapshotItemIDs.OBJ_GAME_DATA */, id);
108
- };
109
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjGameData", {
110
- get: function () {
111
- return this.getAll(7 /* SnapshotItemIDs.OBJ_GAME_DATA */);
112
- },
113
- enumerable: false,
114
- configurable: true
115
- });
116
- /** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
117
- SnapshotWrapper.prototype.getObjCharacterCore = function (player_id) {
118
- return this.getParsed(8 /* SnapshotItemIDs.OBJ_CHARACTER_CORE */, player_id);
119
- };
120
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjCharacterCore", {
121
- /** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
122
- get: function () {
123
- return this.getAll(8 /* SnapshotItemIDs.OBJ_CHARACTER_CORE */);
124
- },
125
- enumerable: false,
126
- configurable: true
127
- });
128
- /** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
129
- SnapshotWrapper.prototype.getObjCharacter = function (player_id) {
130
- return this.getParsed(9 /* SnapshotItemIDs.OBJ_CHARACTER */, player_id);
131
- };
132
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjCharacter", {
133
- /** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
134
- get: function () {
135
- return this.getAll(9 /* SnapshotItemIDs.OBJ_CHARACTER */);
136
- },
137
- enumerable: false,
138
- configurable: true
139
- });
140
- SnapshotWrapper.prototype.getObjPlayerInfo = function (player_id) {
141
- return this.getParsed(10 /* SnapshotItemIDs.OBJ_PLAYER_INFO */, player_id);
142
- };
143
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjPlayerInfo", {
144
- get: function () {
145
- return this.getAll(10 /* SnapshotItemIDs.OBJ_PLAYER_INFO */);
146
- },
147
- enumerable: false,
148
- configurable: true
149
- });
150
- SnapshotWrapper.prototype.getObjClientInfo = function (player_id) {
151
- return this.getParsed(11 /* SnapshotItemIDs.OBJ_CLIENT_INFO */, player_id);
152
- };
153
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjClientInfo", {
154
- get: function () {
155
- return this.getAll(11 /* SnapshotItemIDs.OBJ_CLIENT_INFO */);
156
- },
157
- enumerable: false,
158
- configurable: true
159
- });
160
- SnapshotWrapper.prototype.getObjSpectatorInfo = function (player_id) {
161
- return this.getParsed(12 /* SnapshotItemIDs.OBJ_SPECTATOR_INFO */, player_id);
162
- };
163
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjSpectatorInfo", {
164
- get: function () {
165
- return this.getAll(12 /* SnapshotItemIDs.OBJ_SPECTATOR_INFO */);
166
- },
167
- enumerable: false,
168
- configurable: true
169
- });
170
- SnapshotWrapper.prototype.getTypeId = function (name) {
171
- var _a;
172
- return ((_a = this._client.rawSnapUnpacker.uuid_manager.LookupName(name)) === null || _a === void 0 ? void 0 : _a.type_id) || -1;
173
- };
174
- SnapshotWrapper.prototype.getObjExMyOwnObject = function (id) {
175
- return this.getParsed(this.getTypeId("my-own-object@heinrich5991.de"), id);
176
- };
177
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjExMyOwnObject", {
178
- get: function () {
179
- return this.getAll(this.getTypeId("my-own-object@heinrich5991.de"));
180
- },
181
- enumerable: false,
182
- configurable: true
183
- });
184
- SnapshotWrapper.prototype.getObjExDDNetCharacter = function (id) {
185
- return this.getParsed(this.getTypeId("character@netobj.ddnet.tw"), id);
186
- };
187
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjExDDNetCharacter", {
188
- get: function () {
189
- return this.getAll(this.getTypeId("character@netobj.ddnet.tw"));
190
- },
191
- enumerable: false,
192
- configurable: true
193
- });
194
- SnapshotWrapper.prototype.getObjExGameInfo = function (id) {
195
- return this.getParsed(this.getTypeId("gameinfo@netobj.ddnet.tw"), id);
196
- };
197
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjExGameInfo", {
198
- get: function () {
199
- return this.getAll(this.getTypeId("gameinfo@netobj.ddnet.tw"));
200
- },
201
- enumerable: false,
202
- configurable: true
203
- });
204
- SnapshotWrapper.prototype.getObjExDDNetProjectile = function (id) {
205
- return this.getParsed(this.getTypeId("projectile@netobj.ddnet.tw"), id);
206
- };
207
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjExDDNetProjectile", {
208
- get: function () {
209
- return this.getAll(this.getTypeId("projectile@netobj.ddnet.tw"));
210
- },
211
- enumerable: false,
212
- configurable: true
213
- });
214
- SnapshotWrapper.prototype.getObjExLaser = function (id) {
215
- return this.getParsed(this.getTypeId("laser@netobj.ddnet.tw"), id);
216
- };
217
- Object.defineProperty(SnapshotWrapper.prototype, "AllObjExLaser", {
218
- get: function () {
219
- return this.getAll(this.getTypeId("laser@netobj.ddnet.tw"));
220
- },
221
- enumerable: false,
222
- configurable: true
223
- });
224
- Object.defineProperty(SnapshotWrapper.prototype, "OwnID", {
225
- get: function () {
226
- var _a;
227
- return (_a = this.AllObjPlayerInfo.find(function (parsed) { return parsed.local; })) === null || _a === void 0 ? void 0 : _a.client_id;
228
- },
229
- enumerable: false,
230
- configurable: true
231
- });
232
- return SnapshotWrapper;
233
- }(stream_1.EventEmitter));
234
- exports.SnapshotWrapper = SnapshotWrapper;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SnapshotWrapper = void 0;
4
+ const stream_1 = require("stream");
5
+ class SnapshotWrapper extends stream_1.EventEmitter {
6
+ constructor(_client) {
7
+ // this.SendMsgEx = callback;
8
+ super();
9
+ this._client = _client;
10
+ }
11
+ getParsed(type_id, id) {
12
+ var _a;
13
+ if (type_id == -1)
14
+ return undefined;
15
+ return (_a = this._client.rawSnapUnpacker.deltas.find(delta => delta.type_id == type_id && delta.id == id)) === null || _a === void 0 ? void 0 : _a.parsed;
16
+ }
17
+ getAll(type_id) {
18
+ let _all = [];
19
+ if (type_id == -1)
20
+ return _all;
21
+ this._client.rawSnapUnpacker.deltas.forEach(delta => {
22
+ if (delta.type_id == type_id)
23
+ _all.push(delta.parsed);
24
+ });
25
+ return _all;
26
+ // return this._client.rawSnapUnpacker.deltas.filter(delta => delta.type_id == type_id && delta.id == id).map(a => a.parsed);
27
+ }
28
+ getObjPlayerInput(player_id) {
29
+ return this.getParsed(1 /* SnapshotItemIDs.OBJ_PLAYER_INPUT */, player_id);
30
+ }
31
+ get AllObjPlayerInput() {
32
+ return this.getAll(1 /* SnapshotItemIDs.OBJ_PLAYER_INPUT */);
33
+ }
34
+ getObjProjectile(id) {
35
+ return this.getParsed(2 /* SnapshotItemIDs.OBJ_PROJECTILE */, id);
36
+ }
37
+ get AllProjectiles() {
38
+ return this.getAll(2 /* SnapshotItemIDs.OBJ_PROJECTILE */);
39
+ }
40
+ getObjLaser(id) {
41
+ return this.getParsed(3 /* SnapshotItemIDs.OBJ_LASER */, id);
42
+ }
43
+ get AllObjLaser() {
44
+ return this.getAll(3 /* SnapshotItemIDs.OBJ_LASER */);
45
+ }
46
+ getObjPickup(id) {
47
+ return this.getParsed(4 /* SnapshotItemIDs.OBJ_PICKUP */, id);
48
+ }
49
+ get AllObjPickup() {
50
+ return this.getAll(4 /* SnapshotItemIDs.OBJ_PICKUP */);
51
+ }
52
+ getObjFlag(id) {
53
+ return this.getParsed(5 /* SnapshotItemIDs.OBJ_FLAG */, id);
54
+ }
55
+ get AllObjFlag() {
56
+ return this.getAll(5 /* SnapshotItemIDs.OBJ_FLAG */);
57
+ }
58
+ getObjGameInfo(id) {
59
+ return this.getParsed(6 /* SnapshotItemIDs.OBJ_GAME_INFO */, id);
60
+ }
61
+ get AllObjGameInfo() {
62
+ return this.getAll(6 /* SnapshotItemIDs.OBJ_GAME_INFO */);
63
+ }
64
+ getObjGameData(id) {
65
+ return this.getParsed(7 /* SnapshotItemIDs.OBJ_GAME_DATA */, id);
66
+ }
67
+ get AllObjGameData() {
68
+ return this.getAll(7 /* SnapshotItemIDs.OBJ_GAME_DATA */);
69
+ }
70
+ /** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
71
+ getObjCharacterCore(player_id) {
72
+ return this.getParsed(8 /* SnapshotItemIDs.OBJ_CHARACTER_CORE */, player_id);
73
+ }
74
+ /** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
75
+ get AllObjCharacterCore() {
76
+ return this.getAll(8 /* SnapshotItemIDs.OBJ_CHARACTER_CORE */);
77
+ }
78
+ /** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
79
+ getObjCharacter(player_id) {
80
+ return this.getParsed(9 /* SnapshotItemIDs.OBJ_CHARACTER */, player_id);
81
+ }
82
+ /** NOTICE: x & y positions always differ from the positions in the ingame debug menu. If you want the debug menu positions, you can calculate them like this: Math.round((myChar.character_core.x / 32) * 100)/100 */
83
+ get AllObjCharacter() {
84
+ return this.getAll(9 /* SnapshotItemIDs.OBJ_CHARACTER */);
85
+ }
86
+ getObjPlayerInfo(player_id) {
87
+ return this.getParsed(10 /* SnapshotItemIDs.OBJ_PLAYER_INFO */, player_id);
88
+ }
89
+ get AllObjPlayerInfo() {
90
+ return this.getAll(10 /* SnapshotItemIDs.OBJ_PLAYER_INFO */);
91
+ }
92
+ getObjClientInfo(player_id) {
93
+ return this.getParsed(11 /* SnapshotItemIDs.OBJ_CLIENT_INFO */, player_id);
94
+ }
95
+ get AllObjClientInfo() {
96
+ return this.getAll(11 /* SnapshotItemIDs.OBJ_CLIENT_INFO */);
97
+ }
98
+ getObjSpectatorInfo(player_id) {
99
+ return this.getParsed(12 /* SnapshotItemIDs.OBJ_SPECTATOR_INFO */, player_id);
100
+ }
101
+ get AllObjSpectatorInfo() {
102
+ return this.getAll(12 /* SnapshotItemIDs.OBJ_SPECTATOR_INFO */);
103
+ }
104
+ getTypeId(name) {
105
+ var _a;
106
+ return ((_a = this._client.rawSnapUnpacker.uuid_manager.LookupName(name)) === null || _a === void 0 ? void 0 : _a.type_id) || -1;
107
+ }
108
+ getObjExMyOwnObject(id) {
109
+ return this.getParsed(this.getTypeId("my-own-object@heinrich5991.de"), id);
110
+ }
111
+ get AllObjExMyOwnObject() {
112
+ return this.getAll(this.getTypeId("my-own-object@heinrich5991.de"));
113
+ }
114
+ getObjExDDNetCharacter(id) {
115
+ return this.getParsed(this.getTypeId("character@netobj.ddnet.tw"), id);
116
+ }
117
+ get AllObjExDDNetCharacter() {
118
+ return this.getAll(this.getTypeId("character@netobj.ddnet.tw"));
119
+ }
120
+ getObjExGameInfo(id) {
121
+ return this.getParsed(this.getTypeId("gameinfo@netobj.ddnet.tw"), id);
122
+ }
123
+ get AllObjExGameInfo() {
124
+ return this.getAll(this.getTypeId("gameinfo@netobj.ddnet.tw"));
125
+ }
126
+ getObjExDDNetProjectile(id) {
127
+ return this.getParsed(this.getTypeId("projectile@netobj.ddnet.tw"), id);
128
+ }
129
+ get AllObjExDDNetProjectile() {
130
+ return this.getAll(this.getTypeId("projectile@netobj.ddnet.tw"));
131
+ }
132
+ getObjExLaser(id) {
133
+ return this.getParsed(this.getTypeId("laser@netobj.ddnet.tw"), id);
134
+ }
135
+ get AllObjExLaser() {
136
+ return this.getAll(this.getTypeId("laser@netobj.ddnet.tw"));
137
+ }
138
+ get OwnID() {
139
+ var _a;
140
+ return (_a = this.AllObjPlayerInfo.find(parsed => parsed.local)) === null || _a === void 0 ? void 0 : _a.client_id;
141
+ }
142
+ }
143
+ exports.SnapshotWrapper = SnapshotWrapper;
144
+ //# sourceMappingURL=snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../lib/components/snapshot.ts"],"names":[],"mappings":";;;AAEA,mCAAsC;AAiBtC,MAAa,eAAgB,SAAQ,qBAAY;IAEhD,YAAY,OAAe;QAC1B,6BAA6B;QAC7B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAEO,SAAS,CAAI,OAAe,EAAE,EAAU;;QAC/C,IAAI,OAAO,IAAI,CAAC,CAAC;YAChB,OAAO,SAAS,CAAC;QAClB,OAAO,MAAA,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,IAAI,OAAO,IAAI,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,0CAAE,MAAsB,CAAC;IAC9H,CAAC;IAEO,MAAM,CAAI,OAAe;QAChC,IAAI,IAAI,GAAQ,EAAE,CAAC;QACnB,IAAI,OAAO,IAAI,CAAC,CAAC;YAChB,OAAO,IAAI,CAAC;QACb,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACnD,IAAI,KAAK,CAAC,OAAO,IAAI,OAAO;gBAC3B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAW,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAA;QAGF,OAAO,IAAI,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,CAAC;CAID;AAvKD,0CAuKC"}
@@ -0,0 +1,120 @@
1
+ export declare enum States {
2
+ STATE_OFFLINE = 0,
3
+ STATE_CONNECTING = 1,
4
+ STATE_LOADING = 2,
5
+ STATE_ONLINE = 3,
6
+ STATE_DEMOPLAYBACK = 4,
7
+ STATE_QUITTING = 5,
8
+ STATE_RESTARTING = 6
9
+ }
10
+ export declare namespace NETMSG {
11
+ const enum Game {
12
+ EX = 0,
13
+ SV_MOTD = 1,
14
+ SV_BROADCAST = 2,
15
+ SV_CHAT = 3,
16
+ SV_KILLMSG = 4,
17
+ SV_SOUNDGLOBAL = 5,
18
+ SV_TUNEPARAMS = 6,
19
+ SV_EXTRAPROJECTILE = 7,
20
+ SV_READYTOENTER = 8,
21
+ SV_WEAPONPICKUP = 9,
22
+ SV_EMOTICON = 10,
23
+ SV_VOTECLEAROPTIONS = 11,
24
+ SV_VOTEOPTIONLISTADD = 12,
25
+ SV_VOTEOPTIONADD = 13,
26
+ SV_VOTEOPTIONREMOVE = 14,
27
+ SV_VOTESET = 15,
28
+ SV_VOTESTATUS = 16,
29
+ CL_SAY = 17,
30
+ CL_SETTEAM = 18,
31
+ CL_SETSPECTATORMODE = 19,
32
+ CL_STARTINFO = 20,
33
+ CL_CHANGEINFO = 21,
34
+ CL_KILL = 22,
35
+ CL_EMOTICON = 23,
36
+ CL_VOTE = 24,
37
+ CL_CALLVOTE = 25,
38
+ CL_ISDDNETLEGACY = 26,
39
+ SV_DDRACETIMELEGACY = 27,
40
+ SV_RECORDLEGACY = 28,
41
+ UNUSED = 29,
42
+ SV_TEAMSSTATELEGACY = 30,
43
+ CL_SHOWOTHERSLEGACY = 31,
44
+ NUM = 32
45
+ }
46
+ const enum System {
47
+ NETMSG_EX = 0,
48
+ NETMSG_INFO = 1,
49
+ NETMSG_MAP_CHANGE = 2,// sent when client should switch map
50
+ NETMSG_MAP_DATA = 3,// map transfer, contains a chunk of the map file
51
+ NETMSG_CON_READY = 4,// connection is ready, client should send start info
52
+ NETMSG_SNAP = 5,// normal snapshot, multiple parts
53
+ NETMSG_SNAPEMPTY = 6,// empty snapshot
54
+ NETMSG_SNAPSINGLE = 7,// ?
55
+ NETMSG_SNAPSMALL = 8,//
56
+ NETMSG_INPUTTIMING = 9,// reports how off the input was
57
+ NETMSG_RCON_AUTH_STATUS = 10,// result of the authentication
58
+ NETMSG_RCON_LINE = 11,// line that should be printed to the remote console
59
+ NETMSG_AUTH_CHALLANGE = 12,//
60
+ NETMSG_AUTH_RESULT = 13,//
61
+ NETMSG_READY = 14,//
62
+ NETMSG_ENTERGAME = 15,
63
+ NETMSG_INPUT = 16,// contains the inputdata from the client
64
+ NETMSG_RCON_CMD = 17,//
65
+ NETMSG_RCON_AUTH = 18,//
66
+ NETMSG_REQUEST_MAP_DATA = 19,//
67
+ NETMSG_AUTH_START = 20,//
68
+ NETMSG_AUTH_RESPONSE = 21,//
69
+ NETMSG_PING = 22,
70
+ NETMSG_PING_REPLY = 23,
71
+ NETMSG_ERROR = 24,
72
+ NETMSG_RCON_CMD_ADD = 25,
73
+ NETMSG_RCON_CMD_REM = 26,
74
+ NUM_NETMSGS = 27,
75
+ NETMSG_WHATIS = 65536,
76
+ NETMSG_ITIS = 65537,
77
+ NETMSG_IDONTKNOW = 65538,
78
+ NETMSG_RCONTYPE = 65539,
79
+ NETMSG_MAP_DETAILS = 65540,
80
+ NETMSG_CAPABILITIES = 65541,
81
+ NETMSG_CLIENTVER = 65542,
82
+ NETMSG_PINGEX = 65543,
83
+ NETMSG_PONGEX = 65544,
84
+ NETMSG_CHECKSUM_REQUEST = 65545,
85
+ NETMSG_CHECKSUM_RESPONSE = 65546,
86
+ NETMSG_CHECKSUM_ERROR = 65547,
87
+ NETMSG_REDIRECT = 65548,
88
+ NETMSG_RCON_CMD_GROUP_START = 65549,
89
+ NETMSG_RCON_CMD_GROUP_END = 65550,
90
+ NETMSG_MAP_RELOAD = 65551,
91
+ NETMSG_RECONNECT = 65552,
92
+ NETMSG_MAPLIST_ADD = 65553,
93
+ NETMSG_MAPLIST_GROUP_START = 65554,
94
+ NETMSG_MAPLIST_GROUP_END = 65555,
95
+ NETMSG_I_AM_NPM_PACKAGE = 65556
96
+ }
97
+ }
98
+ export declare const enum SnapshotItemIDs {
99
+ OBJ_EX = 0,
100
+ OBJ_PLAYER_INPUT = 1,
101
+ OBJ_PROJECTILE = 2,
102
+ OBJ_LASER = 3,
103
+ OBJ_PICKUP = 4,
104
+ OBJ_FLAG = 5,
105
+ OBJ_GAME_INFO = 6,
106
+ OBJ_GAME_DATA = 7,
107
+ OBJ_CHARACTER_CORE = 8,
108
+ OBJ_CHARACTER = 9,
109
+ OBJ_PLAYER_INFO = 10,
110
+ OBJ_CLIENT_INFO = 11,
111
+ OBJ_SPECTATOR_INFO = 12,
112
+ EVENT_COMMON = 13,
113
+ EVENT_EXPLOSION = 14,
114
+ EVENT_SPAWN = 15,
115
+ EVENT_HAMMERHIT = 16,
116
+ EVENT_DEATH = 17,
117
+ EVENT_SOUND_GLOBAL = 18,
118
+ EVENT_SOUND_WORLD = 19,
119
+ EVENT_DAMAGE_INDICATOR = 20
120
+ }
@@ -1,13 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.States = void 0;
4
- var States;
5
- (function (States) {
6
- States[States["STATE_OFFLINE"] = 0] = "STATE_OFFLINE";
7
- States[States["STATE_CONNECTING"] = 1] = "STATE_CONNECTING";
8
- States[States["STATE_LOADING"] = 2] = "STATE_LOADING";
9
- States[States["STATE_ONLINE"] = 3] = "STATE_ONLINE";
10
- States[States["STATE_DEMOPLAYBACK"] = 4] = "STATE_DEMOPLAYBACK";
11
- States[States["STATE_QUITTING"] = 5] = "STATE_QUITTING";
12
- States[States["STATE_RESTARTING"] = 6] = "STATE_RESTARTING";
13
- })(States = exports.States || (exports.States = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.States = void 0;
4
+ var States;
5
+ (function (States) {
6
+ States[States["STATE_OFFLINE"] = 0] = "STATE_OFFLINE";
7
+ States[States["STATE_CONNECTING"] = 1] = "STATE_CONNECTING";
8
+ States[States["STATE_LOADING"] = 2] = "STATE_LOADING";
9
+ States[States["STATE_ONLINE"] = 3] = "STATE_ONLINE";
10
+ States[States["STATE_DEMOPLAYBACK"] = 4] = "STATE_DEMOPLAYBACK";
11
+ States[States["STATE_QUITTING"] = 5] = "STATE_QUITTING";
12
+ States[States["STATE_RESTARTING"] = 6] = "STATE_RESTARTING";
13
+ })(States || (exports.States = States = {}));
14
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../lib/enums_types/protocol.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAQX;AARD,WAAY,MAAM;IACjB,qDAAiB,CAAA;IACjB,2DAAgB,CAAA;IAChB,qDAAa,CAAA;IACb,mDAAY,CAAA;IACZ,+DAAkB,CAAA;IAClB,uDAAc,CAAA;IACd,2DAAgB,CAAA;AACjB,CAAC,EARW,MAAM,sBAAN,MAAM,QAQjB"}
@@ -0,0 +1,24 @@
1
+ interface HuffmanNode {
2
+ bits: number;
3
+ numbits: number;
4
+ left: number;
5
+ right: number;
6
+ symbol: number;
7
+ }
8
+ interface HuffmanConstructNode {
9
+ node_id: number;
10
+ frequency: number;
11
+ }
12
+ export declare class Huffman {
13
+ nodes: HuffmanNode[];
14
+ decode_lut: number[];
15
+ num_nodes: number;
16
+ start_node_index: number;
17
+ constructor(frequencies?: number[]);
18
+ set_bits_r(node_index: number, bits: number, depth: number): void;
19
+ bubble_sort(index_list: number[], node_list: HuffmanConstructNode[], size: number): number[];
20
+ construct_tree(frequencies?: number[]): void;
21
+ compress(inp_buffer: Buffer, start_index?: number, size?: number): Buffer;
22
+ decompress(inp_buffer: Buffer, size?: number): Buffer;
23
+ }
24
+ export {};