I've been cutting and pasting my arse off, but can't seem to get a "true" return on testing for combat. This is what I have going...
Code:
public static BlackMagic Memory = new BlackMagic();
Descriptors descriptor = new Descriptors(Memory);
public Descriptors getDescriptors
{
get
{
return descriptor;
}
}
public bool Combat
{
get
{
return Convert.ToBoolean(Flags & 0x0080000); //tried return (Flags & 0x80000) == 0x80000)
}
}
public long Flags
{
get
{
try
{
Process[] process = Process.GetProcessesByName("Wow");
return getDescriptors.GetKnownField<uint>(Descriptors.WoWUnitFields.UNIT_FIELD_FLAGS, GetBaseAddress(process[0].Id, "wow.exe"));
}
catch
{
return 0;
}
}
}
public uint GetBaseAddress(int processID, string moduleName)
{
Process process = Process.GetProcessById(processID);
ProcessModuleCollection Modules = process.Modules;
ProcessModule pModule;
uint baseAddress = 0;
for (int i = 0; i < Modules.Count; i++)
{
pModule = Modules[i];
if (pModule.ModuleName.Equals(moduleName))
{
baseAddress = (uint)pModule.BaseAddress;
break;
}
}
return baseAddress;
}
public class Descriptors
{
public enum WoWUnitFields : uint
{
UNIT_FIELD_FLAGS = 0x34 //tried 0x35 which is UNIT_FIELD_FLAGS2
};
private BlackMagic wow { get; set; }
public Descriptors(BlackMagic _BlackMagic)
{
this.wow = _BlackMagic;
}
public T GetKnownField<T>(WoWUnitFields field, uint obj) where T : struct
{
return (T)wow.ReadObject(wow.ReadUInt(obj + 0x08) + (uint)field * 4, typeof(T));
}
}
its always false if I'm in combat or not.