teeworlds 2.5.3 → 2.5.4

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.
@@ -1,51 +1,19 @@
1
1
 
2
2
  import { Client } from "../client";
3
3
  import { EventEmitter } from "stream";
4
- import { PlayerInput, PlayerInfo, Projectile, Laser, Pickup, Flag, GameInfo, GameData, CharacterCore, Character, ClientInfo, SpectatorInfo, Common, Explosion, Spawn, HammerHit, Death, SoundGlobal, SoundWorld, DamageInd, MyOwnObject, DDNetCharacter, DDNetProjectile, DDNetLaser, GameInfoEx } from "../snapshots";
5
-
6
- enum items {
7
- OBJ_EX,
8
- OBJ_PLAYER_INPUT,
9
- OBJ_PROJECTILE,
10
- OBJ_LASER,
11
- OBJ_PICKUP,
12
- OBJ_FLAG,
13
- OBJ_GAME_INFO,
14
- OBJ_GAME_DATA,
15
- OBJ_CHARACTER_CORE,
16
- OBJ_CHARACTER,
17
- OBJ_PLAYER_INFO,
18
- OBJ_CLIENT_INFO,
19
- OBJ_SPECTATOR_INFO,
20
- EVENT_COMMON,
21
- EVENT_EXPLOSION,
22
- EVENT_SPAWN,
23
- EVENT_HAMMERHIT,
24
- EVENT_DEATH,
25
- EVENT_SOUND_GLOBAL,
26
- EVENT_SOUND_WORLD,
27
- EVENT_DAMAGE_INDICATOR
28
- }
4
+ import { SnapshotItemTypes } from "../enums_types/types";
5
+ import { SnapshotItemIDs } from "../enums_types/protocol";
29
6
  export declare interface SnapshotWrapper {
30
7
 
31
8
 
32
- // on(event: 'connected', listener: () => void): this;
33
- // on(event: 'disconnect', listener: (reason: string) => void): this;
34
-
35
- // on(event: 'emote', listener: (message: iEmoticon) => void): this;
36
- // on(event: 'message', listener: (message: iMessage) => void): this;
37
- // on(event: 'broadcast', listener: (message: string) => void): this;
38
- // on(event: 'kill', listener: (kill: iKillMsg) => void): this;
39
- // on(event: 'motd', listener: (message: string) => void): this;
40
-
41
- on(event: 'common', listener: (common: Common) => void): this;
42
- on(event: 'explosion', listener: (explosion: Explosion) => void): this;
43
- on(event: 'spawn', listener: (spawn: Spawn) => void): this;
44
- on(event: 'hammerhit', listener: (hammerhit: HammerHit) => void): this;
45
- on(event: 'death', listener: (death: Death) => void): this;
46
- on(event: 'sound_global', listener: (sound_global: SoundGlobal) => void): this;
47
- on(event: 'sound_world', listener: (sound_world: SoundWorld) => void): this;
48
- on(event: 'damage_indicator', listener: (damage_indicator: DamageInd) => void): this;
9
+ on(event: 'common', listener: (common: SnapshotItemTypes.Common) => void): this;
10
+ on(event: 'explosion', listener: (explosion: SnapshotItemTypes.Explosion) => void): this;
11
+ on(event: 'spawn', listener: (spawn: SnapshotItemTypes.Spawn) => void): this;
12
+ on(event: 'hammerhit', listener: (hammerhit: SnapshotItemTypes.HammerHit) => void): this;
13
+ on(event: 'death', listener: (death: SnapshotItemTypes.Death) => void): this;
14
+ on(event: 'sound_global', listener: (sound_global: SnapshotItemTypes.SoundGlobal) => void): this;
15
+ on(event: 'sound_world', listener: (sound_world: SnapshotItemTypes.SoundWorld) => void): this;
16
+ on(event: 'damage_indicator', listener: (damage_indicator: SnapshotItemTypes.DamageInd) => void): this;
49
17
 
50
18
  }
51
19
 
@@ -77,132 +45,132 @@ export class SnapshotWrapper extends EventEmitter {
77
45
  // return this._client.rawSnapUnpacker.deltas.filter(delta => delta.type_id == type_id && delta.id == id).map(a => a.parsed);
78
46
  }
79
47
 
80
- getObjPlayerInput(player_id: number): PlayerInput | undefined {
81
- return this.getParsed(items.OBJ_PLAYER_INPUT, player_id);
48
+ getObjPlayerInput(player_id: number): SnapshotItemTypes.PlayerInput | undefined {
49
+ return this.getParsed(SnapshotItemIDs.OBJ_PLAYER_INPUT, player_id);
82
50
  }
83
51
 
84
- get AllObjPlayerInput(): PlayerInput[] {
85
- return this.getAll(items.OBJ_PLAYER_INPUT);
52
+ get AllObjPlayerInput(): SnapshotItemTypes.PlayerInput[] {
53
+ return this.getAll(SnapshotItemIDs.OBJ_PLAYER_INPUT);
86
54
  }
87
55
 
88
- getObjProjectile(id: number): Projectile | undefined {
89
- return this.getParsed(items.OBJ_PROJECTILE, id);
56
+ getObjProjectile(id: number): SnapshotItemTypes.Projectile | undefined {
57
+ return this.getParsed(SnapshotItemIDs.OBJ_PROJECTILE, id);
90
58
  }
91
- get AllProjectiles(): Projectile[] {
92
- return this.getAll(items.OBJ_PROJECTILE);
59
+ get AllProjectiles(): SnapshotItemTypes.Projectile[] {
60
+ return this.getAll(SnapshotItemIDs.OBJ_PROJECTILE);
93
61
  }
94
62
 
95
- getObjLaser(id: number): Laser | undefined {
96
- return this.getParsed(items.OBJ_LASER, id);
63
+ getObjLaser(id: number): SnapshotItemTypes.Laser | undefined {
64
+ return this.getParsed(SnapshotItemIDs.OBJ_LASER, id);
97
65
  }
98
- get AllObjLaser(): Laser[] {
99
- return this.getAll(items.OBJ_LASER);
66
+ get AllObjLaser(): SnapshotItemTypes.Laser[] {
67
+ return this.getAll(SnapshotItemIDs.OBJ_LASER);
100
68
  }
101
69
 
102
- getObjPickup(id: number): Pickup | undefined {
103
- return this.getParsed(items.OBJ_PICKUP, id);
70
+ getObjPickup(id: number): SnapshotItemTypes.Pickup | undefined {
71
+ return this.getParsed(SnapshotItemIDs.OBJ_PICKUP, id);
104
72
  }
105
- get AllObjPickup(): Pickup[] {
106
- return this.getAll(items.OBJ_PICKUP);
73
+ get AllObjPickup(): SnapshotItemTypes.Pickup[] {
74
+ return this.getAll(SnapshotItemIDs.OBJ_PICKUP);
107
75
  }
108
76
 
109
- getObjFlag(id: number): Flag | undefined {
110
- return this.getParsed(items.OBJ_FLAG, id);
77
+ getObjFlag(id: number): SnapshotItemTypes.Flag | undefined {
78
+ return this.getParsed(SnapshotItemIDs.OBJ_FLAG, id);
111
79
  }
112
- get AllObjFlag(): Flag[] {
113
- return this.getAll(items.OBJ_FLAG);
80
+ get AllObjFlag(): SnapshotItemTypes.Flag[] {
81
+ return this.getAll(SnapshotItemIDs.OBJ_FLAG);
114
82
  }
115
83
 
116
- getObjGameInfo(id: number): GameInfo | undefined {
117
- return this.getParsed(items.OBJ_GAME_INFO, id);
84
+ getObjGameInfo(id: number): SnapshotItemTypes.GameInfo | undefined {
85
+ return this.getParsed(SnapshotItemIDs.OBJ_GAME_INFO, id);
118
86
  }
119
- get AllObjGameInfo(): GameInfo[] {
120
- return this.getAll(items.OBJ_GAME_INFO);
87
+ get AllObjGameInfo(): SnapshotItemTypes.GameInfo[] {
88
+ return this.getAll(SnapshotItemIDs.OBJ_GAME_INFO);
121
89
  }
122
90
 
123
- getObjGameData(id: number): GameData | undefined {
124
- return this.getParsed(items.OBJ_GAME_DATA, id);
91
+ getObjGameData(id: number): SnapshotItemTypes.GameData | undefined {
92
+ return this.getParsed(SnapshotItemIDs.OBJ_GAME_DATA, id);
125
93
  }
126
- get AllObjGameData(): GameData[] {
127
- return this.getAll(items.OBJ_GAME_DATA);
94
+ get AllObjGameData(): SnapshotItemTypes.GameData[] {
95
+ return this.getAll(SnapshotItemIDs.OBJ_GAME_DATA);
128
96
  }
129
97
 
130
98
  /** 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 */
131
- getObjCharacterCore(player_id: number): CharacterCore | undefined {
132
- return this.getParsed(items.OBJ_CHARACTER_CORE, player_id);
99
+ getObjCharacterCore(player_id: number): SnapshotItemTypes.CharacterCore | undefined {
100
+ return this.getParsed(SnapshotItemIDs.OBJ_CHARACTER_CORE, player_id);
133
101
  }
134
102
  /** 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 */
135
- get AllObjCharacterCore(): CharacterCore[] {
136
- return this.getAll(items.OBJ_CHARACTER_CORE);
103
+ get AllObjCharacterCore(): SnapshotItemTypes.CharacterCore[] {
104
+ return this.getAll(SnapshotItemIDs.OBJ_CHARACTER_CORE);
137
105
  }
138
106
 
139
107
  /** 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 */
140
- getObjCharacter(player_id: number): Character | undefined {
141
- return this.getParsed(items.OBJ_CHARACTER, player_id);
108
+ getObjCharacter(player_id: number): SnapshotItemTypes.Character | undefined {
109
+ return this.getParsed(SnapshotItemIDs.OBJ_CHARACTER, player_id);
142
110
  }
143
111
  /** 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 */
144
- get AllObjCharacter(): Character[] {
112
+ get AllObjCharacter(): SnapshotItemTypes.Character[] {
145
113
 
146
- return this.getAll(items.OBJ_CHARACTER);
114
+ return this.getAll(SnapshotItemIDs.OBJ_CHARACTER);
147
115
  }
148
116
 
149
- getObjPlayerInfo(player_id: number): PlayerInfo | undefined {
150
- return this.getParsed(items.OBJ_PLAYER_INFO, player_id);
117
+ getObjPlayerInfo(player_id: number): SnapshotItemTypes.PlayerInfo | undefined {
118
+ return this.getParsed(SnapshotItemIDs.OBJ_PLAYER_INFO, player_id);
151
119
  }
152
- get AllObjPlayerInfo(): PlayerInfo[] {
153
- return this.getAll(items.OBJ_PLAYER_INFO);
120
+ get AllObjPlayerInfo(): SnapshotItemTypes.PlayerInfo[] {
121
+ return this.getAll(SnapshotItemIDs.OBJ_PLAYER_INFO);
154
122
  }
155
123
 
156
- getObjClientInfo(player_id: number): ClientInfo | undefined {
157
- return this.getParsed(items.OBJ_CLIENT_INFO, player_id);
124
+ getObjClientInfo(player_id: number): SnapshotItemTypes.ClientInfo | undefined {
125
+ return this.getParsed(SnapshotItemIDs.OBJ_CLIENT_INFO, player_id);
158
126
  }
159
- get AllObjClientInfo(): ClientInfo[] {
160
- return this.getAll(items.OBJ_CLIENT_INFO);
127
+ get AllObjClientInfo(): SnapshotItemTypes.ClientInfo[] {
128
+ return this.getAll(SnapshotItemIDs.OBJ_CLIENT_INFO);
161
129
  }
162
130
 
163
- getObjSpectatorInfo(player_id: number): SpectatorInfo | undefined {
164
- return this.getParsed(items.OBJ_SPECTATOR_INFO, player_id);
131
+ getObjSpectatorInfo(player_id: number): SnapshotItemTypes.SpectatorInfo | undefined {
132
+ return this.getParsed(SnapshotItemIDs.OBJ_SPECTATOR_INFO, player_id);
165
133
  }
166
- get AllObjSpectatorInfo(): SpectatorInfo[] {
167
- return this.getAll(items.OBJ_SPECTATOR_INFO);
134
+ get AllObjSpectatorInfo(): SnapshotItemTypes.SpectatorInfo[] {
135
+ return this.getAll(SnapshotItemIDs.OBJ_SPECTATOR_INFO);
168
136
  }
169
137
 
170
138
  private getTypeId(name: string) {
171
139
  return this._client.rawSnapUnpacker.uuid_manager.LookupName(name)?.type_id || -1;
172
140
  }
173
141
 
174
- getObjExMyOwnObject(id: number): MyOwnObject | undefined {
142
+ getObjExMyOwnObject(id: number): SnapshotItemTypes.MyOwnObject | undefined {
175
143
  return this.getParsed(this.getTypeId("my-own-object@heinrich5991.de"), id);
176
144
  }
177
- get AllObjExMyOwnObject(): MyOwnObject[] {
145
+ get AllObjExMyOwnObject(): SnapshotItemTypes.MyOwnObject[] {
178
146
  return this.getAll(this.getTypeId("my-own-object@heinrich5991.de"));
179
147
  }
180
148
 
181
- getObjExDDNetCharacter(id: number): DDNetCharacter | undefined {
149
+ getObjExDDNetCharacter(id: number): SnapshotItemTypes.DDNetCharacter | undefined {
182
150
  return this.getParsed(this.getTypeId("character@netobj.ddnet.tw"), id);
183
151
  }
184
- get AllObjExDDNetCharacter(): DDNetCharacter[] {
152
+ get AllObjExDDNetCharacter(): SnapshotItemTypes.DDNetCharacter[] {
185
153
  return this.getAll(this.getTypeId("character@netobj.ddnet.tw"));
186
154
  }
187
155
 
188
- getObjExGameInfo(id: number): GameInfoEx | undefined {
156
+ getObjExGameInfo(id: number): SnapshotItemTypes.GameInfoEx | undefined {
189
157
  return this.getParsed(this.getTypeId("gameinfo@netobj.ddnet.tw"), id);
190
158
  }
191
- get AllObjExGameInfo(): GameInfoEx[] {
159
+ get AllObjExGameInfo(): SnapshotItemTypes.GameInfoEx[] {
192
160
  return this.getAll(this.getTypeId("gameinfo@netobj.ddnet.tw"));
193
161
  }
194
162
 
195
- getObjExDDNetProjectile(id: number): DDNetProjectile | undefined {
163
+ getObjExDDNetProjectile(id: number): SnapshotItemTypes.DDNetProjectile | undefined {
196
164
  return this.getParsed(this.getTypeId("projectile@netobj.ddnet.tw"), id);
197
165
  }
198
- get AllObjExDDNetProjectile(): DDNetProjectile[] {
166
+ get AllObjExDDNetProjectile(): SnapshotItemTypes.DDNetProjectile[] {
199
167
  return this.getAll(this.getTypeId("projectile@netobj.ddnet.tw"));
200
168
  }
201
169
 
202
- getObjExLaser(id: number): DDNetLaser | undefined {
170
+ getObjExLaser(id: number): SnapshotItemTypes.DDNetLaser | undefined {
203
171
  return this.getParsed(this.getTypeId("laser@netobj.ddnet.tw"), id);
204
172
  }
205
- get AllObjExLaser(): DDNetLaser[] {
173
+ get AllObjExLaser(): SnapshotItemTypes.DDNetLaser[] {
206
174
  return this.getAll(this.getTypeId("laser@netobj.ddnet.tw"));
207
175
  }
208
176
 
@@ -0,0 +1,13 @@
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 = {}));
@@ -0,0 +1,137 @@
1
+ export enum States {
2
+ STATE_OFFLINE = 0,
3
+ STATE_CONNECTING,
4
+ STATE_LOADING,
5
+ STATE_ONLINE,
6
+ STATE_DEMOPLAYBACK,
7
+ STATE_QUITTING,
8
+ STATE_RESTARTING
9
+ }
10
+
11
+ export namespace NETMSG {
12
+
13
+ export const enum Game {
14
+ EX,
15
+ SV_MOTD,
16
+ SV_BROADCAST,
17
+ SV_CHAT,
18
+ SV_KILLMSG,
19
+ SV_SOUNDGLOBAL,
20
+ SV_TUNEPARAMS,
21
+ SV_EXTRAPROJECTILE,
22
+ SV_READYTOENTER,
23
+ SV_WEAPONPICKUP,
24
+ SV_EMOTICON,
25
+ SV_VOTECLEAROPTIONS,
26
+ SV_VOTEOPTIONLISTADD,
27
+ SV_VOTEOPTIONADD,
28
+ SV_VOTEOPTIONREMOVE,
29
+ SV_VOTESET,
30
+ SV_VOTESTATUS,
31
+ CL_SAY,
32
+ CL_SETTEAM,
33
+ CL_SETSPECTATORMODE,
34
+ CL_STARTINFO,
35
+ CL_CHANGEINFO,
36
+ CL_KILL,
37
+ CL_EMOTICON,
38
+ CL_VOTE,
39
+ CL_CALLVOTE,
40
+ CL_ISDDNETLEGACY,
41
+ SV_DDRACETIMELEGACY,
42
+ SV_RECORDLEGACY,
43
+ UNUSED,
44
+ SV_TEAMSSTATELEGACY,
45
+ CL_SHOWOTHERSLEGACY,
46
+ NUM
47
+ }
48
+
49
+ export const enum System {
50
+ NETMSG_EX = 0,
51
+
52
+ // the first thing sent by the client
53
+ // contains the version info for the client
54
+ NETMSG_INFO = 1,
55
+
56
+ // sent by server
57
+ NETMSG_MAP_CHANGE, // sent when client should switch map
58
+ NETMSG_MAP_DATA, // map transfer, contains a chunk of the map file
59
+ NETMSG_CON_READY, // connection is ready, client should send start info
60
+ NETMSG_SNAP, // normal snapshot, multiple parts
61
+ NETMSG_SNAPEMPTY, // empty snapshot
62
+ NETMSG_SNAPSINGLE, // ?
63
+ NETMSG_SNAPSMALL, //
64
+ NETMSG_INPUTTIMING, // reports how off the input was
65
+ NETMSG_RCON_AUTH_STATUS, // result of the authentication
66
+ NETMSG_RCON_LINE, // line that should be printed to the remote console
67
+
68
+ NETMSG_AUTH_CHALLANGE, //
69
+ NETMSG_AUTH_RESULT, //
70
+
71
+ // sent by client
72
+ NETMSG_READY, //
73
+ NETMSG_ENTERGAME,
74
+ NETMSG_INPUT, // contains the inputdata from the client
75
+ NETMSG_RCON_CMD, //
76
+ NETMSG_RCON_AUTH, //
77
+ NETMSG_REQUEST_MAP_DATA, //
78
+
79
+ NETMSG_AUTH_START, //
80
+ NETMSG_AUTH_RESPONSE, //
81
+
82
+ // sent by both
83
+ NETMSG_PING,
84
+ NETMSG_PING_REPLY,
85
+ NETMSG_ERROR,
86
+
87
+ // sent by server (todo: move it up)
88
+ NETMSG_RCON_CMD_ADD,
89
+ NETMSG_RCON_CMD_REM,
90
+
91
+ NUM_NETMSGS,
92
+
93
+ NETMSG_WHATIS = 65536,
94
+ NETMSG_ITIS,
95
+ NETMSG_IDONTKNOW,
96
+
97
+ NETMSG_RCONTYPE,
98
+ NETMSG_MAP_DETAILS,
99
+ NETMSG_CAPABILITIES,
100
+ NETMSG_CLIENTVER,
101
+ NETMSG_PINGEX,
102
+ NETMSG_PONGEX,
103
+ NETMSG_CHECKSUM_REQUEST,
104
+ NETMSG_CHECKSUM_RESPONSE,
105
+ NETMSG_CHECKSUM_ERROR,
106
+
107
+ NETMSG_REDIRECT,
108
+
109
+ NETMSG_I_AM_NPM_PACKAGE
110
+
111
+ }
112
+
113
+ }
114
+
115
+ export const enum SnapshotItemIDs {
116
+ OBJ_EX,
117
+ OBJ_PLAYER_INPUT,
118
+ OBJ_PROJECTILE,
119
+ OBJ_LASER,
120
+ OBJ_PICKUP,
121
+ OBJ_FLAG,
122
+ OBJ_GAME_INFO,
123
+ OBJ_GAME_DATA,
124
+ OBJ_CHARACTER_CORE,
125
+ OBJ_CHARACTER,
126
+ OBJ_PLAYER_INFO,
127
+ OBJ_CLIENT_INFO,
128
+ OBJ_SPECTATOR_INFO,
129
+ EVENT_COMMON,
130
+ EVENT_EXPLOSION,
131
+ EVENT_SPAWN,
132
+ EVENT_HAMMERHIT,
133
+ EVENT_DEATH,
134
+ EVENT_SOUND_GLOBAL,
135
+ EVENT_SOUND_WORLD,
136
+ EVENT_DAMAGE_INDICATOR
137
+ }
@@ -0,0 +1,236 @@
1
+ export type Item = SnapshotItemTypes.PlayerInput | SnapshotItemTypes.PlayerInfo | SnapshotItemTypes.Projectile | SnapshotItemTypes.Laser | SnapshotItemTypes.Pickup | SnapshotItemTypes.Flag | SnapshotItemTypes.GameInfo | SnapshotItemTypes.GameData | SnapshotItemTypes.CharacterCore | SnapshotItemTypes.Character | SnapshotItemTypes.PlayerInfo | SnapshotItemTypes.ClientInfo | SnapshotItemTypes.SpectatorInfo | SnapshotItemTypes.Common | SnapshotItemTypes.Explosion | SnapshotItemTypes.Spawn | SnapshotItemTypes.HammerHit | SnapshotItemTypes.Death | SnapshotItemTypes.SoundGlobal | SnapshotItemTypes.SoundWorld | SnapshotItemTypes.DamageInd;
2
+ export type DDNetItem = SnapshotItemTypes.MyOwnObject | SnapshotItemTypes.DDNetCharacter | SnapshotItemTypes.DDNetPlayer | SnapshotItemTypes.GameInfoEx | SnapshotItemTypes.DDNetProjectile | SnapshotItemTypes.DDNetLaser;
3
+ export type DeltaItem = { 'data': number[], 'parsed': Item | DDNetItem, 'type_id': number, 'id': number, 'key': number};
4
+ export namespace SnapshotItemTypes {
5
+ interface PlayerInput {
6
+ direction: number,
7
+ target_x: number,
8
+ target_y: number,
9
+ jump: number,
10
+ fire: number,
11
+ hook: number,
12
+ player_flags: number,
13
+ wanted_weapon: number,
14
+ next_weapon: number,
15
+ prev_weapon: number,
16
+ }
17
+
18
+ interface Projectile {
19
+ x: number,
20
+ y: number,
21
+ vel_x: number,
22
+ vel_y: number,
23
+ type_: number,
24
+ start_tick: number,
25
+ }
26
+
27
+ interface Laser {
28
+ x: number,
29
+ y: number,
30
+ from_x: number,
31
+ from_y: number,
32
+ start_tick: number,
33
+ }
34
+
35
+ interface Pickup {
36
+ x: number,
37
+ y: number,
38
+ type_: number,
39
+ subtype: number,
40
+ }
41
+
42
+ interface Flag {
43
+ x: number,
44
+ y: number,
45
+ team: number,
46
+ }
47
+
48
+ interface GameInfo {
49
+ game_flags: number,
50
+ game_state_flags: number,
51
+ round_start_tick: number,
52
+ warmup_timer: number,
53
+ score_limit: number,
54
+ time_limit: number,
55
+ round_num: number,
56
+ round_current: number,
57
+ }
58
+
59
+ interface GameData {
60
+ teamscore_red: number,
61
+ teamscore_blue: number,
62
+ flag_carrier_red: number,
63
+ flag_carrier_blue: number,
64
+ }
65
+
66
+ interface CharacterCore {
67
+ tick: number,
68
+ x: number,
69
+ y: number,
70
+ vel_x: number,
71
+ vel_y: number,
72
+ angle: number,
73
+ direction: number,
74
+ jumped: number,
75
+ hooked_player: number,
76
+ hook_state: number,
77
+ hook_tick: number,
78
+ hook_x: number,
79
+ hook_y: number,
80
+ hook_dx: number,
81
+ hook_dy: number,
82
+ }
83
+
84
+ interface Character {
85
+ character_core: CharacterCore,
86
+ player_flags: number,
87
+ health: number,
88
+ armor: number,
89
+ ammo_count: number,
90
+ weapon: number,
91
+ emote: number,
92
+ attack_tick: number,
93
+
94
+ client_id: number
95
+ }
96
+
97
+ interface PlayerInfo {
98
+ local: number,
99
+ client_id: number,
100
+ team: number,
101
+ score: number,
102
+ latency: number,
103
+ }
104
+
105
+ interface ClientInfo {
106
+ name: string,
107
+ clan: string,
108
+ country: number,
109
+ skin: string,
110
+ use_custom_color: number,
111
+ color_body: number,
112
+ color_feet: number,
113
+
114
+ id: number
115
+ }
116
+
117
+ interface SpectatorInfo {
118
+ spectator_id: number,
119
+ x: number,
120
+ y: number,
121
+ }
122
+
123
+ interface Common {
124
+ x: number,
125
+ y: number,
126
+ }
127
+
128
+ interface Explosion {
129
+ common: Common,
130
+ }
131
+
132
+ interface Spawn {
133
+ common: Common,
134
+ }
135
+
136
+ interface HammerHit {
137
+ common: Common,
138
+ }
139
+
140
+ interface Death {
141
+ common: Common,
142
+ client_id: number,
143
+ }
144
+
145
+ interface SoundGlobal {
146
+ common: Common,
147
+ sound_id: number,
148
+ }
149
+
150
+ interface SoundWorld {
151
+ common: Common,
152
+ sound_id: number,
153
+ }
154
+
155
+ interface DamageInd {
156
+ common: Common,
157
+ angle: number,
158
+ }
159
+
160
+ interface MyOwnObject {
161
+ m_Test: number
162
+ }
163
+
164
+ interface DDNetCharacter {
165
+ m_Flags: number,
166
+ m_FreezeEnd: number,
167
+ m_Jumps: number,
168
+ m_TeleCheckpoint: number,
169
+ m_StrongWeakID: number,
170
+
171
+ // # New data fields for jump display, freeze bar and ninja bar
172
+ // # Default values indicate that these values should not be used
173
+ m_JumpedTotal?: number,
174
+ m_NinjaActivationTick?: number,
175
+ m_FreezeStart?: number,
176
+ // # New data fields for improved target accuracy
177
+ m_TargetX?: number,
178
+ m_TargetY?: number,
179
+ id: number
180
+ } //, validate_size=False),
181
+ /** m_AuthLevel "AUTHED_NO", "AUTHED_ADMIN" */
182
+ interface DDNetPlayer {
183
+ m_Flags: number,
184
+ m_AuthLevel: number,
185
+ id: number
186
+ }
187
+
188
+ interface GameInfoEx {
189
+
190
+ m_Flags: number,
191
+ m_Version: number,
192
+ m_Flags2: number,
193
+ }//, validate_size=False),
194
+
195
+ // # The code assumes that this has the same in-memory representation as
196
+ // # the Projectile net object.
197
+ interface DDNetProjectile {
198
+ m_X: number,
199
+ m_Y: number,
200
+ m_Angle: number,
201
+ m_Data: number,
202
+ m_Type: number,
203
+ m_StartTick: number,
204
+ }
205
+
206
+ interface DDNetLaser {
207
+ m_ToX: number,
208
+ m_ToY: number,
209
+ m_FromX: number,
210
+ m_FromY: number,
211
+ m_StartTick: number,
212
+ m_Owner: number,
213
+ m_Type: number,
214
+ }
215
+ }
216
+ export type RconCommand = {
217
+ command: string;
218
+ description: string;
219
+ params: string;
220
+ }
221
+ export interface Chunk {
222
+ bytes: number,
223
+ flags: number,
224
+ seq?: number,
225
+ // type: 'sys' | 'game',
226
+ sys: Boolean,
227
+ msgid: number,
228
+ msg: string,
229
+ raw: Buffer,
230
+ extended_msgid?: Buffer;
231
+ }
232
+
233
+ export interface _Packet {
234
+ twprotocol: { flags: number, ack: number, chunkAmount: number, size: number },
235
+ chunks: Chunk[]
236
+ }