Hi
This c# source shows how to get details for all missile/projectiles currently in flight such as a fireballs or arrows. The source contains info such as caster, target, location, start location and impact location. It is written for Honorbuddy but can be ported easily.
Code:
/// <summary>
/// Returns the spell missiles.
/// </summary>
/// <returns></returns>
public static IEnumerable<MissileInfo> GetMissiles()
{
// pointer taken from Wow 5.0.5.16048
var missilePtr = StyxWoW.Memory.Read<IntPtr>((IntPtr)0xC2A448, true);
while (missilePtr != IntPtr.Zero)
{
yield return new MissileInfo(missilePtr);
missilePtr = StyxWoW.Memory.Read<IntPtr>(missilePtr + 392);
}
}
#region Nested type: MissileInfo
public class MissileInfo
{
public MissileInfo(IntPtr baseAddress)
{
_internalMissileInfo = StyxWoW.Memory.Read<InternalMissileInfo>(baseAddress);
}
public uint Index { get { return _internalMissileInfo.Index; } }
public WoWUnit Caster { get { return ObjectManager.GetObjectByGuid<WoWUnit>(_internalMissileInfo.CasterGuid); } }
public ulong CasterGuid { get { return _internalMissileInfo.CasterGuid; } }
public WoWUnit Target { get { return ObjectManager.GetObjectByGuid<WoWUnit>(_internalMissileInfo.TargetGuid); } }
public ulong TargetGuid { get { return _internalMissileInfo.TargetGuid; } }
public WoWSpell Spell { get { return WoWSpell.FromId(_internalMissileInfo.SpellId); } }
public int SpellId { get { return _internalMissileInfo.SpellId; } }
public WoWPoint Pos { get { return _internalMissileInfo.Pos; } }
public WoWPoint FirePos { get { return _internalMissileInfo.FirePos; } }
public WoWPoint ImpactPos { get { return _internalMissileInfo.ImpactPos; } }
private InternalMissileInfo _internalMissileInfo;
[StructLayout(LayoutKind.Sequential)]
private struct InternalMissileInfo // allot of fields left out.
{
public readonly uint Index;
private readonly uint _dword4;
public readonly ulong CasterGuid; // +0x8
public readonly ulong CasterGuid2; // +0x10
public readonly ulong TargetGuid; // +0x18
private readonly uint dword20;
private readonly uint dword24;
private readonly uint dword28;
public readonly int SpellId; // +0x2C
private readonly uint _dword30;
private readonly uint _dword34;
private readonly uint dword38;
private readonly uint _dword3C;
private readonly uint _dword40;
public readonly WoWPoint Pos; // + 0x44
public readonly WoWPoint FirePos; // + 0x50
public readonly WoWPoint ImpactPos; // + 0x5C
}
}