예제 #1
0
 public void UseOnMap(Tile tile, int amount = -1) { }
예제 #2
0
 public void MoveToGround(Tile tyle, int amount = -1) { }
예제 #3
0
        public static bool CompareTiles(Tile first, Tile second)
        {
            try
            {
                if (first == null || second == null)
                    return false;

                if (first.ItemCount == second.ItemCount)
                {
                    return HelpMethods.ArraysEqual<TileItem>(first.GetItems(), second.GetItems());
                }
                else
                    return false;


            }
            catch (InvalidOperationException ex)
            {
                Helpers.Debug.Report(ex);
            }
            return false;
        }
예제 #4
0
        public static bool CheckTileHasItem(exTibia.Objects.Location location, Collection<int> items)
        {
            try
            {
                Tile t = new Tile();
                t = GetDistTile(location);

                if (t.GetItems().Any(i => items.Any(it => i.id == it)))
                    return true;
                return false;
            }
            catch(InvalidOperationException ex)
            {
                Helpers.Debug.Report(ex);
            }
            return false;       
        }
예제 #5
0
        public static Tile GetPlayerTile(int address)
        {
            try
            {
                Tile result = new Tile();
                int playerId;
                Tile t = new Tile();
                int found = 0;
                if (address == 0)
                {
                    address = Memory.ReadInt32(Addresses.Map.Pointer);
                }

                playerId = (int)Player.ID;

                for (int x = 0; x <= Addresses.Map.MaxTiles - 1; x++)
                {
                    t = GetTile(x, address);

                    if (t.ItemCount > 0)
                    {
                        for (int y = 0; y <= t.ItemCount - 1; y++)
                        {
                            if (t.GetItems()[y].id == 0x63 && t.GetItems()[y].data == playerId)
                            {
                                result = t;
                                result.Index = x;
                                result.GlobalLocation = Tile.PlayerLocation();
                                result.MemoryLocation = Tile.tileToLocal(x);
                                found++;
                            }

                        }
                    }
                }
                return result;
            }
            catch (InvalidOperationException ex)
            {
                Helpers.Debug.Report(ex);
            }
            return null;
        }
예제 #6
0
        public static Collection<Tile> TilesFromScreenExtended()
        {
            try
            {
                int playerTile = GetPlayerTileExtended().Index;
                Collection<Tile> result = new Collection<Tile>();
                Tile tile = new Tile();

                Collection<Objects.Location> locations = new Collection<Objects.Location>();
                locations = Objects.Location.Locations();

                Location maploc = Map.MapToLocation(Map.MapFileName(Player.X - 256, Player.Y - 256, Player.Z));

                foreach (Objects.Location location in locations)
                {
                    tile = Tile.GetTile(Tile.GetTileNumByPosition(location.X, location.Y, location.Z, playerTile));
                    tile.LocationOnMap = location;
                    tile.PathfinderPoint = new Point(location.X - maploc.X, location.Y - maploc.Y);
                    if (tile.ItemCount > 0)
                        result.Add(tile);
                }
                return result;
            }
            catch (InvalidOperationException ex)
            {
                Helpers.Debug.Report(ex);
            }
            return null;
        }
예제 #7
0
        public static Tile GetPlayerTileExtended()
        {
            try
            {
                int PlayerId = Player.ID;
                int addr = Memory.ReadInt32(Addresses.Map.TilePointer);
                Tile t = new Tile();
                Tile result = new Tile();
                for (int i = 0; i < Addresses.Map.MaxZ; i++)
                {
                    int tileNumber = Memory.ReadInt32(addr + (14 * 18 * i * 4) + 116 * 4);

                    t = GetTile(tileNumber);

                    if (t.ItemCount > 0)
                    {
                        for (int y = 0; y <= t.ItemCount - 1; y++)
                        {
                            if (t.GetItems()[y].id == 0x63 && t.GetItems()[y].data == PlayerId)
                            {
                                result = t;
                                result.Index = tileNumber;
                                result.GlobalLocation = Tile.PlayerLocation();
                                result.MemoryLocation = Tile.tileToLocal(tileNumber);
                                return result;
                            }

                        }
                    }

                }
                return null;
            }
            catch(InvalidOperationException ex)
            {
                Helpers.Debug.Report(ex);
            }

            return null;
        }
예제 #8
0
        public static Tile GetTile(int index, int address)
        {
            Tile result = new Tile();

            try
            {                
                int addr, addr2;

                if (address == 0)
                {
                    addr = Tile.TileToAddress(index);
                }
                else
                {
                    addr = Tile.TileToAddress(index, address);
                }

                result.ItemCount = Memory.ReadInt32(addr + Addresses.Map.DistanceTileObjectCount);
                result._items = new TileItem[result.ItemCount];
                result._order = new int[result.ItemCount];

                addr2 = addr + (int)Addresses.Map.TileOrder;

                for (int z = 0; z <= result.ItemCount -1; z++)
                {
                    result.GetOrder()[z] = Memory.ReadInt32(addr2);
                    addr2 = addr2 + (int)Addresses.Map.TileOrder;
                }

                addr = addr + (int)Addresses.Map.DistanceTileObjects;

                for (int a = 0; a <= result.ItemCount - 1; a++)
                {
                    result.GetItems()[a].id = Memory.ReadInt32(addr + Addresses.Map.DistanceObjectId);
                    result.GetItems()[a].data = Memory.ReadInt32(addr + Addresses.Map.DistanceObjectData);
                    result.GetItems()[a].dataEx = Memory.ReadInt32(addr + Addresses.Map.DistanceObjectDataEx);
                    addr = addr + (int)Addresses.Map.StepTileObject;
                }
                return result;
            }
            catch (InvalidOperationException ex)
            {
                Helpers.Debug.Report(ex);
            }
            return null;
        }
예제 #9
0
        public static IEnumerable<Tile> Tiles()
        {
            List<exTibia.Objects.Location> locations = new List<exTibia.Objects.Location>();
            exTibia.Objects.Location temp = new exTibia.Objects.Location();
            locations = exTibia.Objects.Location.Locations().ToList();

            List<Tile> result = new List<Tile>();
            Tile t = new Tile();
            Tile playerTile = GetPlayerTile();
            int address = Memory.ReadInt32(Addresses.Map.Pointer);
            List<Tile> list = new List<Tile>();

            for (int x = 0; x <= Addresses.Map.MaxTiles - 1; x++)
            {
                t = GetTile(x, address);

                if (t != null)
                {
                    if (t.ItemCount > 0)
                    {
                        t.MemoryLocation = Tile.tileToLocal(x);
                        t.GlobalLocation = Tile.tileToGlobal(t, playerTile);

                        temp.X = t.GlobalLocation.x;
                        temp.Y = t.GlobalLocation.y;
                        temp.Z = t.GlobalLocation.z;

                        yield return new Tile(x, t.GetItems(), t.ItemCount, t.GlobalLocation, t.MemoryLocation, t.GetOrder());
                    }
                }
            }
        }
예제 #10
0
        public static TileLocation tileToGlobal(Tile tile, Tile PlayerTile)
        {
            try
            {
                TileLocation result = new TileLocation();
                TileLocation loc = new TileLocation();
                TileLocation playerMemLoc, playerGloLoc;

                loc = tile.MemoryLocation;
                playerMemLoc = PlayerTile.MemoryLocation;

                int diffX = 0;
                int diffY = 0;
                int maxX = 0;
                int maxY = 0;

                diffX = 8 - playerMemLoc.x;
                diffY = 6 - playerMemLoc.y;
                loc.x = loc.x + diffX;
                loc.y = loc.y + diffY;

                maxY = (int)Addresses.Map.MaxY + 1;
                maxX = (int)Addresses.Map.MaxX;

                if (loc.x > maxX)
                {
                    loc.x = loc.x - (int)Addresses.Map.MaxX;
                    //loc.y = loc.y + 1;
                }
                else if (loc.x < 0)
                {
                    loc.x = loc.x + (int)Addresses.Map.MaxX;
                    //loc.y = loc.y - 1;
                }
                else if (loc.y > maxY)
                {
                    loc.y = loc.y - (int)Addresses.Map.MaxY;
                }
                else if (loc.y < 0)
                {
                    loc.y = loc.y + (int)Addresses.Map.MaxY;
                }

                playerGloLoc = PlayerTile.GlobalLocation;

                result.x = playerGloLoc.x + (loc.x - 8);
                result.y = playerGloLoc.y + (loc.y - 6);
                result.z = playerGloLoc.z + (loc.z - playerMemLoc.z);

                return result;
            }
            catch (InvalidOperationException ex)
            {
                Helpers.Debug.Report(ex);
            }
            return new TileLocation();
        }
예제 #11
0
 public MapGrid(Location loc, bool walkable, Tile tile)
 {
     _location = loc;
     _walkable = walkable;
     _tile = tile;
 }