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;
        }
Ejemplo n.º 2
0
        private bool SetStepForUser(RoomUser User)
        {
            if (room.GetGameMap().CanWalk(User.SetX, User.SetY, User.SetZ, User.AllowOverride) || User.ignoreMap || User.PetGotUserRiding())
            {
				int currentCoord = User.GetDoubleCoordinate();
				int newCoord = TextHandling.CombineXYCoord(User.SetX, User.SetY);

				room.GetGameMap().UpdateUserMovement(ref currentCoord, ref newCoord, User);
				RoomItem[] items = room.GetGameMap().GetCoordinatedHeighestItems(ref currentCoord);

                User.X = User.SetX;
                User.Y = User.SetY;
                User.Z = User.SetZ;

                if (User.isFlying)
                {
                    User.Z += 4 + 0.5 * Math.Sin(0.7 * User.flyk);
                }
                else
                {
                    foreach (RoomItem item in items)
                    {
                        item.UserWalksOffFurni(User);
                    }
                   
                }

                if (User.X == room.GetGameMap().Model.DoorX && User.Y == room.GetGameMap().Model.DoorY && !ToRemove.Contains(User) && !User.IsBot)
                {
                    ToRemove.Add(User);
                    return true;
                }


                UpdateUserStatus(User, true);
            }
            User.SetStep = false;
            return false;
        }