Okay, so I have been searching around and trying to figure out reading Map for about 3 days straight now. I am not using TibiaApi. And the client i'm trying to do it is Thronia.org(old tibianic client basically). I promise I am not leeching, it is just that I am stuck at this one thing for a while.
My map.cs:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Bot.Objects
{
class Map
{
public IEnumerable<Tile> GetTiles()
{
for (uint i = Addresses.Map.MapStart; i < Addresses.Map.MapStart + (172 * 2016); i += Addresses.Map.StepTile)
{
yield return new Tile(i);
}
}
}
}
Tile.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Bot.Objects
{
class Tile
{
private uint address;
public Tile(uint address)
{
this.address = address;
}
public uint Id
{
get { return (uint)Memory.ReadInt(address + Addresses.Map.DistanceObjectId); }
}
public uint Object
{
get { return (uint)Memory.ReadInt(address + Addresses.Map.StepTileObject); }
}
public uint Data
{
get { return (uint)Memory.ReadInt(address + Addresses.Map.DistanceObjectData); }
}
public uint DataEx
{
get { return (uint)Memory.ReadInt(address + Addresses.Map.DistanceObjectDataEx); }
}
public uint Address
{
get { return address; }
}
}
}
I am able to get some id's but they are not really right all the time.
Like for example trying to find my player:
Code:
public void pask()
{
foreach (Tile t in new Map().GetTiles())
{
if (t.Id == 0)
continue;
if (t.Id == 99)
{
MapView.Items.Add(Convert.ToString(t.Id));
MapView.Items.Add(Convert.ToString(t.Data));
}
}
}
since my player is objectId 99, t.data should equal my players Id, but its not.