protected virtual void WriteHitInfo(uLink.BitStream sendStream, ref Ray ray, bool didHit, ref RaycastHit2 hit, bool hitNetworkView, NetEntityID hitView)
    {
        Vector3   point;
        Transform transforms;

        if (!didHit)
        {
            sendStream.WriteByte(255);
            point = ray.GetPoint(1000f);
        }
        else if (!hitNetworkView)
        {
            sendStream.WriteByte(255);
            point = hit.point;
        }
        else
        {
            IDRemoteBodyPart dRemoteBodyPart = hit.remoteBodyPart;
            if (!dRemoteBodyPart)
            {
                sendStream.WriteByte(254);
                transforms = hitView.transform;
            }
            else
            {
                sendStream.WriteByte((byte)dRemoteBodyPart.bodyPart);
                transforms = dRemoteBodyPart.transform;
            }
            sendStream.Write <NetEntityID>(hitView, new object[0]);
            point = transforms.InverseTransformPoint(hit.point);
        }
        sendStream.WriteVector3(point);
    }
        public ShotgunShootEvent(ShotgunDataBlock bw, ItemRepresentation ir, uLink.NetworkMessageInfo ui, IBulletWeaponItem ibw, ShotgunEventType type,
                                 IDRemoteBodyPart part, bool flag, bool flag2, bool flag3, BodyPart part2, Vector3 vector, Vector3 vector2)
        {
            TakeDamage local = ibw.inventory.GetLocal <TakeDamage>();

            _player        = Fougerite.Server.GetServer().FindPlayer(local.GetComponent <Character>().netUser.userID);
            _bw            = bw;
            _ir            = ir;
            _ibw           = ibw;
            _unmi          = ui;
            _type          = type;
            _part          = part;
            _hitnetworkobj = flag;
            _hitbodypart   = flag2;
            _isheadshot    = flag3;
            _bodypart      = part2;
            _endpos        = vector;
            _offset        = vector2;
        }
        public ShotgunShootEvent(ShotgunDataBlock bw, ItemRepresentation ir, uLink.NetworkMessageInfo ui, IBulletWeaponItem ibw, int pellets, ShotgunEventType type)
        {
            TakeDamage local = ibw.inventory.GetLocal <TakeDamage>();

            _player        = Fougerite.Server.GetServer().FindPlayer(local.GetComponent <Character>().netUser.userID);
            _bw            = bw;
            _ir            = ir;
            _ibw           = ibw;
            _unmi          = ui;
            _type          = type;
            _part          = null;
            _pellets       = pellets;
            _hitnetworkobj = false;
            _hitbodypart   = false;
            _isheadshot    = false;
            _bodypart      = BodyPart.Spine0;
            _endpos        = Vector3.zero;
            _offset        = Vector3.zero;
        }
Exemple #4
0
    // Token: 0x06003318 RID: 13080 RVA: 0x000C0BF0 File Offset: 0x000BEDF0
    protected virtual void WriteHitInfo(BitStream sendStream, ref Ray ray, bool didHit, ref RaycastHit2 hit, bool hitNetworkView, global::NetEntityID hitView)
    {
        Vector3 vector;

        if (didHit)
        {
            if (hitNetworkView)
            {
                IDRemoteBodyPart remoteBodyPart = hit.remoteBodyPart;
                Transform        transform;
                if (remoteBodyPart)
                {
                    sendStream.WriteByte(remoteBodyPart.bodyPart);
                    transform = remoteBodyPart.transform;
                }
                else
                {
                    sendStream.WriteByte(254);
                    transform = hitView.transform;
                }
                sendStream.Write <global::NetEntityID>(hitView, new object[0]);
                vector = transform.InverseTransformPoint(hit.point);
            }
            else
            {
                sendStream.WriteByte(byte.MaxValue);
                vector = hit.point;
            }
        }
        else
        {
            sendStream.WriteByte(byte.MaxValue);
            vector = ray.GetPoint(1000f);
        }
        sendStream.WriteVector3(vector);
    }
Exemple #5
0
    protected virtual void WriteHitInfo(BitStream sendStream, ref Ray ray, bool didHit, ref RaycastHit2 hit, bool hitNetworkView, NetEntityID hitView)
    {
        Vector3 point;

        if (didHit)
        {
            if (hitNetworkView)
            {
                Transform        transform;
                IDRemoteBodyPart remoteBodyPart = hit.remoteBodyPart;
                if (remoteBodyPart != null)
                {
                    sendStream.WriteByte((byte)remoteBodyPart.bodyPart);
                    transform = remoteBodyPart.transform;
                }
                else
                {
                    sendStream.WriteByte(0xfe);
                    transform = hitView.transform;
                }
                sendStream.Write <NetEntityID>(hitView, new object[0]);
                point = transform.InverseTransformPoint(hit.point);
            }
            else
            {
                sendStream.WriteByte(0xff);
                point = hit.point;
            }
        }
        else
        {
            sendStream.WriteByte(0xff);
            point = ray.GetPoint(1000f);
        }
        sendStream.WriteVector3(point);
    }
    protected virtual void ReadHitInfo(uLink.BitStream stream, out GameObject hitObj, out bool hitNetworkObj, out bool hitBodyPart, out BodyPart bodyPart, out IDRemoteBodyPart remoteBodyPart, out NetEntityID hitViewID, out Transform fromTransform, out Vector3 endPos, out Vector3 offset, out bool isHeadshot)
    {
        HitBoxSystem hitBoxSystem;
        bool         flag;
        byte         num = stream.ReadByte();

        if (num >= 255)
        {
            hitNetworkObj = false;
            hitBodyPart   = false;
            bodyPart      = BodyPart.Undefined;
        }
        else
        {
            hitNetworkObj = true;
            if (num >= 120)
            {
                hitBodyPart = false;
                bodyPart    = BodyPart.Undefined;
            }
            else
            {
                hitBodyPart = true;
                bodyPart    = (BodyPart)num;
            }
        }
        if (!hitNetworkObj)
        {
            hitViewID      = NetEntityID.unassigned;
            hitObj         = null;
            remoteBodyPart = null;
        }
        else
        {
            hitViewID = stream.Read <NetEntityID>(new object[0]);
            if (hitViewID.isUnassigned)
            {
                hitObj         = null;
                remoteBodyPart = null;
            }
            else
            {
                hitObj = hitViewID.gameObject;
                if (!hitObj)
                {
                    remoteBodyPart = null;
                }
                else
                {
                    IDBase dBase = IDBase.Get(hitObj);
                    if (!dBase)
                    {
                        remoteBodyPart = null;
                    }
                    else
                    {
                        IDMain dMain = dBase.idMain;
                        if (!dMain)
                        {
                            remoteBodyPart = null;
                        }
                        else
                        {
                            hitBoxSystem = (!(dMain is Character) ? dMain.GetRemote <HitBoxSystem>() : ((Character)dMain).hitBoxSystem);
                            if (!hitBoxSystem)
                            {
                                remoteBodyPart = null;
                            }
                            else
                            {
                                hitBoxSystem.bodyParts.TryGetValue((BodyPart)((int)bodyPart), out remoteBodyPart);
                            }
                        }
                    }
                }
            }
        }
        endPos = stream.ReadVector3();
        offset = Vector3.zero;
        if (remoteBodyPart)
        {
            flag          = false;
            fromTransform = remoteBodyPart.transform;
            BodyPart bodyPart1 = (BodyPart)((int)bodyPart);
            switch (bodyPart1)
            {
            case BodyPart.Brain:
            case BodyPart.L_Eye:
            case BodyPart.R_Eye:
            {
Label0:
                isHeadshot = true;
                break;
            }

            default:
            {
                switch (bodyPart1)
                {
                case BodyPart.Head:
                case BodyPart.Jaw:
                {
                    goto Label0;
                }

                case BodyPart.Scalp:
                case BodyPart.Nostrils:
                {
                    isHeadshot = false;
                    break;
                }

                default:
                {
                    goto case BodyPart.Nostrils;
                }
                }
                break;
            }
            }
        }
        else if (!hitObj)
        {
            fromTransform = null;
            flag          = false;
            isHeadshot    = false;
        }
        else
        {
            fromTransform = hitObj.transform;
            flag          = true;
            isHeadshot    = false;
        }
        if (fromTransform)
        {
            offset = endPos;
            endPos = fromTransform.TransformPoint(endPos);
        }
    }
Exemple #7
0
    // Token: 0x06003319 RID: 13081 RVA: 0x000C0CA0 File Offset: 0x000BEEA0
    protected virtual void ReadHitInfo(BitStream stream, out GameObject hitObj, out bool hitNetworkObj, out bool hitBodyPart, out BodyPart bodyPart, out IDRemoteBodyPart remoteBodyPart, out global::NetEntityID hitViewID, out Transform fromTransform, out Vector3 endPos, out Vector3 offset, out bool isHeadshot)
    {
        byte b = stream.ReadByte();

        if (b < 255)
        {
            hitNetworkObj = true;
            if (b < 120)
            {
                hitBodyPart = true;
                bodyPart    = (int)b;
            }
            else
            {
                hitBodyPart = false;
                bodyPart    = 0;
            }
        }
        else
        {
            hitNetworkObj = false;
            hitBodyPart   = false;
            bodyPart      = 0;
        }
        if (hitNetworkObj)
        {
            hitViewID = stream.Read <global::NetEntityID>(new object[0]);
            if (!hitViewID.isUnassigned)
            {
                hitObj = hitViewID.gameObject;
                if (hitObj)
                {
                    IDBase idbase = IDBase.Get(hitObj);
                    if (idbase)
                    {
                        IDMain idMain = idbase.idMain;
                        if (idMain)
                        {
                            global::HitBoxSystem hitBoxSystem;
                            if (idMain is global::Character)
                            {
                                hitBoxSystem = ((global::Character)idMain).hitBoxSystem;
                            }
                            else
                            {
                                hitBoxSystem = idMain.GetRemote <global::HitBoxSystem>();
                            }
                            if (hitBoxSystem)
                            {
                                hitBoxSystem.bodyParts.TryGetValue(bodyPart, ref remoteBodyPart);
                            }
                            else
                            {
                                remoteBodyPart = null;
                            }
                        }
                        else
                        {
                            remoteBodyPart = null;
                        }
                    }
                    else
                    {
                        remoteBodyPart = null;
                    }
                }
                else
                {
                    remoteBodyPart = null;
                }
            }
            else
            {
                hitObj         = null;
                remoteBodyPart = null;
            }
        }
        else
        {
            hitViewID      = global::NetEntityID.unassigned;
            hitObj         = null;
            remoteBodyPart = null;
        }
        endPos = stream.ReadVector3();
        offset = Vector3.zero;
        if (remoteBodyPart)
        {
            fromTransform = remoteBodyPart.transform;
            BodyPart bodyPart2 = bodyPart;
            switch (bodyPart2)
            {
            case 16:
            case 20:
            case 21:
                break;

            default:
                switch (bodyPart2)
                {
                case 9:
                case 12:
                    goto IL_1A3;
                }
                isHeadshot = false;
                goto IL_1B5;
            }
IL_1A3:
            isHeadshot = true;
            IL_1B5 :;
        }
        else if (hitObj)
        {
            fromTransform = hitObj.transform;
            isHeadshot    = false;
        }
        else
        {
            fromTransform = null;
            isHeadshot    = false;
        }
        if (fromTransform)
        {
            offset = endPos;
            endPos = fromTransform.TransformPoint(endPos);
        }
    }
Exemple #8
0
    protected virtual void ReadHitInfo(BitStream stream, out GameObject hitObj, out bool hitNetworkObj, out bool hitBodyPart, out BodyPart bodyPart, out IDRemoteBodyPart remoteBodyPart, out NetEntityID hitViewID, out Transform fromTransform, out Vector3 endPos, out Vector3 offset, out bool isHeadshot)
    {
        bool flag;
        byte num = stream.ReadByte();

        if (num < 0xff)
        {
            hitNetworkObj = true;
            if (num < 120)
            {
                hitBodyPart = true;
                bodyPart    = (BodyPart)num;
            }
            else
            {
                hitBodyPart = false;
                bodyPart    = BodyPart.Undefined;
            }
        }
        else
        {
            hitNetworkObj = false;
            hitBodyPart   = false;
            bodyPart      = BodyPart.Undefined;
        }
        if (hitNetworkObj)
        {
            hitViewID = stream.Read <NetEntityID>(new object[0]);
            if (!hitViewID.isUnassigned)
            {
                hitObj = hitViewID.gameObject;
                if (hitObj != null)
                {
                    IDBase base2 = IDBase.Get(hitObj);
                    if (base2 != null)
                    {
                        IDMain idMain = base2.idMain;
                        if (idMain != null)
                        {
                            HitBoxSystem hitBoxSystem;
                            if (idMain is Character)
                            {
                                hitBoxSystem = ((Character)idMain).hitBoxSystem;
                            }
                            else
                            {
                                hitBoxSystem = idMain.GetRemote <HitBoxSystem>();
                            }
                            if (hitBoxSystem != null)
                            {
                                hitBoxSystem.bodyParts.TryGetValue(bodyPart, out remoteBodyPart);
                            }
                            else
                            {
                                remoteBodyPart = null;
                            }
                        }
                        else
                        {
                            remoteBodyPart = null;
                        }
                    }
                    else
                    {
                        remoteBodyPart = null;
                    }
                }
                else
                {
                    remoteBodyPart = null;
                }
            }
            else
            {
                hitObj         = null;
                remoteBodyPart = null;
            }
        }
        else
        {
            hitViewID      = NetEntityID.unassigned;
            hitObj         = null;
            remoteBodyPart = null;
        }
        endPos = stream.ReadVector3();
        offset = Vector3.zero;
        if (remoteBodyPart == null)
        {
            if (hitObj != null)
            {
                fromTransform = hitObj.transform;
                flag          = true;
                isHeadshot    = false;
            }
            else
            {
                fromTransform = null;
                flag          = false;
                isHeadshot    = false;
            }
        }
        else
        {
            flag          = false;
            fromTransform = remoteBodyPart.transform;
            BodyPart part = bodyPart;
            switch (part)
            {
            case BodyPart.Brain:
            case BodyPart.L_Eye:
            case BodyPart.R_Eye:
                break;

            default:
                switch (part)
                {
                case BodyPart.Head:
                case BodyPart.Jaw:
                    break;

                case BodyPart.Scalp:
                case BodyPart.Nostrils:
                    goto Label_01AC;

                default:
                    goto Label_01AC;
                }
                break;
            }
            isHeadshot = true;
        }
        goto Label_01E7;
Label_01AC:
        isHeadshot = false;
Label_01E7:
        if (fromTransform != null)
        {
            offset = endPos;
            endPos = fromTransform.TransformPoint(endPos);
        }
    }