isle-evrima-rcon 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MENIX (https://github.com/menix1337)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,341 @@
1
+ # isle-evrima-rcon
2
+
3
+ [![npm version](https://img.shields.io/npm/v/isle-evrima-rcon.svg)](https://www.npmjs.com/package/isle-evrima-rcon)
4
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+
7
+ A high-performance, type-safe RCON client for **The Isle: Evrima** game servers.
8
+
9
+ Built for production use with automatic reconnection, exponential backoff, and multi-server support.
10
+
11
+ > **Note:** This library only supports The Isle: Evrima. Legacy does not have RCON support.
12
+
13
+ ## ⚠️ Disclaimer
14
+
15
+ **Official documentation for Evrima's RCON protocol is extremely limited.** This library has been built through community efforts, reverse-engineering, and trial-and-error testing.
16
+
17
+ As a result:
18
+ - Some commands may not work as expected or may change with game updates
19
+ - Response formats may vary between server versions
20
+ - Undocumented behavior may occur
21
+ - New commands may be added or existing ones modified without notice
22
+
23
+ If you encounter issues, please [open an issue](https://github.com/menix1337/isle-evrima-rcon/issues) with details about your server version and the unexpected behavior. Community contributions and discoveries are always welcome!
24
+
25
+ ## Features
26
+
27
+ - 🚀 **High Performance** — Persistent connections, reusable for thousands of commands
28
+ - 🔄 **Auto-Reconnect** — Automatic reconnection with exponential backoff
29
+ - 🔒 **Type-Safe** — Full TypeScript support with strict type checking
30
+ - 🏢 **Multi-Server** — Manage multiple game servers with named instances
31
+ - ✅ **Validated** — Zod schemas for configuration validation
32
+ - 📦 **Zero Config** — Sensible defaults, works out of the box
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ # npm
38
+ npm install isle-evrima-rcon
39
+
40
+ # bun
41
+ bun add isle-evrima-rcon
42
+
43
+ # yarn
44
+ yarn add isle-evrima-rcon
45
+
46
+ # pnpm
47
+ pnpm add isle-evrima-rcon
48
+ ```
49
+
50
+ ## Quick Start
51
+
52
+ ### One-Shot Command
53
+
54
+ Use the `rcon()` helper for single commands — it handles the connection lifecycle automatically:
55
+
56
+ ```typescript
57
+ import { rcon } from 'isle-evrima-rcon';
58
+
59
+ const result = await rcon({
60
+ host: { ip: '192.168.1.100', port: 8888, password: 'your-password' },
61
+ command: { name: 'players' }
62
+ });
63
+
64
+ console.log(result.data);
65
+ ```
66
+
67
+ ### Persistent Connection
68
+
69
+ For multiple commands, use `EvrimaRCON` to maintain a persistent connection:
70
+
71
+ ```typescript
72
+ import { EvrimaRCON } from 'isle-evrima-rcon';
73
+
74
+ const client = new EvrimaRCON('192.168.1.100', 8888, 'your-password', {
75
+ autoReconnect: true,
76
+ name: 'main-server' // Shows in debug logs
77
+ });
78
+
79
+ await client.connect();
80
+
81
+ // Server announcements
82
+ await client.announce('Welcome to the server!');
83
+
84
+ // Player management
85
+ const players = await client.getPlayers();
86
+ console.log(`Online: ${players.length} players`);
87
+
88
+ await client.kick({ steamId: '76561197960419839', reason: 'AFK too long' });
89
+ await client.ban({ steamId: '76561197960419839', reason: 'Rule violation' });
90
+
91
+ // When done
92
+ client.disconnect();
93
+ ```
94
+
95
+ ### Multi-Server Management
96
+
97
+ Each `EvrimaRCON` instance is independent — manage multiple servers simultaneously:
98
+
99
+ ```typescript
100
+ import { EvrimaRCON } from 'isle-evrima-rcon';
101
+
102
+ // Create separate clients for each server
103
+ const server1 = new EvrimaRCON('192.168.1.100', 8888, 'password1', {
104
+ autoReconnect: true,
105
+ name: 'US-West-1'
106
+ });
107
+
108
+ const server2 = new EvrimaRCON('192.168.1.101', 8888, 'password2', {
109
+ autoReconnect: true,
110
+ name: 'EU-Central-1'
111
+ });
112
+
113
+ // Connect to all servers
114
+ await Promise.all([server1.connect(), server2.connect()]);
115
+
116
+ // Each server operates independently
117
+ await server1.announce('US West maintenance in 10 minutes');
118
+ await server2.announce('EU Central server rules updated');
119
+
120
+ // Reconnection is handled per-server automatically
121
+ ```
122
+
123
+ ## Configuration
124
+
125
+ ```typescript
126
+ const client = new EvrimaRCON(host, port, password, {
127
+ // Connection timeout in milliseconds
128
+ timeout: 10000, // default: 10000 (10s)
129
+
130
+ // Automatically reconnect if connection drops
131
+ autoReconnect: true, // default: false
132
+
133
+ // Maximum reconnection attempts before giving up
134
+ maxReconnectAttempts: 5, // default: 3
135
+
136
+ // Base delay between reconnect attempts (uses exponential backoff)
137
+ // Actual delays: 1s → 2s → 4s → 8s → ... (capped at 30s)
138
+ reconnectDelay: 1000, // default: 1000 (1s)
139
+
140
+ // Enable debug logging to console
141
+ debug: true, // default: false
142
+
143
+ // Server name for log identification (useful for multi-server setups)
144
+ name: 'my-server' // default: "host:port"
145
+ });
146
+ ```
147
+
148
+ ### Connection Resilience
149
+
150
+ When `autoReconnect` is enabled:
151
+
152
+ 1. **Automatic Recovery** — If the connection drops, the client automatically reconnects
153
+ 2. **Exponential Backoff** — Retry delays increase progressively (1s → 2s → 4s → 8s...) to avoid overwhelming the server
154
+ 3. **Command Retry** — Commands sent during a disconnect will auto-retry after reconnection
155
+ 4. **Max Attempts** — After `maxReconnectAttempts` failures, errors are thrown for handling
156
+
157
+ ## API Reference
158
+
159
+ > **Note:** Due to limited official documentation, some commands may have undocumented parameters or behaviors. Methods marked with uncertain documentation are based on community research.
160
+
161
+ ### Server Management
162
+
163
+ | Method | Description |
164
+ |--------|-------------|
165
+ | `announce(message)` | Broadcast message to all players |
166
+ | `directMessage({ steamId, message })` | Send private message to a player |
167
+ | `getServerDetails()` | Get server info (returns `ServerDetails`) |
168
+ | `getPlayables()` | Get list of available playable dinosaurs |
169
+ | `updatePlayables(config)` | Update playable dinosaur configuration |
170
+ | `wipeCorpses()` | Clear all corpses from the map |
171
+ | `save(name?)` | Save the world state |
172
+ | `setPaused(paused)` | Pause/unpause the server |
173
+ | `setMigrations(enabled)` | Toggle dinosaur migrations |
174
+
175
+ ### Player Management
176
+
177
+ | Method | Description |
178
+ |--------|-------------|
179
+ | `getPlayers()` | Get online players with SteamId, Name, EOSId |
180
+ | `getPlayerData(steamId?)` | Get detailed player data (mutations, prime status) |
181
+ | `ban({ steamId, reason? })` | Ban a player |
182
+ | `kick({ steamId, reason? })` | Kick a player |
183
+
184
+ ### Growth & Network
185
+
186
+ | Method | Description |
187
+ |--------|-------------|
188
+ | `setGrowthMultiplier(enabled)` | Toggle growth multiplier feature |
189
+ | `setGrowthMultiplierValue(multiplier)` | Set growth multiplier value (e.g., 1.5) |
190
+ | `setNetUpdateDistanceChecks(enabled)` | Toggle network update distance checks |
191
+
192
+ ### Whitelist
193
+
194
+ | Method | Description |
195
+ |--------|-------------|
196
+ | `setWhitelist(enabled)` | Toggle whitelist on/off |
197
+ | `whitelistAdd(steamId)` | Add player to whitelist |
198
+ | `whitelistRemove(steamId)` | Remove player from whitelist |
199
+
200
+ ### Game Settings
201
+
202
+ | Method | Description |
203
+ |--------|-------------|
204
+ | `setGlobalChat(enabled)` | Toggle global chat |
205
+ | `setHumans(enabled)` | Toggle human characters |
206
+
207
+ ### AI Controls
208
+
209
+ | Method | Description |
210
+ |--------|-------------|
211
+ | `setAI(enabled)` | Toggle AI spawning |
212
+ | `disableAIClasses(classes)` | Disable specific AI types |
213
+ | `setAIDensity(0.0-1.0)` | Set AI spawn density |
214
+ | `setAILearning(enabled)` | Toggle AI learning behavior |
215
+ | `getQueueStatus()` | Get server queue status |
216
+
217
+ ### Low-Level Commands
218
+
219
+ | Method | Description |
220
+ |--------|-------------|
221
+ | `sendCommand(command, params?)` | Execute any RCON command |
222
+ | `batch(commands)` | Execute multiple commands in sequence |
223
+ | `custom(commandString)` | Send custom command (may not be functional) |
224
+
225
+ ### Batch Execution
226
+
227
+ Execute multiple commands efficiently:
228
+
229
+ ```typescript
230
+ const results = await client.batch([
231
+ { command: 'announce', params: 'Server restart in 5 minutes' },
232
+ { command: 'save' },
233
+ { command: 'announce', params: 'Save complete!' }
234
+ ]);
235
+ ```
236
+
237
+ ## Error Handling
238
+
239
+ ```typescript
240
+ import { EvrimaRCON, RCONError, RCONErrorCode } from 'isle-evrima-rcon';
241
+
242
+ try {
243
+ await client.connect();
244
+ await client.announce('Hello!');
245
+ } catch (error) {
246
+ if (error instanceof RCONError) {
247
+ switch (error.code) {
248
+ case RCONErrorCode.CONNECTION_FAILED:
249
+ console.error('Server unreachable:', error.message);
250
+ break;
251
+ case RCONErrorCode.AUTH_FAILED:
252
+ console.error('Invalid RCON password');
253
+ break;
254
+ case RCONErrorCode.TIMEOUT:
255
+ console.error('Connection timed out');
256
+ break;
257
+ case RCONErrorCode.NOT_CONNECTED:
258
+ console.error('Client not connected');
259
+ break;
260
+ case RCONErrorCode.INVALID_COMMAND:
261
+ console.error('Invalid command:', error.message);
262
+ break;
263
+ }
264
+ }
265
+ }
266
+ ```
267
+
268
+ ## Validation Utilities
269
+
270
+ Built-in validators for Steam IDs and configuration:
271
+
272
+ ```typescript
273
+ import { isValidSteamId, validateServerConfig, validateClientOptions } from 'isle-evrima-rcon';
274
+
275
+ // Validate Steam ID format
276
+ if (isValidSteamId('76561197960419839')) {
277
+ await client.whitelistAdd('76561197960419839');
278
+ }
279
+
280
+ // Validate server config (throws on invalid)
281
+ const config = validateServerConfig({
282
+ ip: '192.168.1.100',
283
+ port: 8888,
284
+ password: 'secret'
285
+ });
286
+
287
+ // Validate client options with defaults applied
288
+ const options = validateClientOptions({
289
+ timeout: 5000,
290
+ autoReconnect: true
291
+ });
292
+ ```
293
+
294
+ ## TypeScript Support
295
+
296
+ Full type definitions with strict checking:
297
+
298
+ ```typescript
299
+ import type {
300
+ Command,
301
+ CommandResult,
302
+ PlayerInfo,
303
+ PlayerData,
304
+ ServerDetails,
305
+ ServerConfig,
306
+ ClientOptions,
307
+ BanParams,
308
+ KickParams,
309
+ DirectMessageParams,
310
+ ConnectionState,
311
+ RCONErrorCode
312
+ } from 'isle-evrima-rcon';
313
+
314
+ // All convenience methods are fully typed
315
+ const players: PlayerInfo[] = await client.getPlayers();
316
+ // Players now include EOS ID: { steamId, name, eosId }
317
+
318
+ const playerData: PlayerData = await client.getPlayerData();
319
+ // Includes mutations, prime status, character info
320
+
321
+ const details: ServerDetails = await client.getServerDetails();
322
+ ```
323
+
324
+ ## Requirements
325
+
326
+ - **Bun** >= 1.0.0 or **Node.js** >= 18.0.0
327
+ - **TypeScript** >= 5.0.0 (peer dependency)
328
+ - The Isle: Evrima server with RCON enabled
329
+
330
+ ## Contributing
331
+
332
+ Contributions are welcome! Please feel free to submit issues and pull requests.
333
+
334
+ ## Credits
335
+
336
+ Originally inspired by [smultar-dev/evrima.rcon](https://github.com/smultar-dev/evrima.rcon).
337
+ Refactored, extended, and maintained by [MENIX](https://github.com/menix1337).
338
+
339
+ ## License
340
+
341
+ [MIT](LICENSE) © 2026 MENIX
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "isle-evrima-rcon",
3
+ "version": "1.0.0",
4
+ "description": "High-performance, type-safe TypeScript RCON client for The Isle: Evrima game servers with auto-reconnect and connection pooling",
5
+ "author": "MENIX <https://github.com/menix1337>",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "./src/index.ts",
9
+ "module": "./src/index.ts",
10
+ "types": "./src/index.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./src/index.ts",
14
+ "types": "./src/index.ts"
15
+ },
16
+ "./client": {
17
+ "import": "./src/client.ts",
18
+ "types": "./src/client.ts"
19
+ },
20
+ "./commands": {
21
+ "import": "./src/commands.ts",
22
+ "types": "./src/commands.ts"
23
+ },
24
+ "./protocol": {
25
+ "import": "./src/protocol.ts",
26
+ "types": "./src/protocol.ts"
27
+ },
28
+ "./types": {
29
+ "import": "./src/types.ts",
30
+ "types": "./src/types.ts"
31
+ },
32
+ "./validation": {
33
+ "import": "./src/validation.ts",
34
+ "types": "./src/validation.ts"
35
+ }
36
+ },
37
+ "files": [
38
+ "src",
39
+ "LICENSE",
40
+ "README.md"
41
+ ],
42
+ "scripts": {
43
+ "test": "bun test",
44
+ "test:watch": "bun test --watch",
45
+ "test:coverage": "bun test --coverage",
46
+ "typecheck": "tsc --noEmit",
47
+ "format": "prettier --write .",
48
+ "prepublishOnly": "bun run typecheck"
49
+ },
50
+ "keywords": [
51
+ "rcon",
52
+ "the-isle",
53
+ "the-isle-rcon",
54
+ "isle",
55
+ "isle-rcon",
56
+ "evrima",
57
+ "evrima-rcon",
58
+ "the-isle-evrima",
59
+ "game-server",
60
+ "game-server-rcon",
61
+ "dinosaur",
62
+ "dinosaur-game",
63
+ "typescript",
64
+ "bun",
65
+ "remote-console",
66
+ "server-admin",
67
+ "server-management"
68
+ ],
69
+ "repository": {
70
+ "type": "git",
71
+ "url": "git+https://github.com/menix1337/isle-evrima-rcon.git"
72
+ },
73
+ "homepage": "https://github.com/menix1337/isle-evrima-rcon#readme",
74
+ "bugs": {
75
+ "url": "https://github.com/menix1337/isle-evrima-rcon/issues"
76
+ },
77
+ "engines": {
78
+ "bun": ">=1.0.0",
79
+ "node": ">=18.0.0"
80
+ },
81
+ "devDependencies": {
82
+ "@types/bun": "^1.3.6",
83
+ "prettier": "^3.8.0"
84
+ },
85
+ "peerDependencies": {
86
+ "typescript": "^5.0.0"
87
+ },
88
+ "dependencies": {
89
+ "zod": "^3.25.76"
90
+ }
91
+ }