teeworlds 2.4.7 → 2.4.8

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
@@ -87,3 +87,7 @@ process.stdin.on("data", data => {
87
87
 
88
88
  })
89
89
  ```
90
+
91
+ # Documentation
92
+ You can find an documentation to what most components do in the [docs/documentation.md](docs/documentation.md).
93
+ You can also find a few of examples inside of the [docs/examples](docs/examples/) directory.
@@ -299,7 +299,7 @@ The movement component is accessable using `client.movement`.
299
299
  * RunRight()
300
300
  * makes the client run right
301
301
  * RunStop()
302
- * makes the client stop running (if he is)
302
+ * makes the client stop running (if he is)
303
303
  * Jump(state?: boolean)
304
304
  * makes the client Jump. if the parameter is false, the bot will stop holding jump.
305
305
  * Fire()
@@ -359,9 +359,10 @@ client.connect();
359
359
  ```
360
360
 
361
361
  # Examples
362
- there are some examples under docs/examples.
362
+ You can find some of the examples in the [docs/examples](docs/examples/) folder.
363
363
 
364
364
  # Projects using this library
365
365
  *Note:* If you have or know any projects running using this library, please contact me so i can add them, or PR them yourself.
366
366
 
367
- * A discord which is bridging all discord messages and ingame messages (currently closed source): https://discord.gg/MSYcjYvU6e
367
+ * A discord which is bridging all discord messages and ingame messages (currently closed source): https://discord.gg/MSYcjYvU6e
368
+
package/lib/client.js CHANGED
@@ -23,6 +23,7 @@ var crypto_1 = require("crypto");
23
23
  var dgram_1 = __importDefault(require("dgram"));
24
24
  var stream_1 = require("stream");
25
25
  var MsgUnpacker_1 = require("./MsgUnpacker");
26
+ var version = require('../package.json').version;
26
27
  var movement_1 = __importDefault(require("./components/movement"));
27
28
  var MsgPacker_1 = require("./MsgPacker");
28
29
  var snapshot_1 = require("./snapshot");
@@ -428,11 +429,11 @@ var Client = /** @class */ (function (_super) {
428
429
  client_version.AddBuffer(randomUuid);
429
430
  if (((_d = _this.options) === null || _d === void 0 ? void 0 : _d.ddnet_version) !== undefined) {
430
431
  client_version.AddInt((_e = _this.options) === null || _e === void 0 ? void 0 : _e.ddnet_version.version);
431
- client_version.AddString("DDNet " + ((_f = _this.options) === null || _f === void 0 ? void 0 : _f.ddnet_version.release_version));
432
+ client_version.AddString("DDNet ".concat((_f = _this.options) === null || _f === void 0 ? void 0 : _f.ddnet_version.release_version, "; https://www.npmjs.com/package/teeworlds/v/").concat(version));
432
433
  }
433
434
  else {
434
435
  client_version.AddInt(16050);
435
- client_version.AddString("DDNet 16.5.0");
436
+ client_version.AddString("DDNet 16.5.0; https://www.npmjs.com/package/teeworlds/v/".concat(version));
436
437
  }
437
438
  _this.SendMsgEx([client_version, info]);
438
439
  }
package/lib/client.ts CHANGED
@@ -4,6 +4,7 @@ import net from 'dgram';
4
4
  import { EventEmitter } from 'stream';
5
5
 
6
6
  import { unpackString, MsgUnpacker } from "./MsgUnpacker";
7
+ let { version } = require('../package.json');
7
8
 
8
9
  import Movement from './components/movement';
9
10
  import { PlayerInput, PlayerInfo, Projectile, Laser, Pickup, Flag, GameInfo, GameData, CharacterCore, Character, ClientInfo, SpectatorInfo, Common, Explosion, Spawn, HammerHit, Death, SoundGlobal, SoundWorld, DamageInd } from "./snapshots";
@@ -581,10 +582,10 @@ export class Client extends EventEmitter {
581
582
  client_version.AddBuffer(randomUuid);
582
583
  if (this.options?.ddnet_version !== undefined) {
583
584
  client_version.AddInt(this.options?.ddnet_version.version);
584
- client_version.AddString("DDNet " + this.options?.ddnet_version.release_version);
585
+ client_version.AddString(`DDNet ${this.options?.ddnet_version.release_version}; https://www.npmjs.com/package/teeworlds/v/${version}`);
585
586
  } else {
586
587
  client_version.AddInt(16050);
587
- client_version.AddString("DDNet 16.5.0");
588
+ client_version.AddString(`DDNet 16.5.0; https://www.npmjs.com/package/teeworlds/v/${version}`);
588
589
  }
589
590
 
590
591
  this.SendMsgEx([client_version, info])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teeworlds",
3
- "version": "2.4.7",
3
+ "version": "2.4.8",
4
4
  "description": "Library for (ingame) teeworlds bots.",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
package/test.js DELETED
@@ -1,57 +0,0 @@
1
- let crypto = require('crypto');
2
- let list = {
3
- "WHAT_IS": Buffer.from([0x24, 0x5e, 0x50, 0x97, 0x9f, 0xe0, 0x39, 0xd6, 0xbf, 0x7d, 0x9a, 0x29, 0xe1, 0x69, 0x1e, 0x4c]),
4
- "IT_IS": Buffer.from([0x69, 0x54, 0x84, 0x7e, 0x2e, 0x87, 0x36, 0x03, 0xb5, 0x62, 0x36, 0xda, 0x29, 0xed, 0x1a, 0xca]),
5
- "I_DONT_KNOW": Buffer.from([0x41, 0x69, 0x11, 0xb5, 0x79, 0x73, 0x33, 0xbf, 0x8d, 0x52, 0x7b, 0xf0, 0x1e, 0x51, 0x9c, 0xf0]),
6
- "RCON_TYPE": Buffer.from([0x12, 0x81, 0x0e, 0x1f, 0xa1, 0xdb, 0x33, 0x78, 0xb4, 0xfb, 0x16, 0x4e, 0xd6, 0x50, 0x59, 0x26]),
7
- "MAP_DETAILS": Buffer.from([0xf9, 0x11, 0x7b, 0x3c, 0x80, 0x39, 0x34, 0x16, 0x9f, 0xc0, 0xae, 0xf2, 0xbc, 0xb7, 0x5c, 0x03]),
8
- "CAPABILITIES": Buffer.from([0xf6, 0x21, 0xa5, 0xa1, 0xf5, 0x85, 0x37, 0x75, 0x8e, 0x73, 0x41, 0xbe, 0xee, 0x79, 0xf2, 0xb2]),
9
- "CLIENT_VERSION": Buffer.from([0x8c, 0x00, 0x13, 0x04, 0x84, 0x61, 0x3e, 0x47, 0x87, 0x87, 0xf6, 0x72, 0xb3, 0x83, 0x5b, 0xd4]),
10
- // "PING_EX": Buffer.from([]),
11
- // "PONG_EX": Buffer.from([]),
12
- // "CHECKSUM_REQUEST": Buffer.from([]),
13
- // "CHECKSUM_RESPONSE": Buffer.from([]),
14
- // "CHECKSUM_ERROR": Buffer.from([])
15
- }
16
- let newList = {
17
- "what_is": ("what-is@ddnet.tw"),
18
- "it_is": ("it-is@ddnet.tw"),
19
- "i_dont_know": ("i-dont-know@ddnet.tw"),
20
- "rcon_type": ("rcon-type@ddnet.tw"),
21
- "map_details": ("map-details@ddnet.tw"),
22
- "capabilities": ("capabilities@ddnet.tw"),
23
- "client_version": ("clientver@ddnet.tw"),
24
- "ping": ("ping@ddnet.tw"),
25
- "pong": ("pong@ddnet.tw"),
26
- "checksum_request": ("checksum-request@ddnet.tw"),
27
- "checksum_response": ("checksum-response@ddnet.tw"),
28
- "checksum_error": ("checksum-error@ddnet.tw")
29
- }
30
-
31
- const createTwMD5Hash = (name) => { // https://github.com/ddnet/ddnet/blob/6d9284adc1e0be4b5348447d857eae575e06e654/src/engine/shared/uuid_manager.cpp#L26
32
- let hash = crypto.createHash("md5")
33
- .update(Buffer.from([0xe0, 0x5d, 0xda, 0xaa, 0xc4, 0xe6, 0x4c, 0xfb, 0xb6, 0x42, 0x5d, 0x48, 0xe8, 0x0c, 0x00, 0x29]))
34
- .update(name)
35
- .digest()
36
- hash[6] &= 0x0f;
37
- hash[6] |= 0x30;
38
- hash[8] &= 0x3f;
39
- hash[8] |= 0x80;
40
- return hash;
41
- }
42
-
43
- Object.keys(newList).forEach(name => {
44
- let el = newList[name];
45
- let el_old = list[name.toUpperCase()];
46
- if (el_old == undefined)
47
- return;
48
- // let hash = crypto.createHash("md5")
49
- // .update(Buffer.from([0xe0, 0x5d, 0xda, 0xaa, 0xc4, 0xe6, 0x4c, 0xfb, 0xb6, 0x42, 0x5d, 0x48, 0xe8, 0x0c, 0x00, 0x29]))
50
- // .update(name).digest()
51
-
52
- let hash = createTwMD5Hash(el);
53
- console.log(hash.compare(el_old), name)
54
- if (hash.compare(el_old) !== 0)
55
- console.log(name, hash, el_old)
56
- // it_is <Buffer 69 54 84 7e 2e 87 c6 03 75 62 36 da 29 ed 1a ca> <Buffer 69 54 84 7e 2e 87 36 03 b5 62 36 da 29 ed 1a ca>
57
- });