Example #1
0
 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));
 }
Example #2
0
 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));
 }
Example #3
0
        // <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[0x90];

            fixed (byte* p = &source[0xA0]) target.X = *(float*)p;
            fixed (byte* p = &source[0xA4]) target.Z = *(float*)p;
            fixed (byte* p = &source[0xA8]) target.Y = *(float*)p;

            if (target.Type != TargetType.PC && target.Type != TargetType.Monster)
            {
                target.CurrentHP = target.MaxHP = target.CurrentMP = target.MaxMP = 0;
            }
            else
            {
                fixed (byte* p = &source[0x1548]) target.CurrentHP = *(int*)p;
                fixed (byte* p = &source[0x154C]) target.MaxHP = *(int*)p;
                fixed (byte* p = &source[0x1550]) target.CurrentMP = *(int*)p;
                fixed (byte* p = &source[0x1554]) target.MaxMP = *(int*)p;
            }
            return target;
        }