// Called when loaded by BepInEx private void Awake() { // Init configs configs = Configurations.Instance(); // Handler: Override core variables On.RoR2.CombatDirector.Awake += (orig, self) => { self.minSeriesSpawnInterval = seriesSpawnInterval[0]; self.maxSeriesSpawnInterval = seriesSpawnInterval[1]; self.minRerollSpawnInterval = rerollSpawnInterval[0]; self.maxRerollSpawnInterval = rerollSpawnInterval[1]; orig(self); }; // Handler: Monster credit manipulator On.RoR2.CombatDirector.Simulate += (orig, self, deltaTime) => { if (!IsModuleEnabled()) { orig(self, deltaTime); return; } // Update interval monsterCreditTimer -= deltaTime; // Update credit for faster spawns if (monsterCreditTimer < 0) { // Credit multiplier float creditMultiplier = configs.SpawnIntensity.Value; float additionalPlayers = NetworkUser.readOnlyInstancesList.Count - 1f; creditMultiplier += additionalPlayers * configs.SpawnIntensityPerPlayer.Value; // Spawn boost min max float minBaseCredit = monsterCreditBase[0]; float maxBaseCredit = monsterCreditBase[1] + (GetStageCount() * creditMultiplier); // Scale difficulty self.monsterCredit *= creditMultiplier > 0 ? creditMultiplier : 1; if (configs.BoostSpawnRates.Value && self.monsterCredit < minBaseCredit) { self.monsterCredit = Random.Range(minBaseCredit, maxBaseCredit); } if (configs.IsDeveloperMode.Value) { Chat.AddMessage("Spawn Credit: " + self.monsterCredit); } // Reset timer monsterCreditTimer = Random.Range(monsterCreditInterval[0], monsterCreditInterval[1]); } orig(self, deltaTime); }; // Handler: Drop rewards On.RoR2.DeathRewards.OnKilledServer += (orig, self, damageReport) => { if (IsModuleEnabled()) { DropHandler.Instance().DropLoot(damageReport); } orig(self, damageReport); }; }
public static DropHandler Instance() { return(instance ?? (instance = new DropHandler())); }