teeworlds 2.4.8 → 2.4.9
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 +9 -1
- package/lib/client.ts +16 -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"],
|
|
@@ -166,6 +168,7 @@ var Client = /** @class */ (function (_super) {
|
|
|
166
168
|
_this.game = new game_1.Game(_this);
|
|
167
169
|
_this.SnapshotUnpacker = new snapshot_2.SnapshotWrapper(_this);
|
|
168
170
|
_this.UUIDManager = new UUIDManager_1.UUIDManager();
|
|
171
|
+
_this.UUIDManager.RegisterName("i-dont-know@ddnet.tw", NETMSG_Sys.NETMSG_IDONTKNOW);
|
|
169
172
|
_this.UUIDManager.RegisterName("what-is@ddnet.tw", NETMSG_Sys.NETMSG_WHATIS);
|
|
170
173
|
_this.UUIDManager.RegisterName("it-is@ddnet.tw", NETMSG_Sys.NETMSG_ITIS);
|
|
171
174
|
_this.UUIDManager.RegisterName("i-dont-know@ddnet.tw", NETMSG_Sys.NETMSG_IDONTKNOW);
|
|
@@ -178,6 +181,8 @@ var Client = /** @class */ (function (_super) {
|
|
|
178
181
|
_this.UUIDManager.RegisterName("checksum-request@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_REQUEST);
|
|
179
182
|
_this.UUIDManager.RegisterName("checksum-response@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_RESPONSE);
|
|
180
183
|
_this.UUIDManager.RegisterName("checksum-error@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_ERROR);
|
|
184
|
+
_this.UUIDManager.RegisterName("redirect@ddnet.org", NETMSG_Sys.NETMSG_REDIRECT);
|
|
185
|
+
_this.UUIDManager.RegisterName("i-am-npm-package@swarfey.gitlab.io", NETMSG_Sys.NETMSG_I_AM_NPM_PACKAGE);
|
|
181
186
|
return _this;
|
|
182
187
|
}
|
|
183
188
|
Client.prototype.ResendAfter = function (lastAck) {
|
|
@@ -435,7 +440,10 @@ var Client = /** @class */ (function (_super) {
|
|
|
435
440
|
client_version.AddInt(16050);
|
|
436
441
|
client_version.AddString("DDNet 16.5.0; https://www.npmjs.com/package/teeworlds/v/".concat(version));
|
|
437
442
|
}
|
|
438
|
-
|
|
443
|
+
var i_am_npm_package = new MsgPacker_1.MsgPacker(0, true, 1);
|
|
444
|
+
i_am_npm_package.AddBuffer(_this.UUIDManager.LookupType(NETMSG_Sys.NETMSG_I_AM_NPM_PACKAGE).hash);
|
|
445
|
+
i_am_npm_package.AddString("https://www.npmjs.com/package/teeworlds/v/".concat(version));
|
|
446
|
+
_this.SendMsgEx([client_version, info, i_am_npm_package]);
|
|
439
447
|
}
|
|
440
448
|
else if (packet[3] == 0x4) {
|
|
441
449
|
// 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,7 @@ export class Client extends EventEmitter {
|
|
|
291
295
|
|
|
292
296
|
this.UUIDManager = new UUIDManager();
|
|
293
297
|
|
|
294
|
-
|
|
298
|
+
this.UUIDManager.RegisterName("i-dont-know@ddnet.tw", NETMSG_Sys.NETMSG_IDONTKNOW);
|
|
295
299
|
this.UUIDManager.RegisterName("what-is@ddnet.tw", NETMSG_Sys.NETMSG_WHATIS);
|
|
296
300
|
this.UUIDManager.RegisterName("it-is@ddnet.tw", NETMSG_Sys.NETMSG_ITIS);
|
|
297
301
|
this.UUIDManager.RegisterName("i-dont-know@ddnet.tw", NETMSG_Sys.NETMSG_IDONTKNOW);
|
|
@@ -305,6 +309,9 @@ export class Client extends EventEmitter {
|
|
|
305
309
|
this.UUIDManager.RegisterName("checksum-request@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_REQUEST);
|
|
306
310
|
this.UUIDManager.RegisterName("checksum-response@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_RESPONSE);
|
|
307
311
|
this.UUIDManager.RegisterName("checksum-error@ddnet.tw", NETMSG_Sys.NETMSG_CHECKSUM_ERROR);
|
|
312
|
+
this.UUIDManager.RegisterName("redirect@ddnet.org", NETMSG_Sys.NETMSG_REDIRECT);
|
|
313
|
+
|
|
314
|
+
this.UUIDManager.RegisterName("i-am-npm-package@swarfey.gitlab.io", NETMSG_Sys.NETMSG_I_AM_NPM_PACKAGE);
|
|
308
315
|
|
|
309
316
|
}
|
|
310
317
|
|
|
@@ -588,7 +595,13 @@ export class Client extends EventEmitter {
|
|
|
588
595
|
client_version.AddString(`DDNet 16.5.0; https://www.npmjs.com/package/teeworlds/v/${version}`);
|
|
589
596
|
}
|
|
590
597
|
|
|
591
|
-
|
|
598
|
+
var i_am_npm_package = new MsgPacker(0, true, 1);
|
|
599
|
+
i_am_npm_package.AddBuffer(this.UUIDManager.LookupType(NETMSG_Sys.NETMSG_I_AM_NPM_PACKAGE)!.hash);
|
|
600
|
+
|
|
601
|
+
i_am_npm_package.AddString(`https://www.npmjs.com/package/teeworlds/v/${version}`);
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
this.SendMsgEx([client_version, info, i_am_npm_package])
|
|
592
605
|
} else if (packet[3] == 0x4) {
|
|
593
606
|
// disconnected
|
|
594
607
|
this.State = States.STATE_OFFLINE;
|