Ejemplo n.º 1
0
        private void CalculatePath(RoomUser User, ref bool updated)
        {
            Gamemap map = room.GetGameMap();
            SquarePoint Point = DreamPathfinder.GetNextStep(User.X, User.Y, User.Z, User.GoalX, User.GoalY, map.GameMap, map.GetStackmap(), map.Model.SqFloorHeight,
                map.Model.MapSizeX, map.Model.MapSizeY, User.AllowOverride, map.DiagonalEnabled, map);

            if (Point.X == User.X && Point.Y == User.Y) //No path found, or reached goal (:
            {
                User.IsWalking = false;
                User.IsHorseWalking = false;
                User.OnStopWalk();
                User.RemoveStatus("mv");

                UpdateUserStatus(User, false);
            }
            else
            {
                HandleSetMovement(Point, User, ref updated, true);
                if (User.IsPet && User.PetGotUserRiding())
                {
                    RoomUser ridingPet = User.GetRoomUserRiding();
                    SetStepForUser(ridingPet);
                    HandleSetMovement(Point, ridingPet, ref updated, false);
                    UpdateUserEffect(ridingPet, ridingPet.X, ridingPet.Y);
                    ridingPet.UpdateNeeded = true;
                    FinishUserCycle(ridingPet);
                }
            }

            User.UpdateNeeded = true;
        }