Ejemplo n.º 1
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;       
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
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;
        }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
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());
                    }
                }
            }
        }