Beispiel #1
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;
        }
Beispiel #2
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());
                    }
                }
            }
        }