Few things
Code:
while (currentObject.BaseAddress != uint.MinValue && currentObject.BaseAddress % 2 == uint.MinValue)
{
if (currentObject.Type == (int) Offsets.WowObjectType.Unit)
Objects.Add(new WowUnit(currentObject.BaseAddress));
if (currentObject.Type == (int) Offsets.WowObjectType.Item)
Objects.Add(new WowItem(currentObject.BaseAddress));
if (currentObject.Type == (int) Offsets.WowObjectType.Container)
Objects.Add(new WowContainer(currentObject.BaseAddress));
if (currentObject.Type == (int) Offsets.WowObjectType.Corpse)
Objects.Add(new WowCorpseObject(currentObject.BaseAddress));
if (currentObject.Type == (int) Offsets.WowObjectType.GameObject)
Objects.Add(new WowGameObject(currentObject.BaseAddress));
if (currentObject.Type == (int)Offsets.WowObjectType.DynamicObject)
Objects.Add(new WowDynamicObject(currentObject.BaseAddress));
if (currentObject.Type == (int)Offsets.WowObjectType.Player)
Objects.Add(new WowPlayer(currentObject.BaseAddress));
if (currentObject.GUID == LocalGUID)
Me = new WowPlayer(currentObject.BaseAddress);
currentObject.BaseAddress = Memory.ReadUInt(currentObject.BaseAddress + (uint)Offsets.ObjectManager.NextObject);
}
Use a switch here. Otherwise you're going to be going through a bunch of pointless if statements for no reason.
DisplayID is valid for players FYI. (Hence the reason why you can 'morph' yourself into other things.)
You're not removing any entries from your object list, so you'll definitely run into situations where you have stale data, and end up crashing the client/application due to bad base addresses.
Code:
protected T GetStorageField<T>(uint field) where T : struct
{
field = field * 4;
var m_pStorage = ObjectManager.Memory.ReadUInt(BaseAddress + 0x08);
return (T)ObjectManager.Memory.ReadObject(m_pStorage + field, typeof(T));
}
BAD BAD BAD BAD!
I suggest you read up on the size of different things. (bools in specific)
You use a GetStorageField<bool>(x) in a few places, where the values are 32/64 bit values. Some of which don't return a 1 or 0.
Code:
if (typeof(T) == typeof(bool)) return ObjectManager.Memory.ReadUInt32(addr) != 0;
Will fix most issues. (You'll want to actually do the boolean check in your properties though, to avoid any possible issues)
Yes, I'm anal.
Code:
protected T GetStorageField<T>(Offsets.WowObjectFields field) where T : struct
{
return GetStorageField<T>((uint)field);
}
Never used. (You're using the uint casted version.)
I can go on, but I think you get the idea.
Decent start, but there's DEFINITELY room for improvement. (You're totally missing all the unit flags, among other vitally important information)