Esempio n. 1
0
    protected void Mods(byte[] data)
    {
        this.ClearMods();
        uLink.BitStream stream = new uLink.BitStream(data, false);
        byte            num    = stream.ReadByte();

        if (num > 0)
        {
            CharacterStateFlags characterStateFlags = this.GetCharacterStateFlags();
            for (int i = 0; i < num; i++)
            {
                ItemModDataBlock byUniqueID = (ItemModDataBlock)DatablockDictionary.GetByUniqueID(stream.ReadInt32());
                this._itemMods.InstallMod(i, this, byUniqueID, characterStateFlags);
                this._modFlags |= byUniqueID.modFlag;
            }
        }
    }
Esempio n. 2
0
    private bool ClearMods()
    {
        bool modLock = this.modLock;

        if (this.modLock)
        {
            return(false);
        }
        this._modFlags = ItemModFlags.Other;
        try
        {
            this.modLock = true;
            for (int i = 0; i < 5; i++)
            {
                this._itemMods.ClearModPair(i, this);
            }
        }
        finally
        {
            this.modLock = modLock;
        }
        return(true);
    }
Esempio n. 3
0
    protected void UpdateInput()
    {
        bool            flag;
        bool            flag1;
        InventoryHolder inventoryHolder = this.inventoryHolder;

        PlayerClient.InputFunction(base.gameObject);
        if (!inventoryHolder)
        {
            int num = 1;
            flag1 = (bool)num;
            flag  = (bool)num;
        }
        else
        {
            ItemModFlags itemModFlag = inventoryHolder.modFlags;
            flag  = (itemModFlag & ItemModFlags.Lamp) == ItemModFlags.Other;
            flag1 = (itemModFlag & ItemModFlags.Laser) == ItemModFlags.Other;
        }
        HumanController.InputSample crouchWasBlocked = HumanController.InputSample.Poll(flag, flag1);
        crouchWasBlocked.info__crouchBlocked = this.crouch_was_blocked;
        bool legInjury = base.GetLocal <FallDamage>().GetLegInjury() > 0f;

        if (legInjury)
        {
            crouchWasBlocked.crouch = true;
            crouchWasBlocked.jump   = false;
        }
        if (crouchWasBlocked.walk <= 0f || Mathf.Abs(crouchWasBlocked.strafe) >= 0.05f || crouchWasBlocked.attack2 || this._inventory.isCrafting || legInjury)
        {
            crouchWasBlocked.sprint = false;
        }
        float single = 1f;

        if (this._inventory.isCrafting)
        {
            single = single * 0.5f;
        }
        if (legInjury)
        {
            single = single * 0.5f;
        }
        HumanController.InputSample.MovementScale = single;
        if (!inventoryHolder)
        {
            this.ProcessInput(ref crouchWasBlocked);
        }
        else
        {
            object obj = inventoryHolder.InvokeInputItemPreFrame(ref crouchWasBlocked);
            this.ProcessInput(ref crouchWasBlocked);
            inventoryHolder.InvokeInputItemPostFrame(obj, ref crouchWasBlocked);
        }
        this.CheckBeltUsage();
        if (this.wasSprinting && !crouchWasBlocked.sprint)
        {
            this.SprintingStopped();
        }
        else if (!this.wasSprinting && crouchWasBlocked.sprint)
        {
            this.SprintingStarted();
        }
    }
Esempio n. 4
0
    protected void UpdateInput()
    {
        bool            flag;
        bool            flag2;
        InventoryHolder inventoryHolder = this.inventoryHolder;

        PlayerClient.InputFunction(base.gameObject);
        if (inventoryHolder != null)
        {
            ItemModFlags modFlags = inventoryHolder.modFlags;
            flag  = (modFlags & ItemModFlags.Lamp) == ItemModFlags.Other;
            flag2 = (modFlags & ItemModFlags.Laser) == ItemModFlags.Other;
        }
        else
        {
            flag = flag2 = true;
        }
        InputSample sample = InputSample.Poll(flag, flag2);

        sample.info__crouchBlocked = this.crouch_was_blocked;
        bool flag3 = base.GetLocal <FallDamage>().GetLegInjury() > 0f;

        if (flag3)
        {
            sample.crouch = true;
            sample.jump   = false;
        }
        if (((sample.walk <= 0f) || (Mathf.Abs(sample.strafe) >= 0.05f)) || ((sample.attack2 || this._inventory.isCrafting) || flag3))
        {
            sample.sprint = false;
        }
        float num = 1f;

        if (this._inventory.isCrafting)
        {
            num *= 0.5f;
        }
        if (flag3)
        {
            num *= 0.5f;
        }
        InputSample.MovementScale = num;
        if (inventoryHolder != null)
        {
            object item = inventoryHolder.InvokeInputItemPreFrame(ref sample);
            this.ProcessInput(ref sample);
            inventoryHolder.InvokeInputItemPostFrame(item, ref sample);
        }
        else
        {
            this.ProcessInput(ref sample);
        }
        this.CheckBeltUsage();
        if (this.wasSprinting && !sample.sprint)
        {
            this.SprintingStopped();
        }
        else if (!this.wasSprinting && sample.sprint)
        {
            this.SprintingStarted();
        }
    }