Lewati ke konten utama

Bots

Per-bot REST routes. Segment :id map ke argumen id dispatcher — identifier yang sama yang muncul di list bot dashboard (bot-1, bot-2, …).

MethodPathBody
GET/api/bots
GET/api/bots/{id}
POST/api/bots/{id}/connect
POST/api/bots/{id}/disconnect
POST/api/bots/{id}/warp{world}
POST/api/bots/{id}/leave
POST/api/bots/{id}/walk_to{x, y}
GET/api/bots/{id}/collectables
GET/api/bots/{id}/enemies
GET/api/bots/{id}/minimap
POST/api/bots/{id}/tutorial

Semua endpoint butuh header bearer. Response share envelope {"error": "..."} waktu gagal.

GET /api/bots

List semua bot yang udah di-spawn dengan snapshot lite (gak ada isi inventory, gak ada full tile grid world) jadi response-nya tetap di bawah beberapa KB.

Response (200):

{
"bots": [
{
"id": "bot-1",
"status": "in_world",
"device_id": "ae7b7219cfb72594",
"current_host": "game-lava.pixelworlds.pw",
"current_port": 10001,
"current_world": "MINEWORLD",
"pending_world": null,
"username": "P71710199",
"user_id": "69fd4201a4fa2bc68c51dc27",
"player_position": { "map_x": 42.0, "map_y": 18.0,
"world_x": 13.44, "world_y": 5.76 },
"inventory_count": 18,
"gems": 1250,
"byte_coins": 180,
"xp_amount": 420,
"experience": 1200,
"xp_level": 3,
"slots": 32,
"tutorial_state": 7,
"tutorial_running": false,
"ping_ms": 47,
"proxy_name": null,
"proxy_kind": null,
"connected_since": 1778205616123,
"fishing_active": false,
"fishing_info": null,
"last_error": null
}
]
}

status salah satu dari: connecting, authenticating, menu_ready, joining_world, loading_world, awaiting_ready, in_world, redirecting, reconnecting, disconnected, already_connected, banned, kicked, error.

GET /api/bots/{id}

Snapshot lengkap untuk satu bot, termasuk list inventory dan tile counts world.

Response (200): semua field dari snapshot list di atas, plus:

{
"world": {
"world_name": "MINEWORLD",
"width": 100,
"height": 60,
"spawn_map_x": 50.0,
"spawn_map_y": 30.0,
"spawn_world_x": 16.0,
"spawn_world_y": 9.6,
"collectables_count": 12,
"world_items_count": 48,
"tile_counts": [
{ "tile_id": 8, "count": 412 },
{ "tile_id": 14, "count": 96 }
]
},
"inventory": [
{
"block_id": 1041,
"inventory_type": 49,
"amount": 1,
"name": "WeaponPickaxeBasic",
"category": "tool"
}
],
"tutorial_stage": null,
"sf_token": "<JWT>"
}

POST /api/bots/{id}/connect

Resume bot yang udah dibuat sebelumnya. Re-jalanin chain auth (PlayFab + sclfrst), lalu buka socket TCP.

Response (200):

{ "ok": true }

Error (200, body): kalau auth gagal Seraph tetep return 200 tapi failure-nya keluar di snapshot bot — poll GET /api/bots/{id} dan baca status + last_error. Failure yang fatal beneran (credentials salah, license invalid) balik sebagai 500 dengan string error verbatim.

POST /api/bots/{id}/disconnect

Drop socket TCP dengan rapi. Kirim DD ke server dulu jadi session ledger lepasin slot-nya.

Response (200): { "ok": true }

POST /api/bots/{id}/warp

Join world dengan nama itu. Burst wire yang sama dengan client real (MWliTTjWGw + ActionEvents + GSb + ST). Redirect OoIP di-follow otomatis.

Body:

{ "world": "MINEWORLD" }

Response (200): { "ok": true } — bot transition lewat joining_worldloading_worldawaiting_readyin_world. Watch event stream atau poll snapshot buat tau pas dia udah settle.

POST /api/bots/{id}/leave

Kirim LW (LeaveWorld) dan balik ke status menu_ready.

Response (200): { "ok": true }

POST /api/bots/{id}/walk_to

Plan path lewat tile graph world saat ini dan jalan ke tile target. Kirim burst movement mp + mP; tunggu echo position-update server sebelum return.

Body:

{ "x": 42, "y": 18 }

Response (200): { "ok": true }

GET /api/bots/{id}/collectables

List live drop item di range render bot.

Response (200):

{
"collectables": [
{
"id": 12,
"block_type": 1041,
"amount": 1,
"inventory_type": 49,
"pos_x": 13.44,
"pos_y": 5.76,
"is_gem": false
}
]
}

GET /api/bots/{id}/enemies

Entitas AI / mob yang keliatan oleh bot.

Response (200):

{
"enemies": [
{
"ai_id": 17,
"x": 41,
"y": 28,
"ai_kind": "Spider",
"hp": 80,
"max_hp": 100
}
]
}

GET /api/bots/{id}/minimap

Representasi compact dari layer foreground / background / water / wiring world — setiap tile id sebagai array flat dengan panjang width * height. Berguna buat render overlay atau feed pathfinder.

Response (200):

{
"width": 100,
"height": 60,
"foreground_tiles": [0, 0, 8, 14, 0, ...],
"background_tiles": [0, 0, 0, 0, 12, ...],
"water_tiles": [0, 0, 0, ...],
"wiring_tiles": [0, 0, 0, ...],
"player_position": { "map_x": 42.0, "map_y": 18.0,
"world_x": 13.44, "world_y": 5.76 },
"other_players": [
{
"user_id": "69fd4201a4fa2bc68c51dc27",
"nick": "Devastres22",
"position": { "map_x": 50.0, "map_y": 30.0,
"world_x": 16.0, "world_y": 9.6 }
}
]
}

POST /api/bots/{id}/tutorial

Kick off flow automation Rust canonical (TUTORIAL2 join → CharC → spawn pods → exit ke PIXELSTATION). Pake ini di akun yang baru dibuat buat landing-in ke world post-tutorial tanpa nulis Lua glue.

Response (200): { "ok": true } — flag tutorial_running bot flip ke true. Watch tutorial_stage di snapshot buat progress yang readable ("character creation", "spawn pod walk", …).