Code:
private void UpdateTileNums()
{
int index = 0;
int Adr = client.Memory.ReadInt32(Adresses.Map.TileNumberArray);
for (byte z = 0; z < 8; z++)
{
for (byte y = 0; y < 14; y++)
{
for (byte x = 0; x < 18; x++)
{
TileNumberArray[z, y, x] = client.Memory.ReadInt32(Adr + index);
index += 4;
}
}
}
}
public IEnumerable<Tile> GetTilesSameFloor()
{
UpdateTileNums();
Location Selfloc = client.PlayerLocation;
int Index = 7 - Selfloc.Z;
if (Index >= 0)
{
//nothing
}
else
{
Index = 2;
}
for (byte y = 0; y < 14; y++)
{
for (byte x = 0; x < 18; x++)
{
int tilenum =TileNumberArray[Index, y, x];
int adr = TileNumToMapAdress(tilenum);
Location loc = new Location(Selfloc.X + x - 8, Selfloc.Y + y -6, Selfloc.Z);
Tile t = new Tile(client, (uint)adr, (uint)tilenum, loc);
yield return t;
}
}
}
This is just great, this code works like a charm now you dont have to convert tilenums to memloc and memloc to worldloc. I should work faster and it should be 100% accurate. Since tibiaAPIs mapreading is not always 100%.
http://i.imgur.com/LM9uTfq.jpg