Exemplo n.º 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);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 public static void OnActiveReloadPressedHook(Action <Gun, PlayerController, Gun, bool> orig, Gun self, PlayerController p, Gun g, bool actualPress)
 {
     orig(self, p, g, actualPress);
     if (self.IsReloading || self.reloadTime < 0f)
     {
         PlayerController playerController = self.CurrentOwner as PlayerController;
         if (playerController && (actualPress || true))
         {
             MultiActiveReloadController controller = self.GetComponent <MultiActiveReloadController>();
             if (controller != null && controller.activeReloadEnabled && controller.canAttemptActiveReload && !GameUIRoot.Instance.GetReloadBarForPlayer(self.CurrentOwner as PlayerController).IsActiveReloadGracePeriod())
             {
                 bool flag2 = GameUIRoot.Instance.AttemptActiveReloadOnlyMultireload(self.CurrentOwner as PlayerController);
                 MultiActiveReload reload = GameUIRoot.Instance.GetReloadBarForPlayer(self.CurrentOwner as PlayerController).GetMultiActiveReloadForController();
                 if (flag2)
                 {
                     controller.OnActiveReloadSuccess(reload);
                     GunFormeSynergyProcessor component = self.GetComponent <GunFormeSynergyProcessor>();
                     if (component)
                     {
                         component.JustActiveReloaded = true;
                     }
                     ChamberGunProcessor component2 = self.GetComponent <ChamberGunProcessor>();
                     if (component2)
                     {
                         component2.JustActiveReloaded = true;
                     }
                 }
                 else
                 {
                     controller.OnActiveReloadFailure(reload);
                 }
                 if (reload == null || !reload.canAttemptActiveReloadAfterwards)
                 {
                     ETGModConsole.Log("yes");
                     controller.canAttemptActiveReload = false;
                     Action <PlayerController, Gun, bool> act = (Action <PlayerController, Gun, bool>)info2.CreateDelegate <Action <PlayerController, Gun, bool> >();
                     self.OnReloadPressed -= act;
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
        public static void Init(string modName)
        {
            Gun ChamberGun = PickupObjectDatabase.GetById(647) as Gun;
            ChamberGunProcessor extantProcessor = ChamberGun.GetComponent <ChamberGunProcessor>();

            if (extantProcessor)
            {
                AdvancedChamberGunController newProcessor = ChamberGun.gameObject.AddComponent <AdvancedChamberGunController>();
                newProcessor.RefillsOnFloorChange = true;
                newProcessor.primeHandlerModName  = modName;
                //newProcessor.hyperDebugMode = true;

                if (AdvancedChamberGunController.floorFormeDatas == null)
                {
                    AdvancedChamberGunController.floorFormeDatas = new List <AdvancedChamberGunController.ChamberGunData>();
                }

                #region SetupVanillaFloors
                //KEEP
                AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData()
                {
                    modName              = "Vanilla Gungeon",
                    floorTilesetID       = 2,
                    indexValue           = 1,
                    correspondingFormeID = 647,
                    viableMasterRounds   = new List <int>()
                    {
                        469,
                    }
                });
                //OUBLIETTE
                AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData()
                {
                    modName              = "Vanilla Gungeon",
                    floorTilesetID       = 4,
                    indexValue           = 1.5f,
                    correspondingFormeID = 657,
                    viableMasterRounds   = new List <int>()
                    {
                    }
                });
                //GUNGEON PROPER
                AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData()
                {
                    modName              = "Vanilla Gungeon",
                    floorTilesetID       = 1,
                    indexValue           = 2,
                    correspondingFormeID = 660,
                    viableMasterRounds   = new List <int>()
                    {
                        471,
                    }
                });
                //ABBEY
                AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData()
                {
                    modName              = "Vanilla Gungeon",
                    floorTilesetID       = 8,
                    indexValue           = 2.5f,
                    correspondingFormeID = 806,
                    viableMasterRounds   = new List <int>()
                    {
                    }
                });
                //MINES
                AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData()
                {
                    modName              = "Vanilla Gungeon",
                    floorTilesetID       = 16,
                    indexValue           = 3,
                    correspondingFormeID = 807,
                    viableMasterRounds   = new List <int>()
                    {
                        468,
                    }
                });
                //RAT FLOOR
                AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData()
                {
                    modName              = "Vanilla Gungeon",
                    floorTilesetID       = 32768,
                    indexValue           = 3.5f,
                    correspondingFormeID = 808,
                    viableMasterRounds   = new List <int>()
                    {
                    }
                });
                //HOLLOW
                AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData()
                {
                    modName              = "Vanilla Gungeon",
                    floorTilesetID       = 32,
                    indexValue           = 4,
                    correspondingFormeID = 659,
                    viableMasterRounds   = new List <int>()
                    {
                        470,
                    }
                });
                //R&G DEPT
                AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData()
                {
                    modName              = "Vanilla Gungeon",
                    floorTilesetID       = 2048,
                    indexValue           = 4.5f,
                    correspondingFormeID = 823,
                    viableMasterRounds   = new List <int>()
                    {
                    }
                });
                //FORGE
                AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData()
                {
                    modName              = "Vanilla Gungeon",
                    floorTilesetID       = 64,
                    indexValue           = 5,
                    correspondingFormeID = 658,
                    viableMasterRounds   = new List <int>()
                    {
                        467,
                    }
                });
                //BULLET HELL
                AdvancedChamberGunController.floorFormeDatas.Add(new AdvancedChamberGunController.ChamberGunData()
                {
                    modName              = "Vanilla Gungeon",
                    floorTilesetID       = 128,
                    indexValue           = 6,
                    correspondingFormeID = 763,
                    viableMasterRounds   = new List <int>()
                    {
                    }
                });
                #endregion

                ETGMod.StartGlobalCoroutine(postStart(newProcessor, modName));

                UnityEngine.Object.Destroy(extantProcessor);
                Debug.Log($"Mod '{modName}' correctly initialised the ChamberGunAPI and is the prime handler.");
            }
            else
            {
                Debug.Log($"Mod '{modName}' did not alter the Chamber Gun, as the Chamber Gun was already altered.");
            }
        }