Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Commit 43edf8f

Browse files
committed
Add TypeScript declaration files
1 parent d8cd05e commit 43edf8f

File tree

9 files changed

+8700
-0
lines changed

9 files changed

+8700
-0
lines changed

dist/classes/Console.d.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/// <reference types="node" />
2+
import EventEmitter from "events";
3+
import { Server } from "./Server.js";
4+
/**
5+
* Object for managing, sending, and receiving messages from the server's console.
6+
*
7+
* Accessable from a `Server` object via `Server.console`.
8+
*
9+
* @class
10+
* @property {object} Server - The Server object this belongs to.
11+
*/
12+
export declare class Console extends EventEmitter {
13+
server: Server;
14+
/**
15+
* @constructor
16+
* @param {object} server - The server this belongs to.
17+
*/
18+
constructor(server: Server);
19+
/**
20+
* Prints a message to the server's console.
21+
* [SourceMod API Reference](https://sm.alliedmods.net/new-api/console/PrintToServer)
22+
*
23+
* @function
24+
* @param {string} message - The message to be printed.
25+
*/
26+
print(message: string): Promise<unknown>;
27+
/**
28+
* Runs a command as if it were executed on the server console (or RCON).
29+
* [SourceMod API Reference](https://sm.alliedmods.net/new-api/console/ServerCommand)
30+
*
31+
* @function
32+
* @param {string} command - The command to be ran.
33+
*/
34+
command(command: string): Promise<unknown>;
35+
}

dist/classes/Player.d.ts

Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
/// <reference types="node" />
2+
import EventEmitter from "events";
3+
import { Players } from "./Players.js";
4+
import { Weapon } from "./Weapon.js";
5+
/**
6+
* Object representing a player currently connected to the server.
7+
* @class
8+
* @property {object} players - The `Players` object this belongs to.
9+
* @property {bool} partial - Whether this object is partial or not. Partial objects are only guaranteed to contain the `id` property.
10+
* @property {number} id - ID of the player.
11+
* @property {string} authid - SteamID of the player.
12+
* @property {string} name - Name of the player.
13+
* @property {string} ip - IP address of the player. (without the port)
14+
* @property {number} health - Amount of health the player has.
15+
* @property {number} gravity - Gravity of the player.
16+
* @property {string} weapon - The current weapon the player has equipped. (Example: `tf_weapon_scattergun`)
17+
* @property {number} kills - Amount of kills the player currently has.
18+
* @property {number} deaths - Amount of deaths the player currently has.
19+
* @property {number} team - Team index of the player. Keep in mind that this is a generic response from the engine and not the game.
20+
* @property {number} connectionTime - The amount of time (in seconds) the player has been connected to the server. Will be 0 if the player is a bot/fake.
21+
* @property {object} render - Rendering information about the player (effects, color, etc).
22+
* @property {object} render.color - Rendering color information
23+
* @property {number} render.color.r - Rendering color (red 0-255)
24+
* @property {number} render.color.g - Rendering color (green 0-255)
25+
* @property {number} render.color.b - Rendering color (blue 0-255)
26+
* @property {number} render.color.a - Rendering color (alpha 0-255)
27+
* @property {number} render.effect - Rendering effect
28+
* @property {number} render.mode - Rendering mode
29+
*/
30+
export declare class Player extends EventEmitter {
31+
players: Players;
32+
partial: boolean;
33+
id: any;
34+
authid: string;
35+
name: string;
36+
ip: string;
37+
health: number;
38+
weapon: string;
39+
gravity: number;
40+
kills: number;
41+
deaths: number;
42+
team: string;
43+
connectionTime: number;
44+
connectionTimeMinutes: number;
45+
render: {
46+
color: {
47+
r: any;
48+
g: any;
49+
b: any;
50+
a: any;
51+
};
52+
effect: any;
53+
mode: any;
54+
};
55+
/**
56+
* @constructor
57+
* @param {Players} players - The `Players` object this belongs to.
58+
* @param {object} data - Player data sent from the server.
59+
* @param {bool} partial - Whether this object is partial or not. Defaults to false.
60+
*/
61+
constructor(players: Players, data: object, partial?: boolean);
62+
/**
63+
* Fetches information about this player from the server. Keep in mind that you must run this function to keep this player up-to-date. Similar to `Players.fetch()`
64+
* @function
65+
* @returns {Object} The new player object with fetched information.
66+
*/
67+
fetch(): Promise<this | undefined>;
68+
/**
69+
* Updates the player with new information from `Player.fetch()`. Used internally.
70+
* @function
71+
* @returns {Object} The new player object with fetched information.
72+
*/
73+
update(data: any): this;
74+
/**
75+
* Kicks a player from the server.
76+
* [SourceMod API Reference](https://sm.alliedmods.net/new-api/clients/KickClient)
77+
*
78+
* @function
79+
* @param {string} reason - The reason for the kick. Cannot exceed 256 bytes.
80+
*/
81+
kick(reason: string): Promise<unknown> | undefined;
82+
/**
83+
* Sends a message to a player's chatbox. Cannot exceed 256 bytes.
84+
* [SourceMod API Reference](https://sm.alliedmods.net/new-api/halflife/PrintToChat)
85+
*
86+
* @function
87+
* @param {string} message - The message to send.
88+
*/
89+
chat(message: string): Promise<unknown> | undefined;
90+
/**
91+
* Sends a message to a player's hint box. Cannot exceed 256 bytes.
92+
* [SourceMod API Reference](https://sm.alliedmods.net/new-api/halflife/PrintHintText)
93+
*
94+
* @function
95+
* @param {string} message - The message to send.
96+
*/
97+
hint(message: string): Promise<unknown> | undefined;
98+
/**
99+
* Sends a message to a player's center hint box. Cannot exceed 256 bytes.
100+
* [SourceMod API Reference](https://sm.alliedmods.net/new-api/halflife/PrintCenterText)
101+
*
102+
* @function
103+
* @param {string} message - The message to send.
104+
*/
105+
centerHint(message: string): Promise<unknown> | undefined;
106+
/**
107+
* Plays a sound. The file path must be a game sound from `scripts/game_sound.txt` or `sound_misc_dir.vpk`. Cannot exceed 256 bytes.
108+
* [SourceMod API Reference](https://sm.alliedmods.net/new-api/sdktools_sound/EmitGameSoundToClient)
109+
*
110+
* @function
111+
* @param {string} path - File path to the sound
112+
*/
113+
playSound(path: string): Promise<unknown> | undefined;
114+
/**
115+
* Teleports a player to another player.
116+
* [SourceMod API Reference](https://sm.alliedmods.net/new-api/sdktools_functions/TeleportEntity)
117+
*
118+
* @function
119+
* @param {Player} player - The player to teleport to.
120+
*/
121+
teleport(player: Player): Promise<unknown> | undefined;
122+
/**
123+
* Slaps the player, with an optional amount of damage.
124+
* [SourceMod API Reference](https://sm.alliedmods.net/new-api/sdktools_functions/SlapPlayer)
125+
*
126+
* @function
127+
* @param {number} damage - The amount of damage to deal. Defaults to 0.
128+
*/
129+
slap(damage: number): Promise<unknown> | undefined;
130+
/**
131+
* Updates the player's rendering, such as the color and render effects/modes. Every argument is optional, and won't change the value if not provided.
132+
* [SourceMod API Reference (SetEntityRenderColor)](https://sm.alliedmods.net/new-api/entity_prop_stocks/SetEntityRenderColor)
133+
* [SourceMod API Reference (SetEntityRenderFx)](https://sm.alliedmods.net/new-api/entity_prop_stocks/SetEntityRenderFx)
134+
* [SourceMod API Reference (SetEntityRenderMode)](https://sm.alliedmods.net/new-api/entity_prop_stocks/SetEntityRenderMode)
135+
*
136+
* @function
137+
* @param {number} r - Rendering color (red 0-255)
138+
* @param {number} g - Rendering color (green 0-255)
139+
* @param {number} b - Rendering color (blue 0-255)
140+
* @param {number} a - Rendering color (alpha 0-255)
141+
* @param {number} effect - Rendering effect
142+
* @param {number} mode - Rendering mode
143+
*/
144+
setRendering(r: number, g: number, b: number, a: number, effect: number, mode: number): Promise<unknown> | undefined;
145+
/**
146+
* Resets the player's rendering color/effect/mode.
147+
* [SourceMod API Reference (SetEntityRenderColor)](https://sm.alliedmods.net/new-api/entity_prop_stocks/SetEntityRenderColor)
148+
* [SourceMod API Reference (SetEntityRenderFx)](https://sm.alliedmods.net/new-api/entity_prop_stocks/SetEntityRenderFx)
149+
* [SourceMod API Reference (SetEntityRenderMode)](https://sm.alliedmods.net/new-api/entity_prop_stocks/SetEntityRenderMode)
150+
*
151+
* @function
152+
*/
153+
resetRendering(): Promise<unknown> | undefined;
154+
/**
155+
* Regenerates a player's health and ammo. Team Fortress 2 only!
156+
* [SourceMod API Reference](https://sm.alliedmods.net/new-api/tf2/TF2_RegeneratePlayer)
157+
*
158+
* @function Player#regenerate
159+
*/
160+
regenerate(): Promise<unknown> | undefined;
161+
/**
162+
* Gives a player a weapon with custom stats. Team Fortress 2 only! Requires [TF2Items](https://forums.alliedmods.net/showthread.php?t=115100).
163+
*
164+
* @param {Weapon} weapon - The weapon object to give.
165+
* @function Player#giveWeapon
166+
*/
167+
giveWeapon(weapon: Weapon): Promise<unknown> | undefined;
168+
/**
169+
* Adds a condition to a player. Team Fortress 2 only.
170+
* [SourceMod API Reference](https://sm.alliedmods.net/new-api/tf2/TF2_AddCondition)
171+
*
172+
* @param {Condition} condition
173+
* @param {number} duration - How long to apply the condition for.
174+
*/
175+
applyCondition(condition: Condition, duration?: number): Promise<unknown> | undefined;
176+
}
177+
export declare type Condition = typeof Condition[keyof typeof Condition];
178+
/**
179+
* Enum describing conditions that can be applied to a player. Team Fortress 2 only! [SourceMod API Reference](https://sm.alliedmods.net/new-api/tf2/TFCond)
180+
*
181+
* Keep in mind that applying some of these won't do anything. Checking for them or removing them from a player would be more useful.
182+
*
183+
* @readonly
184+
* @enum {number} Condition
185+
*
186+
*/
187+
export declare const Condition: {
188+
Slowed: number;
189+
Zoomed: number;
190+
Disguising: number;
191+
Disguised: number;
192+
Cloaked: number;
193+
Ubercharged: number;
194+
TeleportGlow: number;
195+
Taunting: number;
196+
UberchargeFading: number;
197+
CloakFlicker: number;
198+
Teleporting: number;
199+
Kritzkrieged: number;
200+
DeadRingered: number;
201+
Bonked: number;
202+
Dazed: number;
203+
BuffBanner: number;
204+
DemoknightCharging: number;
205+
EyelanderEyeGlow: number;
206+
CritACola: number;
207+
InHealRadius: number;
208+
Healing: number;
209+
OnFire: number;
210+
Overhealed: number;
211+
Jarated: number;
212+
Bleeding: number;
213+
BattalionsBackup: number;
214+
MadMilk: number;
215+
QuickFix: number;
216+
Concheror: number;
217+
MarkedForDeath: number;
218+
NoHealingDamageBuff: number;
219+
DisciplinaryActionSpeed: number;
220+
HalloweenCritPumpkin: number;
221+
CritCanteen: number;
222+
CritDemoCharge: number;
223+
SodaPopperHype: number;
224+
ArenaFirstBlood: number;
225+
CritOnWin: number;
226+
CritOnFlagCapture: number;
227+
CritOnKill: number;
228+
RestrictToMelee: number;
229+
DefenseBuffNoCritBlock: number;
230+
PhlogistinatorCritMmmph: number;
231+
PhlogistinatorDefenseMmmph: number;
232+
HitmansHeatmakerFocus: number;
233+
EnforcerDisguiseRemoved: number;
234+
MarkedForDeathSilent: number;
235+
DisguisedAsDispenser: number;
236+
UberchargeCanteen: number;
237+
HalloweenBombHead: number;
238+
HalloweenForcedThrillerTaunt: number;
239+
RadiusHealing: number;
240+
CritOnDamage: number;
241+
UberOnDamage: number;
242+
VaccinatorUberBullet: number;
243+
VaccinatorUberBlast: number;
244+
VaccinatorUberFire: number;
245+
VaccinatorHealBullet: number;
246+
VaccinatorHealBlast: number;
247+
VaccinatorHealFire: number;
248+
BulletImmunity: number;
249+
BlastImmunity: number;
250+
FireImmunity: number;
251+
Buddha: number;
252+
HalloweenSpeedboost: number;
253+
HalloweenQuickheal: number;
254+
Giant: number;
255+
Tiny: number;
256+
HalloweenInHell: number;
257+
HalloweenGhost: number;
258+
MiniCritOnKill: number;
259+
BASEJumperParachute: number;
260+
BlastJumping: number;
261+
HalloweenKart: number;
262+
HalloweenKartDash: number;
263+
BalloonHead: number;
264+
MeleeOnly: number;
265+
SwimmingCurse: number;
266+
HalloweenKartNoTurn: number;
267+
HalloweenKartCage: number;
268+
Powerup: number;
269+
Powerup_Strength: number;
270+
Powerup_Haste: number;
271+
Powerup_Regeneration: number;
272+
Powerup_Resistance: number;
273+
Powerup_Vampire: number;
274+
Powerup_Reflect: number;
275+
Powerup_Precision: number;
276+
Powerup_Agility: number;
277+
GrapplingHook: number;
278+
GrapplingHookSafeFall: number;
279+
GrapplingHookLatched: number;
280+
GrapplingHookBleeding: number;
281+
DeadRingerAfterburnImmunity: number;
282+
Powerup_Knockout: number;
283+
Powerup_Imbalance: number;
284+
Powerup_Crit: number;
285+
PasstimeInterception: number;
286+
EscapedUnderworld: number;
287+
Powerup_King: number;
288+
Powerup_Plague: number;
289+
Powerup_Supernova: number;
290+
Powerup_Plague_Effect: number;
291+
Powerup_King_Effect: number;
292+
SpawnOutline: number;
293+
Airblasted: number;
294+
CompetitiveWinner: number;
295+
CompetitiveLoser: number;
296+
HealingDebuff: number;
297+
PasstimePenaltyDebuff: number;
298+
GrappledToPlayer: number;
299+
BASEJumperParachuteDeployed: number;
300+
GasPasser: number;
301+
DragonsFuryAfterburn: number;
302+
ThermalThrusterLaunched: number;
303+
LostFooting: number;
304+
ReducedAirControl: number;
305+
HalloweenHellHeal: number;
306+
Powerup_Dominant: number;
307+
};

0 commit comments

Comments
 (0)