teeworlds 2.5.0 → 2.5.1

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/README.md CHANGED
@@ -1,9 +1,17 @@
1
- # tw-chatonly
1
+ # Teeworlds Client
2
2
  Library to connect a bot to a Teeworlds server.
3
3
 
4
4
  https://gitlab.com/swarfey/teeworlds-client/-/tree/main/
5
5
  https://www.npmjs.com/package/teeworlds
6
6
 
7
+ # Documentation
8
+ You can find an documentation to what most components do in the [docs/documentation.md](https://gitlab.com/swarfey/teeworlds-client/-/blob/main/docs/documentation.md).
9
+ You can also find a few examples inside of the [docs/examples](https://gitlab.com/swarfey/teeworlds-client/-/tree/main/docs/examples) directory.
10
+
11
+ # Projects using this library
12
+ Note: If you have or know any projects running using this library, please contact me so i can add them, or PR them yourself.
13
+
14
+ A discord which is bridging all discord messages and ingame messages (currently closed source): https://discord.gg/MSYcjYvU6e
7
15
 
8
16
  # Usage
9
17
  Example file:
@@ -87,8 +95,4 @@ process.stdin.on("data", data => {
87
95
  client.game.Say(data.toString()); // write input in chat
88
96
 
89
97
  })
90
- ```
91
-
92
- # Documentation
93
- You can find an documentation to what most components do in the [docs/documentation.md](https://gitlab.com/swarfey/teeworlds-client/-/blob/main/docs/documentation.md).
94
- You can also find a few examples inside of the [docs/examples](https://gitlab.com/swarfey/teeworlds-client/-/tree/main/docs/examples) directory.
98
+ ```
package/index.js CHANGED
@@ -10,13 +10,28 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
13
18
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
19
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
20
  };
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
16
28
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Client = void 0;
29
+ exports.snapshots = exports.Client = void 0;
18
30
  var client_1 = require("./lib/client");
19
31
  Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
20
32
  __exportStar(require("./lib/MsgPacker"), exports);
21
33
  __exportStar(require("./lib/MsgUnpacker"), exports);
22
34
  __exportStar(require("./lib/snapshot"), exports);
35
+ __exportStar(require("./lib/huffman"), exports);
36
+ __exportStar(require("./lib/UUIDManager"), exports);
37
+ exports.snapshots = __importStar(require("./lib/snapshots"));
package/index.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  export { Client } from "./lib/client";
2
2
  export * from "./lib/MsgPacker";
3
3
  export * from "./lib/MsgUnpacker";
4
- export * from "./lib/snapshot";
4
+ export * from "./lib/snapshot";
5
+ export * from "./lib/huffman"
6
+ export * from "./lib/UUIDManager"
7
+ export * as snapshots from "./lib/snapshots"
package/lib/client.js CHANGED
@@ -27,11 +27,11 @@ var version = require('../package.json').version;
27
27
  var movement_1 = __importDefault(require("./components/movement"));
28
28
  var MsgPacker_1 = require("./MsgPacker");
29
29
  var snapshot_1 = require("./snapshot");
30
- var huffman_1 = __importDefault(require("./huffman"));
30
+ var huffman_1 = require("./huffman");
31
31
  var game_1 = require("./components/game");
32
32
  var snapshot_2 = require("./components/snapshot");
33
33
  var UUIDManager_1 = require("./UUIDManager");
34
- var huff = new huffman_1.default();
34
+ var huff = new huffman_1.Huffman();
35
35
  var States;
36
36
  (function (States) {
37
37
  States[States["STATE_OFFLINE"] = 0] = "STATE_OFFLINE";
@@ -555,7 +555,7 @@ var Client = /** @class */ (function (_super) {
555
555
  Crc = unpacker.unpackInt();
556
556
  PartSize = unpacker.unpackInt();
557
557
  }
558
- if (PartSize < 1 || NumParts > 64 || Part < 0 || Part >= NumParts || PartSize <= 0 || PartSize > 900)
558
+ if (NumParts < 1 || NumParts > 64 || Part < 0 || Part >= NumParts || PartSize < 0 || PartSize > 900)
559
559
  return;
560
560
  if (GameTick >= _this.currentSnapshotGameTick) {
561
561
  if (GameTick != _this.currentSnapshotGameTick) {
package/lib/client.ts CHANGED
@@ -11,7 +11,7 @@ import { PlayerInput, PlayerInfo, Projectile, Laser, Pickup, Flag, GameInfo, Gam
11
11
 
12
12
  import { MsgPacker } from './MsgPacker';
13
13
  import { Item, Snapshot } from './snapshot';
14
- import Huffman from "./huffman";
14
+ import { Huffman } from "./huffman";
15
15
  import { Game } from "./components/game";
16
16
  import { SnapshotWrapper } from "./components/snapshot";
17
17
 
@@ -723,7 +723,7 @@ export class Client extends EventEmitter {
723
723
  PartSize = unpacker.unpackInt();
724
724
  }
725
725
 
726
- if (PartSize < 1 || NumParts > 64 || Part < 0 || Part >= NumParts || PartSize <= 0 || PartSize > 900)
726
+ if (NumParts < 1 || NumParts > 64 || Part < 0 || Part >= NumParts || PartSize < 0 || PartSize > 900)
727
727
  return;
728
728
 
729
729
  if (GameTick >= this.currentSnapshotGameTick) {
package/lib/huffman.js CHANGED
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Huffman = void 0;
2
4
  var FREQ_TABLE = [
3
5
  1 << 30, 4545, 2657, 431, 1950, 919, 444, 482, 2244, 617, 838, 542, 715, 1814, 304, 240, 754, 212, 647, 186,
4
6
  283, 131, 146, 166, 543, 164, 167, 136, 179, 859, 363, 113, 157, 154, 204, 108, 137, 180, 202, 176,
@@ -187,4 +189,4 @@ var Huffman = /** @class */ (function () {
187
189
  };
188
190
  return Huffman;
189
191
  }());
190
- module.exports = Huffman;
192
+ exports.Huffman = Huffman;
package/lib/huffman.ts CHANGED
@@ -34,7 +34,7 @@ interface HuffmanConstructNode {
34
34
  frequency: number;
35
35
  }
36
36
 
37
- class Huffman {
37
+ export class Huffman {
38
38
  nodes: HuffmanNode[];
39
39
  decode_lut: number[];
40
40
  num_nodes: number;
@@ -223,6 +223,4 @@ class Huffman {
223
223
  }
224
224
 
225
225
 
226
- }
227
-
228
- export = Huffman;
226
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teeworlds",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
4
4
  "description": "Library for (ingame) teeworlds bots.",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "git+github.com/swarfey/tw-chatonly.git"
14
+ "url": "git+gitlab.com/swarfey/teeworlds-client.git"
15
15
  },
16
16
  "keywords": [
17
17
  "teeworlds",