hier mal eine kleine API um die Objecte bei WoW auszulesen.
Funktionen:
- int GetFirstObject(unsigned int ProcID, sWoWObject* WoWObject);
- int GetNextObject(unsigned int ProcID, sWoWObject* WoWObject);
ProcID => ProcessID von WoW
sWoWObject =>
Code:
struct sWoWObject{
unsigned long long Guid;
unsigned long SummonedBy;
float XPos;
float YPos;
float ZPos;
float Rotation;
unsigned int BaseAddress;
unsigned int UnitFieldsAddress;
short Type;
unsigned int CurrentHealth;
unsigned int MaxHealth;
unsigned int CurrentEnergy;
unsigned int MaxEnergy;
unsigned int CurrentEXP;
unsigned int MaxEXP;
unsigned int Level;
bool isDead;
};
Codebeispiel für C#:
Code:
public class WoWAPI
{
[StructLayout(LayoutKind.Explicit)]
public struct sWoWObject{
[FieldOffset(0)] public ulong Guid;
[FieldOffset(8)] public ulong SummonedBy;
[FieldOffset(12)] public float XPos;
[FieldOffset(16)] public float YPos;
[FieldOffset(20)] public float ZPos;
[FieldOffset(24)] public float Rotation;
[FieldOffset(28)] public uint BaseAddress;
[FieldOffset(32)] public uint UnitFieldsAddress;
[FieldOffset(36)] public short Type;
[FieldOffset(40)] public uint CurrentHealth;
[FieldOffset(44)] public uint MaxHealth;
[FieldOffset(48)] public uint CurrentEnergy;
[FieldOffset(52)] public uint MaxEnergy;
[FieldOffset(56)] public uint CurrentEXP;
[FieldOffset(60)] public uint MaxEXP;
[FieldOffset(64)] public uint Level;
[FieldOffset(68)] public bool isDead;
};
[DllImport("WoWAPI.dll")]
public static extern int GetFirstObject(IntPtr ProcID, ref sWoWObject Test);
[DllImport("WoWAPI.dll")]
public static extern int GetNextObject(IntPtr ProcID, ref sWoWObject Test);
}






