@xx_amaba_xx/robloxbot 0.1.0 → 0.3.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 CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Control a Roblox character through the headless RakNet protocol with a working web-transport fallback for joining games, users, servers, and friends — today.
6
6
 
7
- [![npm version](https://img.shields.io/npm/v/robloxbot)](https://www.npmjs.com/package/robloxbot)
7
+ [![npm version](https://img.shields.io/npm/v/@xx_amaba_xx/robloxbot)](https://www.npmjs.com/package/@xx_amaba_xx/robloxbot)
8
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
9
9
 
10
10
  ---
@@ -59,12 +59,7 @@ Control a Roblox character through the headless RakNet protocol with a working w
59
59
  ## Installation
60
60
 
61
61
  ```bash
62
- # Clone
63
- git clone https://github.com/pal3241/Royer.git
64
- cd Royer
65
-
66
- # Install dependencies
67
- npm install
62
+ npm install @xx_amaba_xx/robloxbot
68
63
  ```
69
64
 
70
65
  Requires **Node.js ≥ 18**. Works on Linux, Windows, macOS, and **Termux (Android)**.
@@ -109,7 +104,7 @@ VISION_SERVICE_URL=http://localhost:8000
109
104
  ### `new RobloxBot(options)`
110
105
 
111
106
  ```js
112
- import { RobloxBot } from "./src/index.js";
107
+ import { RobloxBot } from "@xx_amaba_xx/robloxbot";
113
108
 
114
109
  const bot = new RobloxBot({
115
110
  username: process.env.ROBLOX_USERNAME,
@@ -261,6 +256,8 @@ VISION_SERVICE_URL=http://<host>:8000
261
256
 
262
257
  See `vision-service/README.md` for full setup (including Termux notes).
263
258
 
259
+ > **Note:** The vision service is a separate Python/FastAPI project. It's not included in the npm package — clone the repo if you need it.
260
+
264
261
  ### Map detection
265
262
 
266
263
  `vision.map` provides a headless alternative to client-side script injection. A headless RakNet client has no Roblox client process to inject Lua into, so live map injection is impossible. Instead, `MapInject` fetches static place/asset metadata via the Roblox web API:
@@ -292,7 +289,7 @@ robloxbot has a mineflayer-style plugin system. Plugins are JavaScript modules t
292
289
  ### Using a plugin
293
290
 
294
291
  ```js
295
- import { RobloxBot, pathfinding } from "robloxbot";
292
+ import { RobloxBot, pathfinding } from "@xx_amaba_xx/robloxbot";
296
293
 
297
294
  const bot = new RobloxBot({ username, password });
298
295
  await bot.start();
@@ -352,7 +349,7 @@ npm install robloxbot-myplugin
352
349
  Then import and use it:
353
350
 
354
351
  ```js
355
- import { RobloxBot } from "robloxbot";
352
+ import { RobloxBot } from "@xx_amaba_xx/robloxbot";
356
353
  import myPlugin from "robloxbot-myplugin";
357
354
 
358
355
  const bot = new RobloxBot({ username, password });
@@ -366,7 +363,7 @@ A plugin package should export a function or object with `apply(bot, options)`.
366
363
  `src/plugins/pathfinding.js` — grid-based A* pathfinding.
367
364
 
368
365
  ```js
369
- import { pathfinding } from "robloxbot";
366
+ import { pathfinding } from "@xx_amaba_xx/robloxbot";
370
367
 
371
368
  bot.use(pathfinding, { gridSize: 16, diagonalMovement: false });
372
369
 
@@ -404,7 +401,7 @@ Pathfinding methods:
404
401
  `src/plugins/vision-pathfinding.js` — YOLO-guided pathfinding. Uses object detection to spot goals and obstacles, builds a walkability grid, then runs A* to find the distance and route.
405
402
 
406
403
  ```js
407
- import { visionPathfinding } from "robloxbot";
404
+ import { visionPathfinding } from "@xx_amaba_xx/robloxbot";
408
405
 
409
406
  bot.use(visionPathfinding, {
410
407
  gridSize: 32, // grid cells per side
@@ -450,7 +447,7 @@ Methods:
450
447
  `src/plugins/auto-reconnect.js` — automatically reconnects on disconnect with exponential backoff.
451
448
 
452
449
  ```js
453
- import { autoReconnect } from "robloxbot";
450
+ import { autoReconnect } from "@xx_amaba_xx/robloxbot";
454
451
 
455
452
  bot.use(autoReconnect, {
456
453
  maxAttempts: 10,
@@ -471,7 +468,7 @@ Events: `reconnecting`, `reconnected`, `reconnect-error`, `reconnect-failed`
471
468
  `src/plugins/commands.js` — chat command framework with prefix, aliases, and cooldowns.
472
469
 
473
470
  ```js
474
- import { commands } from "robloxbot";
471
+ import { commands } from "@xx_amaba_xx/robloxbot";
475
472
 
476
473
  bot.use(commands, { prefix: "!", cooldownMs: 1000 });
477
474
 
@@ -489,7 +486,7 @@ Methods: `register(name, handler, opts)`, `unregister(name)`, `get(name)`, `pars
489
486
  `src/plugins/macros.js` — record and play back action sequences.
490
487
 
491
488
  ```js
492
- import { macros } from "robloxbot";
489
+ import { macros } from "@xx_amaba_xx/robloxbot";
493
490
 
494
491
  bot.use(macros);
495
492
 
@@ -512,7 +509,7 @@ Methods: `record(name)`, `stop()`, `play(name, opts)`, `remove(name)`, `list()`,
512
509
  `src/plugins/settings.js` — key-value settings with optional persistence.
513
510
 
514
511
  ```js
515
- import { settings } from "robloxbot";
512
+ import { settings } from "@xx_amaba_xx/robloxbot";
516
513
 
517
514
  bot.use(settings, { defaults: { walkspeed: 16, theme: "dark" } });
518
515
 
@@ -531,7 +528,7 @@ Methods: `get(key, fallback)`, `set(key, value)`, `has(key)`, `del(key)`, `all()
531
528
  `src/plugins/entities.js` — entity tracking stub (documented ceiling below).
532
529
 
533
530
  ```js
534
- import { entities } from "robloxbot";
531
+ import { entities } from "@xx_amaba_xx/robloxbot";
535
532
 
536
533
  bot.use(entities);
537
534
 
@@ -549,7 +546,7 @@ bot.entities.count();
549
546
  `src/plugins/inventory.js` — inventory stub (documented ceiling below).
550
547
 
551
548
  ```js
552
- import { inventory } from "robloxbot";
549
+ import { inventory } from "@xx_amaba_xx/robloxbot";
553
550
 
554
551
  bot.use(inventory);
555
552
 
@@ -580,7 +577,7 @@ Two transports implement the same `Transport` ABC:
580
577
  `RobloxClient` defaults to RakNet and auto-falls back to Web when RakNet isn't implemented. You can also inject your own transport:
581
578
 
582
579
  ```js
583
- import { RobloxClient, WebTransport } from "./src/index.js";
580
+ import { RobloxClient, WebTransport } from "@xx_amaba_xx/robloxbot";
584
581
 
585
582
  const client = new RobloxClient({
586
583
  transport: new WebTransport({ cookie: process.env.ROBLOSECURITY }),
@@ -596,7 +593,7 @@ The RakNet skeleton includes `encodePacket()` / `decodePacket()` helpers and fie
596
593
  ### Minimal bot
597
594
 
598
595
  ```js
599
- import { RobloxBot } from "./src/index.js";
596
+ import { RobloxBot } from "@xx_amaba_xx/robloxbot";
600
597
 
601
598
  const bot = new RobloxBot({
602
599
  username: process.env.ROBLOX_USERNAME,
@@ -614,6 +611,8 @@ await bot.stop();
614
611
  ### Join a friend
615
612
 
616
613
  ```js
614
+ import { RobloxBot } from "@xx_amaba_xx/robloxbot";
615
+
617
616
  const bot = new RobloxBot({ username, password });
618
617
  await bot.start();
619
618
 
@@ -627,7 +626,7 @@ await bot.stop();
627
626
  ### With vision service
628
627
 
629
628
  ```js
630
- import { RobloxBot, createVisionService } from "./src/index.js";
629
+ import { RobloxBot, createVisionService } from "@xx_amaba_xx/robloxbot";
631
630
 
632
631
  const bot = new RobloxBot({ username, password });
633
632
  const vision = createVisionService();
@@ -693,16 +692,8 @@ src/
693
692
  constants/
694
693
  keys.js # Keybind constants
695
694
  packets.js # RakNet packet opcode + field skeleton
696
- vision-service/
697
- main.py # FastAPI vision backend (YOLO + VLM)
698
- requirements.txt # Python dependencies
699
- README.md # Vision service setup (incl. Termux notes)
700
- test/
701
- bot.test.js
702
- transport.test.js
703
- vision.test.js
704
- plugins.test.js
705
- plugins-extended.test.js
695
+
696
+ > **Note:** The npm package only includes `src/`. The `vision-service/` and `test/` directories are in the GitHub repo.
706
697
  ```
707
698
 
708
699
  ---
@@ -736,7 +727,6 @@ test/
736
727
 
737
728
  ## Contributing
738
729
 
739
-
740
730
  1. Fork the repo
741
731
  2. Create a feature branch (`git checkout -b feature/your-feature`)
742
732
  3. Commit your changes (`git commit -m "feat: add your feature"`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xx_amaba_xx/robloxbot",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "A mineflayer-style headless Roblox bot library for Node.js/Termux",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -18,9 +18,26 @@
18
18
  "eslint": "^9.0.0",
19
19
  "prettier": "^3.2.0"
20
20
  },
21
- "keywords": ["roblox", "bot", "mineflayer", "headless", "raknet"],
21
+ "keywords": [
22
+ "roblox",
23
+ "bot",
24
+ "mineflayer",
25
+ "headless",
26
+ "raknet"
27
+ ],
22
28
  "license": "MIT",
23
29
  "engines": {
24
30
  "node": ">=18"
31
+ },
32
+ "files": [
33
+ "src"
34
+ ],
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/pal3241/Royer.git"
38
+ },
39
+ "homepage": "https://github.com/pal3241/Royer#readme",
40
+ "bugs": {
41
+ "url": "https://github.com/pal3241/Royer/issues"
25
42
  }
26
43
  }
package/src/bot.js CHANGED
@@ -42,12 +42,8 @@ export class RobloxBot extends RobloxEventEmitter {
42
42
 
43
43
  await this.client.connect();
44
44
 
45
- this.movement = new Movement(this.client.transport, this.character, {
46
- simulationMode: this.options.simulationMode,
47
- });
48
- this.chat = new Chat(this.client.transport, this, {
49
- simulationMode: this.options.simulationMode,
50
- });
45
+ this.movement = new Movement(this.client.transport, this.character);
46
+ this.chat = new Chat(this.client.transport, this);
51
47
  this.game = new GameJoin(this.client.transport);
52
48
 
53
49
  // Auto-create vision service and wire map fetch to the transport.
@@ -80,6 +76,12 @@ export class RobloxBot extends RobloxEventEmitter {
80
76
  }
81
77
 
82
78
  _handlePacket(packet) {
79
+ // Handle new packet format from RakNet transport: { opcode, opcodeName, fields }
80
+ if (packet.opcode !== undefined && packet.fields) {
81
+ this._handleRakNetPacket(packet);
82
+ return;
83
+ }
84
+ // Legacy format (for web transport or backwards compat)
83
85
  switch (packet.type) {
84
86
  case "spawn":
85
87
  this.character.update({ ...packet.data, spawned: true, alive: true });
@@ -102,6 +104,54 @@ export class RobloxBot extends RobloxEventEmitter {
102
104
  }
103
105
  }
104
106
 
107
+ _handleRakNetPacket(packet) {
108
+ const { opcodeName, fields } = packet;
109
+ switch (opcodeName) {
110
+ case "ROBLOX_CHARACTER_SPAWN":
111
+ this.character.update({
112
+ userId: fields.userId,
113
+ username: fields.username,
114
+ position: fields.position,
115
+ health: fields.health,
116
+ maxHealth: fields.maxHealth,
117
+ spawned: true,
118
+ alive: true,
119
+ });
120
+ this.emit("spawn", this.character);
121
+ break;
122
+ case "ROBLOX_CHAT_MESSAGE":
123
+ this.emit("chat", {
124
+ player: fields.username,
125
+ message: fields.message,
126
+ });
127
+ break;
128
+ case "ROBLOX_PLAYER_JOIN":
129
+ this.emit("playerJoin", {
130
+ userId: fields.userId,
131
+ username: fields.username,
132
+ displayName: fields.displayName,
133
+ });
134
+ break;
135
+ case "ROBLOX_PLAYER_LEAVE":
136
+ this.emit("playerLeave", {
137
+ userId: fields.userId,
138
+ reason: fields.reason,
139
+ });
140
+ break;
141
+ case "ROBLOX_MOVEMENT_UPDATE":
142
+ // Update character position if it's our own character
143
+ if (fields.userId === this.character.userId) {
144
+ this.character.position = fields.position;
145
+ }
146
+ this.emit("movement", fields);
147
+ break;
148
+ default:
149
+ // Emit raw packet for plugins to handle
150
+ this.emit("packet:raw", packet);
151
+ break;
152
+ }
153
+ }
154
+
105
155
  async stop() {
106
156
  if (this.client) {
107
157
  await this.client.disconnect();