public void Awake()
        {
            if (!RoR2Application.isModded)
            {
                RoR2Application.isModded = true;
            }

            if (Chainloader.PluginInfos.ContainsKey("com.funkfrog_sipondo.sharesuite"))
            {
                ShareSuite = Chainloader.PluginInfos["com.funkfrog_sipondo.sharesuite"].Instance;
                AddMoney   = ShareSuite.GetType().GetMethod("AddMoneyExternal", BindingFlags.Instance | BindingFlags.Public);
            }

            const string moneySection = "Money";

            var conUtil = new ConditionalUtil(this.Config);

            LatestStageToReceiveMoney = conUtil.AddConditionalConfig <uint>(
                moneySection,
                nameof(LatestStageToReceiveMoney),
                4,
                false,
                new ConfigDescription("Enable to set a latest stage you wish to receive a bonus on. E.g. set this to 4 and you will receive bonus for first 4 rounds and then none after.")
                );

            StageFlatMoney = Config.Bind <uint>(
                moneySection,
                nameof(StageFlatMoney),
                0,
                new ConfigDescription(
                    "The flat amount of extra money the player should receive at beginning of each stage"
                    )
                );

            StageWeightedMoney = Config.Bind <float>(
                moneySection,
                nameof(StageWeightedMoney),
                1.0f,
                new ConfigDescription(
                    "The equivalent number of small chest worth of money you get at start of each stage"
                    )
                );

            RoR2.SceneDirector.onPostPopulateSceneServer += SceneDirector_onPostPopulateSceneServer;
        }
        public void Awake()
        {
            if (!RoR2Application.isModded)
            {
                RoR2Application.isModded = true;
            }

            #region ConfigSetup
            const string votesSection = "Votes";

            VotesEnabled = Config.Bind <bool>(
                votesSection,
                "Enable Votes",
                true,
                new ConfigDescription(
                    "Disable this to bypass voting (i.e. interact with teleporter etc as normal)"
                    ));

            EnableTimerCountdown = Config.Bind <bool>(
                votesSection,
                "Enable Timer Countdown",
                true,
                new ConfigDescription(
                    "Enable/Disable countdown timer to override vote"
                    ));

            ChatCommandCanStartTimer = Config.Bind <bool>(
                votesSection,
                "ChatCommandCanStartTimer",
                false,
                new ConfigDescription(
                    "When enabled the timer can be started by chat command. If disabled timer only starts on interaction.",
                    null,
                    "Advanced"
                    ));

            var cUtil = new ConditionalUtil(this.Config);
            MaximumVotes = cUtil.AddConditionalConfig <int>(
                votesSection,
                "Maximum Votes",
                4,
                false,
                new ConfigDescription(
                    "Enable to set maximum number of votes needed to continue (regardless of player count)."
                    ));
            #endregion

            #region HookRegistration
            //Main hooks - triggers restriction logics
            On.RoR2.TeleporterInteraction.OnInteractionBegin      += TeleporterInteraction_OnInteractionBegin;
            TeleporterInteraction.onTeleporterBeginChargingGlobal += TeleporterInteraction_onTeleporterBeginChargingGlobal;
            TeleporterInteraction.onTeleporterChargedGlobal       += TeleporterInteraction_onTeleporterChargedGlobal;
            TeleporterInteraction.onTeleporterFinishGlobal        += TeleporterInteraction_onTeleporterFinishGlobal;
            On.RoR2.Interactor.PerformInteraction += Interactor_PerformInteraction;
            On.RoR2.PlayerCharacterMasterController.OnBodyDeath += PlayerCharacterMasterController_OnBodyDeath;

            //Chat Ready Command - type "r" to set yourself as ready
            Chat.onChatChanged += Chat_onChatChanged;

            //Prevent an exploitative interaction with teleporter and fireworks
            //IL.RoR2.GlobalEventManager.OnInteractionBegin += GlobalEventManager_OnInteractionBegin;

            //Cleanup Hooks - Needed to avoid bugs where list persists from one run to another
            Run.onRunDestroyGlobal += Run_onRunDestroyGlobal;
            On.RoR2.Run.BeginStage += Run_BeginStage;
            On.RoR2.Run.EndStage   += Run_EndStage;
            #endregion
        }
示例#3
0
        public void Awake()
        {
            if (!RoR2Application.isModded)
            {
                RoR2Application.isModded = true;
            }

            #region ConfigWrappers
            const string infusionSectionName = "Infusion";
            const string engineerSectionName = "Engineer";

            var conditionalUtil = new ConditionalUtil(this.Config);
            MaximumHealthPerInfusion = conditionalUtil.AddConditionalConfig <uint>(
                infusionSectionName,
                nameof(MaximumHealthPerInfusion),
                100,
                true,
                new ConfigDescription("Maximum health gained per infusion. Disable for no limit."));

            MaxHealthGainPerKill = conditionalUtil.AddConditionalConfig <uint>(
                infusionSectionName,
                nameof(MaxHealthGainPerKill),
                5,
                false,
                new ConfigDescription(
                    "Enable to set the maximum value for health gain per kill."
                    )
                );

            TurretReceivesBonusFromEngineer = Config.Bind <bool>(
                engineerSectionName,
                nameof(TurretReceivesBonusFromEngineer),
                true,
                new ConfigDescription(
                    "If enabled then turrets will receive the current infusion bonus of the Engineer on creation"
                    )
                );

            TurretGivesEngineerLifeOrbs = Config.Bind <bool>(
                engineerSectionName,
                nameof(TurretGivesEngineerLifeOrbs),
                true,
                new ConfigDescription(
                    "If enabled the main engineer body will receive an infusion orb whenever a turret he owns makes a kill"
                    )
                );

            MaximumHealth = Config.Bind(
                infusionSectionName,
                nameof(MaximumHealth),
                999999,
                new ConfigDescription(
                    "Maximum Health you can reach with infusion bonuses - this value probably never needs to change",
                    null,
                    "Advanced"
                    )
                );
            #endregion

            On.RoR2.Inventory.AddInfusionBonus          += Inventory_AddInfusionBonus;
            On.RoR2.GlobalEventManager.OnCharacterDeath += GlobalEventManager_OnCharacterDeath;
            IL.RoR2.GlobalEventManager.OnCharacterDeath += GlobalEventManager_OnCharacterDeath1;
            On.RoR2.CharacterMaster.AddDeployable       += CharacterMaster_AddDeployable;
        }