Aller au contenu
Afficher dans l'application

Une meilleure façon de naviguer. En savoir plus.

Asterobot

Une application plein écran sur votre écran d'accueil avec notifications push, badges et plus encore.

Pour installer cette application sur iOS et iPadOS
  1. Appuyez sur Icône de partage dans Safari
  2. Faites défiler le menu et appuyez sur Ajouter à l'écran d'accueil.
  3. Appuyez sur Ajouter dans le coin supérieur droit.
Pour installer cette application sur Android
  1. Appuyez sur le menu à trois points (⋮) dans le coin supérieur droit du navigateur.
  2. Appuyez sur Ajouter à l'écran d'accueil ou Installer l'application.
  3. Confirmez en appuyant sur Installer.

asterobot:movement

(0 notes)

asterobot:movement walks the bot's character. Its one function, move(), walks the character to a cell of the map it stands on and resolves once the walk is over. The same call works on a Full socket bot and on a MITM bot (man-in-the-middle: the bot relays the game session of a Dofus client that someone plays).

import { move } from "asterobot:movement";

This is the module's only export.

move()

move(cell, options?) returns Promise<number>.

Parameter Type Description
cell number The cell to walk to, a whole number from 0 to 559
options.cautious boolean Walk instead of running, whatever the distance. Default false.
options.timeout number How many milliseconds the server gets to grant the walk, and then to acknowledge its end once the walk is over. Default 5000.

It resolves with the cell the character stands on, once the server has acknowledged the end of the walk.

try {
  const cell = await move(301);
  botInfo("Standing on cell", cell);
} catch (error) {
  botWarn("Couldn't walk:", String(error));
}

How it walks

  1. It reads where the character and the other actors stand, as currentMap() does, and plans the route to cell the way findPath() does, around every other actor. When cell can't be reached, the route ends on the reachable cell closest to it. When there's nowhere to walk, move() resolves right away with the character's cell and sends nothing.
  2. It sends MapMovementRequest and waits for the server's MapMovementEvent granting the walk.
  3. On a Full socket bot, it waits as long as the Dofus client takes to walk the cells the server granted, then sends MapMovementConfirmRequest. On a MITM bot it sends nothing more: the Dofus client walks the character on screen and confirms the walk itself.
  4. It resolves when the server answers with MapMovementConfirmResponse.

When the server grants a shorter walk than the one asked for, move() times the walk the server granted and resolves with the cell where it ends. On a Full socket bot the confirmation leaves as early as a Dofus client could send it. The path explains how that time is found, and why it can be wrong for a mounted character.

One walk at a time

A bot walks one walk at a time, whoever asks for it. While a walk is under way, a second move() rejects at once and sends nothing, and so does a walk started with Walk here on the bot's map in Asteroboard. Await each move() before starting the next.

move() also refuses to start while the character is still walking a walk it didn't ask for, such as one the player started on a MITM bot. That walk counts until the server acknowledges its end, or for one second at most past the time the Dofus client takes to walk it.

The walk belongs to the bot, not to your script. If the script stops during a walk, the promise of move() rejects with the reason the script stopped, and the walk still ends and is confirmed, so the server doesn't keep the character walking.

Doing something else during the walk

move() doesn't hold up the rest of your script. Other code keeps running while the character walks, and on a Full socket bot the confirmation still leaves on time. To send a chat message while walking, start both together:

const [cell] = await Promise.all([
  move(301),
  send("ChatChannelMessageRequest", { channel: "GLOBAL", content: "Hello" }),
]);

Don't keep the promise of move() in a variable to await later. If it rejects before your code reaches the await, nothing catches it and the script stops with unhandled Promise rejection:. Await it, put it in a Promise.all, or give it a .catch().

Until the end of the walk is acknowledged, the server considers the character still walking. Wait for move() to resolve before an action that needs the character standing, such as using an element of the map.

Errors

A mistake in the arguments rejects the promise with a TypeError, and nothing is sent:

Error Cause
movement.move cell must be an integer cell id cell isn't a whole number in the 32-bit range, or is a BigInt or a string
movement.move cell: pathfinding: not a map cell, cell ids go from 0 to 559 cell is outside 0 to 559
movement.move options must be an object options is set, not to null or undefined, and isn't an object
movement.move options has no property "<name>" options has a key other than cautious and timeout
movement.move options.cautious must be a boolean cautious is set to something other than true, false, null or undefined
movement.move options.timeout: timeout/milliseconds must be a finite positive Number timeout isn't a number above 0

A walk that is refused or fails rejects it with an error whose message is one of these texts:

Text Cause
move: the bot isn't connected to a game server The bot has no game connection. Nothing is sent.
move: the character is already walking; await the move in progress first Another walk of the bot is under way, from a script or from Asteroboard. Nothing is sent.
move: the character is still walking The character hasn't finished a walk it didn't ask for. Nothing is sent.
move: the character's map and cell aren't known yet Asterobot hasn't seen the character's map yet, or where the map places the character, for example right after the character enters the game. Nothing is sent.
move: the game has no path from cell <cell> to cell <cell> The Dofus client itself would find no route. Nothing is sent.
move: the server didn't grant the walk in time No MapMovementEvent granted the walk within timeout. A walk the server refuses ends this way too.
move: another walk of the character started before this one ended A new walk of the character started first, or its walk was cancelled, for example because the player clicked elsewhere on a MITM bot
move: the server didn't acknowledge the end of the walk in time No MapMovementConfirmResponse came within the walk's time plus timeout
move: the game session closed during the walk The game connection closed before the walk ended
behavior resource limit exceeded: maximum pending operations reached 32 operations are pending, and a walk counts as one until it ends. Nothing is sent.

It also rejects with the texts of findPath() when the game data can't be read, such as failed to load map <mapId> for pathfinding: datacenter: no such record: maps/<mapId>. asterobot:pathfinding lists them.

String(error) gives TypeError: or GoError: followed by the text.

Limits

  • move() walks on the map the character stands on. It doesn't change maps.
  • It's made for moving outside fights, like asterobot:pathfinding.

Walk along a path shows the messages move() exchanges, for a script that walks by hand.

Commentaires des utilisateurs

Aucun avis à afficher.

Compte

Navigation

Recherche

Recherche

Configurer les notifications push du navigateur

Chrome (Android)
  1. Appuyez sur l'icône de cadenas à côté de la barre d'adresse.
  2. Tap Autorisations → Notifications.
  3. Ajustez vos préférences.
Chrome (Desktop)
  1. Cliquez sur l'icône représentant un cadenas dans la barre d'adresse..
  2. Select Paramètres du site.
  3. Find Notifications et ajustez vos préférences.