- using System;
- namespace WowMoPObjMgrTest
- {
- class WowObject
- {
- private IntPtr BaseAddress;
- private const int DescriptorsOfs = 0x8;
- private const int ObjTypeOfs = 0x10;
- private const int ObjGuidOfs = 0x30;
- public WowObject(IntPtr address)
- {
- BaseAddress = address;
- }
- public IntPtr Pointer
- {
- get { return BaseAddress; }
- }
- public WowObjectType Type
- {
- get { return (WowObjectType)Memory.Read<int>(BaseAddress + ObjTypeOfs); }
- }
- public ulong Guid
- {
- get { return Memory.Read<ulong>(BaseAddress + ObjGuidOfs); }
- }
- public ulong VisibleGuid
- {
- get { return GetDescriptor<ulong>(ObjectFields.Guid); }
- }
- public int Entry
- {
- get { return GetDescriptor<int>(ObjectFields.Entry); }
- }
- public float Scale
- {
- get { return GetDescriptor<float>(ObjectFields.Scale); }
- }
- public T GetDescriptor<T>(Enum index) where T : struct
- {
- return Memory.Read<T>(Memory.Read<IntPtr>(BaseAddress + DescriptorsOfs) + Convert.ToInt32(index) * 4);
- }
- public bool IsA(WowObjectTypeFlags flags)
- {
- return (GetDescriptor<int>(ObjectFields.Type) & (int)flags) != 0;
- }
- }
- }