using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using Blizzard.HabboHotel.Rooms; using Blizzard.HabboHotel.Users; namespace Blizzard.LOL { /*class PathFinder23456 { Point[] Movements; Squares[,] Squares; Room Room; RoomsData Rooms; Habbo User; internal int MapSizeX; internal int MapSizeY; internal int Area; public PathFinder23456(RoomsData cRoom, Room cRooms, Habbo cUser) { Rooms = cRoom; Room = cRooms; User = cUser; RoomModel Model = Rooms.GetRoomModel(); this.MapSizeX = Model.MapSizeX; this.MapSizeY = Model.MapSizeY; // Add Movements Movements = new Point[] { new Point(0, -1), new Point(1, 0), new Point(0, 1), new Point(-1, 0), new Point(-1, -1), new Point(1, -1), new Point(1, 1), new Point(-1, 1) }; // Add Area Area = 0; for (int x = 0; x != MapSizeX; x++) { for (int y = 0; y != MapSizeY; y++) { Area++; } } // Add coordinates Squares = new Squares[MapSizeX, MapSizeY]; for (int x = 0; x != MapSizeX; x++) { for (int y = 0; y != MapSizeY; y++) { Squares[x, y] = new Squares(x, y); } } } private IEnumerable GetSquares() { for (int x = 0; x != MapSizeX; x++) { for (int y = 0; y != MapSizeY; y++) { yield return new Point(x, y); } } } private IEnumerable ValidMoves(int x, int y) { foreach (Point movePoint in Movements) { int newX = x + movePoint.X; int newY = y + movePoint.Y; if (IsSquareOpen(newX, newY, true)) { yield return new Point(newX, newY); } } } private Boolean IsSquareOpen(int x, int y, Boolean CheckHeight) { if(Room.IsItemOnXY(x, y)) return false; if (x < 0 || y < 0 || x > MapSizeX || y > MapSizeY) return false; else if (User.X == x && User.Y == y) return false; else return true; } internal List GetPath(int ActualX, int ActualY, int GoalX, int GoalY) { /*if(!IsValidTile(GoalX, GoalY)) return null; int UserX = ActualX; int UserY = ActualY; List Path = new List(); for (int i = 0; i < 20000; i++) { Coord Next = CalculateNextCoord(UserX, UserY, GoalX, GoalY); UserX = Next.X; UserY = Next.Y; if (Next.X == GoalX && Next.Y == GoalY || Next.X == -500 && Next.Y == -500) { Path.Add(Next); i = 50000; } else { Path.Add(Next); } } return Path; } internal Coord CalculateNextCoord(int UserX, int UserY, int GoalX, int GoalY) { Coord Next = new Coord(-1, -1); if (UserX > GoalX && UserY > GoalY && IsValidTile(UserX - 1, UserY - 1)) Next = new Coord(UserX - 1, UserY - 1); else if (UserX < GoalX && UserY < GoalY && IsValidTile(UserX + 1, UserY + 1)) Next = new Coord(UserX + 1, UserY + 1); else if (UserX > GoalX && UserY < GoalY && IsValidTile(UserX - 1, UserY + 1)) Next = new Coord(UserX - 1, UserY + 1); else if (UserX < GoalX && UserY > GoalY && IsValidTile(UserX + 1, UserY - 1)) Next = new Coord(UserX + 1, UserY - 1); else if (UserX > GoalX && IsValidTile(UserX - 1, UserY)) Next = new Coord(UserX - 1, UserY); else if (UserX < GoalX && IsValidTile(UserX + 1, UserY)) Next = new Coord(UserX + 1, UserY); else if (UserY < GoalY && IsValidTile(UserX, UserY + 1)) Next = new Coord(UserX, UserY + 1); else if (UserY > GoalY && IsValidTile(UserX, UserY - 1)) Next = new Coord(UserX, UserY - 1); else Next = new Coord(-500, -500); return Next; } internal bool IsValidTile(int X, int Y) { if (X < 0 || Y < 0 || X >= MapSizeX || Y >= MapSizeY || Room.IsItemOnXY(X, Y)) return false; else return true; } }*/ }