public void Update() { if (currentPath == null) { ReCalculatePath(); } if (self.DistanceToActor(target) > ai.GetCurrentCastRange(target) * 0.75f) { if (target.DistanceToPoint(x, y, z) > 100) { ReCalculatePath(); } if (currentPath.Count > curPathIdx) { PathNode node = currentPath[curPathIdx++]; if (curPathIdx % 2 == 0) { MoveArgument arg = new MoveArgument() { X = node.X, Y = node.Y, Z = map.HeightMapBuilder.GetZ((short)node.X, (short)node.Y, (short)node.Z) }; if (arg.Z == 0) { status = CommandStatus.Finished; return; } arg.Dir = self.DirectionFromTarget(node.X, node.Y); arg.Speed = (ushort)(500 * ((float)500 / self.Speed)); arg.DashID = 0; arg.DashUnknown = 0; arg.BNSMoveType = MoveType.Run; map.MoveActor(self, arg); } } else { if (curPathIdx % 2 == 1) { PathNode node = currentPath[curPathIdx - 1]; MoveArgument arg = new MoveArgument() { X = node.X, Y = node.Y, Z = map.HeightMapBuilder.GetZ((short)node.X, (short)node.Y, (short)node.Z) }; if (arg.Z == 0) { status = CommandStatus.Finished; return; } arg.Dir = self.DirectionFromTarget(node.X, node.Y); arg.Speed = self.Speed; arg.DashID = 0; arg.DashUnknown = 0; arg.BNSMoveType = MoveType.Run; map.MoveActor(self, arg); } status = CommandStatus.Finished; } } else { status = CommandStatus.Finished; } }