teeworlds 2.4.8 → 2.5.0
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 +3 -2
- package/lib/client.js +8 -1
- package/lib/client.ts +15 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# tw-chatonly
|
|
2
2
|
Library to connect a bot to a Teeworlds server.
|
|
3
3
|
|
|
4
|
+
https://gitlab.com/swarfey/teeworlds-client/-/tree/main/
|
|
4
5
|
https://www.npmjs.com/package/teeworlds
|
|
5
6
|
|
|
6
7
|
|
|
@@ -89,5 +90,5 @@ process.stdin.on("data", data => {
|
|
|
89
90
|
```
|
|
90
91
|
|
|
91
92
|
# 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
|
|
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.
|
package/lib/client.js
CHANGED
|
@@ -126,6 +126,8 @@ var NETMSG_Sys;
|
|
|
126
126
|
NETMSG_Sys[NETMSG_Sys["NETMSG_CHECKSUM_REQUEST"] = 65545] = "NETMSG_CHECKSUM_REQUEST";
|
|
127
127
|
NETMSG_Sys[NETMSG_Sys["NETMSG_CHECKSUM_RESPONSE"] = 65546] = "NETMSG_CHECKSUM_RESPONSE";
|
|
128
128
|
NETMSG_Sys[NETMSG_Sys["NETMSG_CHECKSUM_ERROR"] = 65547] = "NETMSG_CHECKSUM_ERROR";
|
|
129
|
+
NETMSG_Sys[NETMSG_Sys["NETMSG_REDIRECT"] = 65548] = "NETMSG_REDIRECT";
|
|
130
|
+
NETMSG_Sys[NETMSG_Sys["NETMSG_I_AM_NPM_PACKAGE"] = 65549] = "NETMSG_I_AM_NPM_PACKAGE";
|
|
129
131
|
})(NETMSG_Sys || (NETMSG_Sys = {}));
|
|
130
132
|
var messageTypes = [
|
|
131
133
|
["none, starts at 1", "SV_MOTD", "SV_BROADCAST", "SV_CHAT", "SV_KILL_MSG", "SV_SOUND_GLOBAL", "SV_TUNE_PARAMS", "SV_EXTRA_PROJECTILE", "SV_READY_TO_ENTER", "SV_WEAPON_PICKUP", "SV_EMOTICON", "SV_VOTE_CLEAR_OPTIONS", "SV_VOTE_OPTION_LIST_ADD", "SV_VOTE_OPTION_ADD", "SV_VOTE_OPTION_REMOVE", "SV_VOTE_SET", "SV_VOTE_STATUS", "CL_SAY", "CL_SET_TEAM", "CL_SET_SPECTATOR_MODE", "CL_START_INFO", "CL_CHANGE_INFO", "CL_KILL", "CL_EMOTICON", "CL_VOTE", "CL_CALL_VOTE", "CL_IS_DDNET", "SV_DDRACE_TIME", "SV_RECORD", "UNUSED", "SV_TEAMS_STATE", "CL_SHOW_OTHERS_LEGACY"],
|
|
@@ -178,6 +180,8 @@ var Client = /** @class */ (function (_super) {
|
|
|
178
180
|
_this.UUIDManager.RegisterName("checksum-request@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_REQUEST);
|
|
179
181
|
_this.UUIDManager.RegisterName("checksum-response@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_RESPONSE);
|
|
180
182
|
_this.UUIDManager.RegisterName("checksum-error@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_ERROR);
|
|
183
|
+
_this.UUIDManager.RegisterName("redirect@ddnet.org", NETMSG_Sys.NETMSG_REDIRECT);
|
|
184
|
+
_this.UUIDManager.RegisterName("i-am-npm-package@swarfey.gitlab.io", NETMSG_Sys.NETMSG_I_AM_NPM_PACKAGE);
|
|
181
185
|
return _this;
|
|
182
186
|
}
|
|
183
187
|
Client.prototype.ResendAfter = function (lastAck) {
|
|
@@ -435,7 +439,10 @@ var Client = /** @class */ (function (_super) {
|
|
|
435
439
|
client_version.AddInt(16050);
|
|
436
440
|
client_version.AddString("DDNet 16.5.0; https://www.npmjs.com/package/teeworlds/v/".concat(version));
|
|
437
441
|
}
|
|
438
|
-
|
|
442
|
+
var i_am_npm_package = new MsgPacker_1.MsgPacker(0, true, 1);
|
|
443
|
+
i_am_npm_package.AddBuffer(_this.UUIDManager.LookupType(NETMSG_Sys.NETMSG_I_AM_NPM_PACKAGE).hash);
|
|
444
|
+
i_am_npm_package.AddString("https://www.npmjs.com/package/teeworlds/v/".concat(version));
|
|
445
|
+
_this.SendMsgEx([i_am_npm_package, client_version, info]);
|
|
439
446
|
}
|
|
440
447
|
else if (packet[3] == 0x4) {
|
|
441
448
|
// disconnected
|
package/lib/client.ts
CHANGED
|
@@ -122,7 +122,11 @@ enum NETMSG_Sys {
|
|
|
122
122
|
NETMSG_PONGEX,
|
|
123
123
|
NETMSG_CHECKSUM_REQUEST,
|
|
124
124
|
NETMSG_CHECKSUM_RESPONSE,
|
|
125
|
-
NETMSG_CHECKSUM_ERROR
|
|
125
|
+
NETMSG_CHECKSUM_ERROR,
|
|
126
|
+
|
|
127
|
+
NETMSG_REDIRECT,
|
|
128
|
+
|
|
129
|
+
NETMSG_I_AM_NPM_PACKAGE
|
|
126
130
|
|
|
127
131
|
}
|
|
128
132
|
|
|
@@ -291,7 +295,6 @@ export class Client extends EventEmitter {
|
|
|
291
295
|
|
|
292
296
|
this.UUIDManager = new UUIDManager();
|
|
293
297
|
|
|
294
|
-
|
|
295
298
|
this.UUIDManager.RegisterName("what-is@ddnet.tw", NETMSG_Sys.NETMSG_WHATIS);
|
|
296
299
|
this.UUIDManager.RegisterName("it-is@ddnet.tw", NETMSG_Sys.NETMSG_ITIS);
|
|
297
300
|
this.UUIDManager.RegisterName("i-dont-know@ddnet.tw", NETMSG_Sys.NETMSG_IDONTKNOW);
|
|
@@ -305,6 +308,9 @@ export class Client extends EventEmitter {
|
|
|
305
308
|
this.UUIDManager.RegisterName("checksum-request@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_REQUEST);
|
|
306
309
|
this.UUIDManager.RegisterName("checksum-response@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_RESPONSE);
|
|
307
310
|
this.UUIDManager.RegisterName("checksum-error@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_ERROR);
|
|
311
|
+
this.UUIDManager.RegisterName("redirect@ddnet.org", NETMSG_Sys.NETMSG_REDIRECT);
|
|
312
|
+
|
|
313
|
+
this.UUIDManager.RegisterName("i-am-npm-package@swarfey.gitlab.io", NETMSG_Sys.NETMSG_I_AM_NPM_PACKAGE);
|
|
308
314
|
|
|
309
315
|
}
|
|
310
316
|
|
|
@@ -588,7 +594,13 @@ export class Client extends EventEmitter {
|
|
|
588
594
|
client_version.AddString(`DDNet 16.5.0; https://www.npmjs.com/package/teeworlds/v/${version}`);
|
|
589
595
|
}
|
|
590
596
|
|
|
591
|
-
|
|
597
|
+
var i_am_npm_package = new MsgPacker(0, true, 1);
|
|
598
|
+
i_am_npm_package.AddBuffer(this.UUIDManager.LookupType(NETMSG_Sys.NETMSG_I_AM_NPM_PACKAGE)!.hash);
|
|
599
|
+
|
|
600
|
+
i_am_npm_package.AddString(`https://www.npmjs.com/package/teeworlds/v/${version}`);
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
this.SendMsgEx([i_am_npm_package, client_version, info])
|
|
592
604
|
} else if (packet[3] == 0x4) {
|
|
593
605
|
// disconnected
|
|
594
606
|
this.State = States.STATE_OFFLINE;
|