DE API UO PMove - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
UO.PMove
void UO.PMove(object? targetX, object? targetY);
void UO.PMove(object? x, object? y, object? z);
PMove wartet auf Wegsuche und Bewegung. XY verlangt genaue XY-Koordinaten, XYZ zusätzlich die angegebene Höhe. Rückgabe: void; prüfen Sie die tatsächlichen Koordinaten. NewMoveXY und MoveXYZ liefern ein numerisches Ergebnis. Keine implizite Grenze von 30 Sekunden.
Beispiele
int destinationX = UO.GetX() + 1;
int destinationY = UO.GetY();
UO.PMove(destinationX, destinationY);
bool arrived = UO.GetX() == destinationX && UO.GetY() == destinationY;
UO.Print(arrived.ToString());
int savedLimit = UO.LimitMove();
try
{
UO.LimitMove(0);
UO.PMove(5000, 1500, 0);
UO.Print($"{UO.GetX()}, {UO.GetY()}, {UO.GetZ()}");
}
finally
{
UO.LimitMove(savedLimit);
}
InjectionRuntimeState.LimitMove → InjectionApiUO.MoveToCanonical / BuildPortablePath → ClassicUOInjectionApiBridge.MoveTo → Pathfinder.WalkTo. NativeFollowController / WorldMapController → Pathfinder.WalkTo.
bool arrived = WalkTo(UO.GetX() + 1, UO.GetY());
UO.Print(arrived.ToString());
bool WalkTo(int destinationX, int destinationY)
{
UO.PMove(destinationX, destinationY);
return UO.GetX() == destinationX && UO.GetY() == destinationY;
}
var walker = new CoordinateWalker(UO);
bool arrived = walker.Walk(UO.GetX() + 1, UO.GetY(), UO.GetZ());
UO.Print(arrived.ToString());
class CoordinateWalker(ClassicUO.CSharp.CSharpGameApi api)
{
public bool Walk(int x, int y, int z)
{
api.PMove(x, y, z);
return api.GetX() == x && api.GetY() == y && api.GetZ() == z;
}
}