Managed to solve the problem thanks to TOM_RUS
Code:
public class AHTestScript : Script
{
public AHTestScript()
: base("AH", "Test")
{ }
public override void OnStart()
{
firstRun = true;
}
private bool firstRun = true;
public override void OnTick()
{
if (firstRun)
{
var count = Helper.Magic.Read<int>(Offsets.AuctionHouse.ListCount);
if (count == 0) return;
var ptr = Helper.Magic.Read<IntPtr>(Offsets.AuctionHouse.ListBase);
if (ptr == IntPtr.Zero) return;
for (var i = 0; i < count; i++)
{
var auc = Helper.Magic.ReadStruct<AuctionEntry>(ptr + (i * AuctionEntry.Size));
Print("#{0} | buyout {1} | expires on {2}", auc.Id, Helper.MoneyString((int)auc.BuyoutPrice), auc.Expires);
}
firstRun = false;
}
}
public override void OnTerminate()
{
}
public struct AuctionEntry
{
private uint unk0;
public uint Id;
public uint Entry;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public WowEnchant[] Enchants;
public uint RandomProperty;
public uint RandomSuffix;
public uint StackSize;
public uint Charges;
public uint ItemFlags;
public ulong Owner;
public ulong MinBid;
public ulong MinIncrement;
public ulong BuyoutPrice;
public uint TimeLeft;
private uint unk1;
public ulong Bidder;
public ulong BidAmount;
public int SaleStatus;
private uint unk2;
public DateTime Expires
{
get { return DateTime.Now.AddMilliseconds(this.TimeLeft - Helper.PerformanceCount); }
}
public struct WowEnchant
{
public int Id;
public int Duration;
public int Charges;
}
public static readonly int Size = Marshal.SizeOf(typeof(AuctionEntry));
}
}