public float GetDistanceTo(TargetInfo target)
 {
     var distanceX = (float)Math.Abs(X - target.X);
     var distanceY = (float)Math.Abs(Y - target.Y);
     var distanceZ = (float)Math.Abs(Z - target.Z);
     return (float)Math.Sqrt((distanceX * distanceX) + (distanceY * distanceY) + (distanceZ * distanceZ));
 }
 public float GetHorizontalDistanceTo(TargetInfo target)
 {
     var distanceX = (float)Math.Abs(X - target.X);
     var distanceY = (float)Math.Abs(Y - target.Y);
     return (float)Math.Sqrt((distanceX * distanceX) + (distanceY * distanceY));
 }
        // <summary>
        // ターゲットの情報(とりあえず必要なものだけ)
        // </summary>
        //
        //
        public static unsafe TargetInfo GetTargetInfoFromByteArray(byte[] source)
        {
            TargetInfo target = new TargetInfo();

            target.Name = FFXIVPluginHelper.GetStringFromBytes(source, 48);

            fixed (byte* p = &source[0x74]) target.ID = *(uint*)p;

            target.Type = (TargetType)source[0x8A];
            target.EffectiveDistance = source[0x91];
            int offset = (GetFFXIVClientMode == FFXIV_ACT_Plugin.FFXIVClientMode.FFXIV_64) ? 176 : 160;
            fixed (byte* p = &source[offset]) target.X = *(float*)p;
            fixed (byte* p = &source[offset + 4]) target.Z = *(float*)p;
            fixed (byte* p = &source[offset + 8]) target.Y = *(float*)p;

            if (target.Type != TargetType.PC && target.Type != TargetType.Monster)
            {
                target.CurrentHP = target.MaxHP = target.CurrentMP = target.MaxMP = 0;
            }
            else
            {
                int num = (GetFFXIVClientMode == FFXIV_ACT_Plugin.FFXIVClientMode.FFXIV_64) ? 5872 : 5312;
                fixed (byte* p = &source[num+8]) target.CurrentHP = *(int*)p;
                fixed (byte* p = &source[num+12]) target.MaxHP = *(int*)p;
                fixed (byte* p = &source[num+16]) target.CurrentMP = *(int*)p;
                fixed (byte* p = &source[num+20]) target.MaxMP = *(int*)p;
            }
            return target;
        }