Пример #1
0
        // Token: 0x060001DE RID: 478 RVA: 0x00011794 File Offset: 0x0000F994
        public static void OnActiveReloadPressedHook(Action <Gun, PlayerController, Gun, bool> orig, Gun self, PlayerController p, Gun g, bool actualPress)
        {
            orig(self, p, g, actualPress);
            bool flag = self.IsReloading || self.reloadTime < 0f;

            if (flag)
            {
                PlayerController exists = self.CurrentOwner as PlayerController;
                bool             flag2  = exists && (actualPress || true);
                if (flag2)
                {
                    MultiActiveReloadController component = self.GetComponent <MultiActiveReloadController>();
                    bool flag3 = component != null && component.activeReloadEnabled && component.canAttemptActiveReload && !GameUIRoot.Instance.GetReloadBarForPlayer(self.CurrentOwner as PlayerController).IsActiveReloadGracePeriod();
                    if (flag3)
                    {
                        bool flag4 = GameUIRoot.Instance.AttemptActiveReloadOnlyMultireload(self.CurrentOwner as PlayerController);
                        MultiActiveReload multiActiveReloadForController = GameUIRoot.Instance.GetReloadBarForPlayer(self.CurrentOwner as PlayerController).GetMultiActiveReloadForController();
                        bool flag5 = flag4;
                        if (flag5)
                        {
                            component.OnActiveReloadSuccess(multiActiveReloadForController);
                            GunFormeSynergyProcessor component2 = self.GetComponent <GunFormeSynergyProcessor>();
                            bool flag6 = component2;
                            if (flag6)
                            {
                                component2.JustActiveReloaded = true;
                            }
                            ChamberGunProcessor component3 = self.GetComponent <ChamberGunProcessor>();
                            bool flag7 = component3;
                            if (flag7)
                            {
                                component3.JustActiveReloaded = true;
                            }
                        }
                        else
                        {
                            component.OnActiveReloadFailure(multiActiveReloadForController);
                        }
                        bool flag8 = multiActiveReloadForController == null || !multiActiveReloadForController.canAttemptActiveReloadAfterwards;
                        if (flag8)
                        {
                            ETGModConsole.Log("yes", false);
                            component.canAttemptActiveReload = false;
                            Action <PlayerController, Gun, bool> value = (Action <PlayerController, Gun, bool>)MultiActiveReloadManager.info2.CreateDelegate <Action <PlayerController, Gun, bool> >();
                            self.OnReloadPressed = (Action <PlayerController, Gun, bool>)Delegate.Remove(self.OnReloadPressed, value);
                        }
                    }
                }
            }
        }
Пример #2
0
        // Token: 0x060001E3 RID: 483 RVA: 0x00011AA4 File Offset: 0x0000FCA4
        public virtual void OnActiveReloadSuccess(MultiActiveReload reload)
        {
            bool flag = reload == null || reload.stopsReload;

            if (flag)
            {
                MultiActiveReloadController.info.Invoke(this.gun, new object[]
                {
                    true,
                    false,
                    false
                });
            }
            float num   = 1f;
            bool  flag2 = Gun.ActiveReloadActivated && base.PickedUpByPlayer && base.Player.IsPrimaryPlayer;

            if (flag2)
            {
                num *= CogOfBattleItem.ACTIVE_RELOAD_DAMAGE_MULTIPLIER;
            }
            bool flag3 = Gun.ActiveReloadActivatedPlayerTwo && base.PickedUpByPlayer && !base.Player.IsPrimaryPlayer;

            if (flag3)
            {
                num *= CogOfBattleItem.ACTIVE_RELOAD_DAMAGE_MULTIPLIER;
            }
            bool flag4 = reload == null || reload.usesActiveReloadData;

            if (flag4)
            {
                bool flag5 = this.gun.LocalActiveReload && (reload == null || reload.reloadData == null);
                if (flag5)
                {
                    num *= Mathf.Pow(this.gun.activeReloadData.damageMultiply, (float)((int)MultiActiveReloadController.info2.GetValue(this.gun) + 1));
                }
                else
                {
                    bool flag6 = reload != null && reload.reloadData != null;
                    if (flag6)
                    {
                        num *= Mathf.Pow(reload.reloadData.damageMultiply, reload.reloadData.ActiveReloadStacks ? ((float)((int)MultiActiveReloadController.info2.GetValue(this.gun) + 1)) : 1f);
                    }
                }
            }
            this.damageMult = num;
        }
Пример #3
0
        // Token: 0x060001DF RID: 479 RVA: 0x00011928 File Offset: 0x0000FB28
        public static MultiActiveReload GetMultiActiveReloadForController(this GameUIReloadBarController controller)
        {
            MultiActiveReload result = null;
            bool flag = MultiActiveReloadManager.tempraryActiveReloads.ContainsKey(controller);

            if (flag)
            {
                foreach (MultiActiveReload multiActiveReload in MultiActiveReloadManager.tempraryActiveReloads[controller])
                {
                    bool flag2 = controller.progressSlider.Value >= (float)multiActiveReload.startValue && controller.progressSlider.Value <= (float)multiActiveReload.endValue;
                    if (flag2)
                    {
                        result = multiActiveReload;
                        break;
                    }
                }
            }
            return(result);
        }
Пример #4
0
        // Token: 0x060001DA RID: 474 RVA: 0x000110B4 File Offset: 0x0000F2B4
        public static void TriggerReloadHook(MultiActiveReloadManager.Action <GameUIReloadBarController, PlayerController, Vector3, float, float, int> orig, GameUIReloadBarController self, PlayerController attachParent, Vector3 offset, float duration, float activeReloadStartPercent, int pixelWidth)
        {
            bool flag = MultiActiveReloadManager.tempraryActiveReloads.ContainsKey(self);

            if (flag)
            {
                foreach (MultiActiveReload multiActiveReload in MultiActiveReloadManager.tempraryActiveReloads[self])
                {
                    bool flag2 = multiActiveReload.sprite != null && multiActiveReload.sprite.gameObject != null;
                    if (flag2)
                    {
                        UnityEngine.Object.Destroy(multiActiveReload.sprite.gameObject);
                    }
                    bool flag3 = multiActiveReload.celebrationSprite != null && multiActiveReload.celebrationSprite.gameObject != null;
                    if (flag3)
                    {
                        UnityEngine.Object.Destroy(multiActiveReload.celebrationSprite.gameObject);
                    }
                }
                MultiActiveReloadManager.tempraryActiveReloads[self].Clear();
            }
            orig(self, attachParent, offset, duration, activeReloadStartPercent, pixelWidth);
            bool flag4 = attachParent != null && attachParent.CurrentGun != null && attachParent.CurrentGun.GetComponent <MultiActiveReloadController>() != null;

            if (flag4)
            {
                foreach (MultiActiveReloadData multiActiveReloadData in attachParent.CurrentGun.GetComponent <MultiActiveReloadController>().reloads)
                {
                    dfSprite dfSprite = UnityEngine.Object.Instantiate <dfSprite>(self.activeReloadSprite);
                    self.activeReloadSprite.Parent.AddControl(dfSprite);
                    dfSprite.enabled = true;
                    float width    = self.progressSlider.Width;
                    float maxValue = self.progressSlider.MaxValue;
                    float num      = (float)multiActiveReloadData.startValue / maxValue * width;
                    float num2     = (float)multiActiveReloadData.endValue / maxValue * width;
                    float x        = num + (num2 - num) * multiActiveReloadData.activeReloadStartPercentage;
                    float width2   = (float)pixelWidth * Pixelator.Instance.CurrentTileScale;
                    dfSprite.RelativePosition = self.activeReloadSprite.RelativePosition;
                    dfSprite.RelativePosition = GameUIUtility.QuantizeUIPosition(dfSprite.RelativePosition.WithX(x));
                    dfSprite.Width            = width2;
                    dfSprite.IsVisible        = true;
                    dfSprite dfSprite2 = UnityEngine.Object.Instantiate <dfSprite>(self.celebrationSprite);
                    self.activeReloadSprite.Parent.AddControl(dfSprite2);
                    dfSprite2.enabled = true;
                    dfSpriteAnimation component = dfSprite2.GetComponent <dfSpriteAnimation>();
                    component.Stop();
                    component.SetFrameExternal(0);
                    dfSprite2.enabled          = false;
                    dfSprite2.RelativePosition = dfSprite.RelativePosition + new Vector3(Pixelator.Instance.CurrentTileScale * -1f, Pixelator.Instance.CurrentTileScale * -2f, 0f);
                    int num3 = Mathf.RoundToInt((float)(multiActiveReloadData.endValue - multiActiveReloadData.startValue) * multiActiveReloadData.activeReloadStartPercentage) + multiActiveReloadData.startValue - multiActiveReloadData.activeReloadLastTime / 2;
                    MultiActiveReload item = new MultiActiveReload
                    {
                        sprite            = dfSprite,
                        celebrationSprite = dfSprite2,
                        startValue        = num3,
                        endValue          = num3 + multiActiveReloadData.activeReloadLastTime,
                        stopsReload       = multiActiveReloadData.stopsReload,
                        canAttemptActiveReloadAfterwards = multiActiveReloadData.canAttemptActiveReloadAfterwards,
                        reloadData           = multiActiveReloadData.reloadData,
                        usesActiveReloadData = multiActiveReloadData.usesActiveReloadData,
                        Name = multiActiveReloadData.Name
                    };
                    bool flag5 = MultiActiveReloadManager.tempraryActiveReloads.ContainsKey(self);
                    if (flag5)
                    {
                        MultiActiveReloadManager.tempraryActiveReloads[self].Add(item);
                    }
                    else
                    {
                        MultiActiveReloadManager.tempraryActiveReloads.Add(self, new List <MultiActiveReload>
                        {
                            item
                        });
                    }
                }
            }
        }
Пример #5
0
 // Token: 0x060001E5 RID: 485 RVA: 0x00011C45 File Offset: 0x0000FE45
 public virtual void OnActiveReloadFailure(MultiActiveReload reload)
 {
     this.damageMult = 1f;
 }