using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ButteRyBalance.Components; using ButteRyBalance.NetcodePatcher; using ButteRyBalance.Network; using ButteRyBalance.Overrides; using ButteRyBalance.Overrides.Moons; using ButteRyBalance.Patches; using ButteRyBalance.Patches.Items; using ButteRyBalance.Utilities; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using MonoMod.Utils; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: AssemblyCompany("ButteRyBalance")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Buttery's rebalances")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a2d55ac06ef6acf298b57dcfc257e3d5f0a993ab")] [assembly: AssemblyProduct("ButteRyBalance")] [assembly: AssemblyTitle("ButteRyBalance")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ButteRyBalance { internal class Common { internal enum DamageID { Unknown = -1, Shovel = 1, Knife = 5, Cruiser = 331 } internal const int NUM_LEVELS = 13; internal static bool INSTALLED_ARTIFICE_BLIZZARD; internal static bool INSTALLED_BARBER_FIXES; internal static bool INSTALLED_SPAWN_CYCLE_FIXES; internal static bool INSTALLED_VERSION55_COMPANY_CRUISER; internal static bool INSTALLED_FAIRER_FIRE_EXITS; internal static GameObject artificeBlizzard; internal static Dictionary enemies = new Dictionary(); private static Terminal terminal; internal static List caveTiles = new List(); internal static VehicleController vehicleController; internal static List extraFireExits = new List(); internal static int fireExitCount = 0; internal static List tempNetObjs = new List(); internal static string lastSceneLoaded = string.Empty; internal static Terminal Terminal { get { if ((Object)(object)terminal == (Object)null) { terminal = Object.FindAnyObjectByType(); } return terminal; } } internal static void Disconnect() { enemies.Clear(); caveTiles.Clear(); extraFireExits.Clear(); CleanTemporaryNetworkObjects(); } internal static bool IsSnowLevel() { if (StartOfRound.Instance.currentLevel.levelIncludesSnowFootprints) { if (!((Object)(object)artificeBlizzard == (Object)null)) { return artificeBlizzard.activeSelf; } return true; } return false; } internal static void CacheCaveTiles() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) caveTiles.Clear(); if (RoundManager.Instance.currentDungeonType != 4) { return; } GameObject val = RoundManager.Instance.dungeonGenerator?.Root ?? GameObject.Find("/Systems/LevelGeneration/LevelGenerationRoot"); if ((Object)(object)val == (Object)null) { if (((Object)StartOfRound.Instance.currentLevel).name != "CompanyBuildingLevel") { Plugin.Logger.LogWarning((object)"Landed on a moon with no dungeon generated. This shouldn't happen"); } return; } Tile[] componentsInChildren = val.GetComponentsInChildren(); foreach (Tile val2 in componentsInChildren) { if (((Object)val2).name.StartsWith("Cave")) { caveTiles.Add(val2.OverrideAutomaticTileBounds ? UnityUtil.TransformBounds(((Component)val2).transform, val2.TileBoundsOverride) : val2.Bounds); } } } internal static void CleanTemporaryNetworkObjects() { if (((NetworkBehaviour)BRBNetworker.Instance).IsServer) { foreach (NetworkObject tempNetObj in tempNetObjs) { if (!((Object)(object)tempNetObj == (Object)null)) { Plugin.Logger.LogDebug((object)("Despawning \"" + ((Object)tempNetObj).name + "\" on server (temporary network object)")); tempNetObj.Despawn(true); } } } tempNetObjs.Clear(); } } internal class Configuration { internal enum DineScrap { DontChange, Consolidate, Rollback } internal enum SnowmanFrequency { None, Rare, Lots } internal enum JetpackControls { Vanilla, V49, Dynamic } internal const int MIN_PRICE = 10; internal const int MAX_PRICE = 250000; private static ConfigFile configFile; internal static ConfigEntry coilheadStunReset; internal static ConfigEntry jesterWalkThrough; internal static ConfigEntry butlerManorChance; internal static ConfigEntry butlerStealthStab; internal static ConfigEntry butlerLongCooldown; internal static ConfigEntry jesterLongCooldown; internal static ConfigEntry butlerKnifePrice; internal static ConfigEntry knifeShortCooldown; internal static ConfigEntry knifeAutoSwing; internal static ConfigEntry maneaterLimitGrowth; internal static ConfigEntry maneaterWideTurns; internal static ConfigEntry maneaterScrapGrowth; internal static ConfigEntry moonsKillSwitch; internal static ConfigEntry dineReduceButlers; internal static ConfigEntry barberDynamicSpawns; internal static ConfigEntry foggyLimit; internal static ConfigEntry experimentationNoEvents; internal static ConfigEntry experimentationNoGiants; internal static ConfigEntry experimentationNoEggs; internal static ConfigEntry experimentationBuffScrap; internal static ConfigEntry randomIndoorFog; internal static ConfigEntry assuranceNerfScrap; internal static ConfigEntry assuranceMasked; internal static ConfigEntry vowNoCoils; internal static ConfigEntry vowMineshafts; internal static ConfigEntry offenseBuffScrap; internal static ConfigEntry offenseMasked; internal static ConfigEntry offenseNerfEclipse; internal static ConfigEntry vowNoTraps; internal static ConfigEntry marchBuffScrap; internal static ConfigEntry butlerSquishy; internal static ConfigEntry adamanceBuffScrap; internal static ConfigEntry coilheadCurves; internal static ConfigEntry rendShrink; internal static ConfigEntry rendWorms; internal static ConfigEntry metalSheetPrice; internal static ConfigEntry coilheadPower; internal static ConfigEntry dineAdjustOutdoor; internal static ConfigEntry titanBuffScrap; internal static ConfigEntry titanAddGold; internal static ConfigEntry titanAdjustEnemies; internal static ConfigEntry titanWeeds; internal static ConfigEntry giantSnowSight; internal static ConfigEntry dineFloods; internal static ConfigEntry robotFog; internal static ConfigEntry nutcrackerGunPrice; internal static ConfigEntry nutcrackerKevlar; internal static ConfigEntry jetpackBattery; internal static ConfigEntry jetpackReduceDiscount; internal static ConfigEntry artificeBuffScrap; internal static ConfigEntry artificeInteriors; internal static ConfigEntry artificeTurrets; internal static ConfigEntry zapGunPrice; internal static ConfigEntry radarBoosterPrice; internal static ConfigEntry stunGrenadePrice; internal static ConfigEntry scrapAdjustWeights; internal static ConfigEntry maneaterPower; internal static ConfigEntry embrionWeeds; internal static ConfigEntry embrionAdjustEnemies; internal static ConfigEntry embrionMega; internal static ConfigEntry infestationRework; internal static ConfigEntry infestationButlers; internal static ConfigEntry infestationMasked; internal static ConfigEntry infestationBarbers; internal static ConfigEntry zapGunBattery; internal static ConfigEntry offenseBees; internal static ConfigEntry apparatusPrice; internal static ConfigEntry spikeTrapDistance; internal static ConfigEntry infestationThumpers; internal static ConfigEntry coilheadPersistence; internal static ConfigEntry giantSquishy; internal static ConfigEntry hoarderAngerManagement; internal static ConfigEntry infestationSnareFlea; internal static ConfigEntry infestationCoilhead; internal static ConfigEntry foxSlender; internal static ConfigEntry adamanceNerfEclipse; internal static ConfigEntry adamanceReduceCadavers; internal static ConfigEntry cadaversPower; internal static ConfigEntry pufferPower; internal static ConfigEntry spikeTrapMineshaft; internal static ConfigEntry jetpackUtility; internal static ConfigEntry infestationGunkfish; internal static ConfigEntry adamanceInteriors; internal static ConfigEntry adamanceNoMasks; internal static ConfigEntry offenseNerfTraps; internal static ConfigEntry assuranceGiants; internal static ConfigEntry dineMineshafts; internal static ConfigEntry proFlashlightPrice; internal static ConfigEntry vowMisty; internal static ConfigEntry nerfNightVision; internal static ConfigEntry marchAdjustEnemies; internal static ConfigEntry gunkfishSquishy; internal static ConfigEntry shovelBuffer; internal static ConfigEntry stunLonger; internal static ConfigEntry maneaterTarget; internal static ConfigEntry cadaverTarget; internal static ConfigEntry cavernsNoKeys; internal static ConfigEntry jetpackWarmUp; internal static ConfigEntry cruiserItemSafety; internal static ConfigEntry cruiserExhaust; internal static ConfigEntry cruiserRegen; internal static ConfigEntry cruiserTrees; internal static ConfigEntry cruiserEnemyDamage; internal static ConfigEntry cruiserCrashDamage; internal static ConfigEntry weaponsAdjustWeights; internal static ConfigEntry butlerNoSearch; internal static ConfigEntry offenseFireExits; internal static ConfigEntry dineFireExits; internal static ConfigEntry proportionalFireExits; internal static ConfigEntry dineScrapPool; internal static ConfigEntry rendSnowmen; internal static ConfigEntry dineSnowmen; internal static ConfigEntry titanSnowmen; internal static ConfigEntry cruiserPrice; internal static ConfigEntry jetpackPrice; internal static ConfigEntry weedKillerDamage; internal static ConfigEntry jetpackControls; internal static void Init(ConfigFile cfg) { configFile = cfg; MiscConfig(); InfestationConfig(); EnemyConfig(); ItemConfig(); VehicleConfig(); MoonConfig(); MigrateLegacyConfig(); } private static void ItemConfig() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown scrapAdjustWeights = configFile.Bind("Items", "Adjust Scrap Weights", false, "Makes some minor alterations to the weight of several scrap items."); apparatusPrice = configFile.Bind("Item.Apparatus", "Randomize Price", false, "Randomizes the price of the apparatus once it has been unplugged."); jetpackBattery = configFile.Bind("Item.Jetpack", "Reduce Battery", true, "Reduces jetpack battery back to 40s (from 50s), like the v50 beta."); jetpackPrice = configFile.Bind("Item.Jetpack", "Price", 900, new ConfigDescription("Alters the price of the Jetpack. $700 is the original price from launch. $900 is the current vanilla price.", (AcceptableValueBase)(object)new AcceptableValueRange(10, 250000), Array.Empty())); jetpackReduceDiscount = configFile.Bind("Item.Jetpack", "Reduce Max Discount", false, "Jetpack price will never go beyond 60% off ($180 -> $360)"); jetpackControls = configFile.Bind("Item.Jetpack", "Control Scheme", JetpackControls.Dynamic, "Controls how the jetpacks' speed and handling are set.\n\"Vanilla\" makes no changes.\n\"V49\" restores the classic control scheme, with much stronger inertia, meaning you must pre-emptively adjust your momentum.\n\"Dynamic\" adjusts speed and handling based on your carried weight (light weight = high speed, poor handling; heavy weight = low speed, smooth handling)"); jetpackWarmUp = configFile.Bind("Item.Jetpack", "Warmup Period", true, "When first activated, jetpacks take a brief period of time to warm up to maximum thrust power, leaving you more vulnerable to enemies."); jetpackUtility = configFile.Bind("Item.Jetpack", "No Utility Belt", true, "Blacklists the jetpack from the utility belt, like shovels. This means you can only fly 3 scraps at a time like before."); knifeShortCooldown = configFile.Bind("Item.KitchenKnife", "Short Cooldown", true, "The knife will deal damage faster."); knifeAutoSwing = configFile.Bind("Item.KitchenKnife", "Auto-Swing", true, "(Client-side) Holding the attack button will automatically swing the knife. When damage is dealt, your swing speed will decrease to avoid wasting hits."); proFlashlightPrice = configFile.Bind("Item.ProFlashlight", "Nerf Price", true, "Increases the cost of pro-flashlights from $28 to $32, like the first v80 beta."); radarBoosterPrice = configFile.Bind("Item.RadarBooster", "Buff Price", true, "Reduces the cost of the radar booster from $60 to $50, like in v40."); shovelBuffer = configFile.Bind("Item.Shovel", "Input Buffer", true, "(Client-side) Clicking the attack button shortly before the shovel is readied will \"buffer\" your input, winding up as soon as the shovel finishes its swing."); weaponsAdjustWeights = configFile.Bind("Item.Shovel", "Adjust Weapon Weights", false, "Makes shovels heavier. Stop signs and yield signs become much lighter, both of which would now be lighter weight than the vanilla shovel."); stunGrenadePrice = configFile.Bind("Item.StunGrenade", "Nerf Price", true, "Increases the cost of stun grenades from $30 to $40, like in v40."); stunLonger = configFile.Bind("Item.StunGrenade", "Stun Longer", true, "Increases the effectiveness of stun grenades against certain enemies. (Like hoarding bugs and thumpers)"); metalSheetPrice = configFile.Bind("Item.MetalSheet", "Increase Value", false, "Increases the average sell value of metal sheets."); weedKillerDamage = configFile.Bind("Item.WeedKiller", "Player Damage", 7, new ConfigDescription("How much damage is dealt to players that are sprayed with weed killer while infected by Cadavers. In vanilla, this was 7 in v80, and is 8 in v81+.", (AcceptableValueBase)(object)new AcceptableValueRange(3, 10), Array.Empty())); zapGunPrice = configFile.Bind("Item.ZapGun", "Buff Price", true, "Reduces the cost of the zap gun from $400 to $200, like in v9."); zapGunBattery = configFile.Bind("Item.ZapGun", "Increase Battery", true, "Increases zap gun battery back to 120s (from 22s), like v9."); } private static void VehicleConfig() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown cruiserPrice = configFile.Bind("Vehicle.Cruiser", "Price", 700, new ConfigDescription("Alters the price of the Cruiser. $400 is the original price from v55 launch. $370 is the current vanilla price.", (AcceptableValueBase)(object)new AcceptableValueRange(10, 250000), Array.Empty())); cruiserRegen = configFile.Bind("Vehicle.Cruiser", "Reduced Regeneration", true, "Sharply decreases HP regen for the Cruiser, which makes weed killer more valuable as the only source of mid-round maintenance."); cruiserTrees = configFile.Bind("Vehicle.Cruiser", "Nature Prevails", true, "The cruiser takes damage from destroying trees again. Does *not* affect snowmen."); cruiserEnemyDamage = configFile.Bind("Vehicle.Cruiser", "Increase Enemy Damage", true, "The cruiser takes increased damage from collision with enemies. *Does not apply* when the Cruiser is left unattended, parked and with the engine off."); cruiserCrashDamage = configFile.Bind("Vehicle.Cruiser", "Increase Crash Damage", true, "The cruiser takes increased damage from collision with terrain or walls."); cruiserItemSafety = configFile.Bind("Vehicle.Cruiser", "No Space Insurance", true, "When returning to orbit, items on top of the Cruiser, or in the back while the door is open, are lost."); cruiserExhaust = configFile.Bind("Vehicle.Cruiser", "Rocking Costs Stamina", true, "When \"rocking\" the car (with the jump button), stamina will be deducted, and you are unable to rock the car when out of stamina. The stamina cost gets steeper the more the car is facing upward."); } private static void EnemyConfig() { gunkfishSquishy = configFile.Bind("Enemy.BackwaterGunkfish", "Squishy", false, "Reduce the Backwater Gunkfish's HP from 4 to 3."); barberDynamicSpawns = configFile.Bind("Enemy.Barber", "Dynamic Spawn Settings", true, "Barbers will spawn in pairs, up to 8 total, in factories and manors. In mineshafts, they are limited to 1 total."); butlerManorChance = configFile.Bind("Enemy.Butler", "Manor Increased Chance", true, "Butlers have an increased chance to spawn in manor interiors."); butlerStealthStab = configFile.Bind("Enemy.Butler", "Stealth Stab", true, "When triggering a Butler to attack by bumping into them (rare chance), they will no longer \"berserk\", unless the offending player is alone."); butlerLongCooldown = configFile.Bind("Enemy.Butler", "Slow Attacks", false, "Butlers will deal damage slower, as long as they haven't been attacked before. In singleplayer, this setting will also increase their HP from 2 to 3."); butlerSquishy = configFile.Bind("Enemy.Butler", "Squishy", true, "Butlers take bonus damage from shotgun shots and explosions, allowing those to kill in one hit."); butlerKnifePrice = configFile.Bind("Enemy.Butler", "Randomize Knife Price", false, "Restores the kitchen knife's price randomization. On average, it will be significantly more valuable than $35, the vanilla price."); butlerNoSearch = configFile.Bind("Enemy.Butler", "No Search in Solo", false, "Disables the Butler's \"mad search\" behavior in singleplayer, where they put around their broom and sprint around the interior looking for players. This should make it somewhat easier to stay out of their way without them forcing an interaction."); cadaverTarget = configFile.Bind("Enemy.CadaverBloom", "Infighting", true, "Allows Cadaver Blooms to be targeted by other enemies after bursting outside the building. (Baboon hawks, Old Birds, giant sapsucker)"); cadaversPower = configFile.Bind("Enemy.CadaverGrowths", "Increase Power Level", true, "Increase Cadaver Growths' power level from 2 to 4, to keep the day's threats more solitarily focused."); coilheadStunReset = configFile.Bind("Enemy.Coilhead", "Stuns Reset", true, "Coil-heads will begin \"recharging\" when they are stunned by stun grenades, radar boosters, or homemade flashbangs."); coilheadCurves = configFile.Bind("Enemy.Coilhead", "Adjust Spawn Curves", false, "Adds two multipliers to Coil-head spawn rates; one reduces their chances earlier in the day, and the other reduces the chance of multiple spawning in one day."); coilheadPower = configFile.Bind("Enemy.Coilhead", "Increase Power Level", true, "Increase Coil-heads' power level from 1 to 2, to reduce the potential for forming bad enemy combos."); coilheadPersistence = configFile.Bind("Enemy.Coilhead", "Persistence", false, "Coil-heads no longer recharge from just chasing players, behaving akin to their pre-v60 iteration."); giantSnowSight = configFile.Bind("Enemy.ForestKeeper", "Treat Blizzard Like Fog", true, "On snowy moons, Forest Keepers will have their line-of-sight range reduced, the same way as in foggy weather."); giantSquishy = configFile.Bind("Enemy.ForestKeeper", "Squishy", true, "Forest Keepers are instantly killed if the Cruiser is rammed into them at high speeds, just like before v70."); hoarderAngerManagement = configFile.Bind("Enemy.HoardingBug", "Anger Management", true, "Hoarding bug \"annoyance\" (from player proximity) will reset when they enter chase, which makes them less likely to get stuck in an aggro loop on players who don't steal from them."); jesterWalkThrough = configFile.Bind("Enemy.Jester", "Walk-Through", true, "Lets you walk through Jesters once they begin winding up."); jesterLongCooldown = configFile.Bind("Enemy.Jester", "Long Cooldown", true, "Slightly increase the average time before a Jester winds, in multiplayer. Only works in games with 4 players or less."); foxSlender = configFile.Bind("Enemy.KidnapperFox", "No Roadkill", true, "Make the kidnapper fox immune to the Company Cruiser. This is already the case in vanilla, but CruiserImproved fixes the bug causing it, which pseudo-nerfs the fox"); maneaterPower = configFile.Bind("Enemy.Maneater", "Increase Power Level", true, "Increase the Maneater's power level from 2 to 3, to reduce the potential for forming bad enemy combos."); maneaterLimitGrowth = configFile.Bind("Enemy.Maneater", "Limit Growth", true, "Sharply limits (or completely prevents) the Maneater's ability to transform before it has been encountered by a player."); maneaterScrapGrowth = configFile.Bind("Enemy.Maneater", "Metabolism", false, "Eating scrap will permanently reduce the speed at which a Maneater transforms from crying."); maneaterWideTurns = configFile.Bind("Enemy.Maneater", "Limit Turn Speed", true, "Adult Maneaters will have far worse turning speed when lunging, as long as they are inside the building."); maneaterTarget = configFile.Bind("Enemy.Maneater", "Infighting", true, "Allows Maneaters to be targeted by other enemies after transforming into an adult outside the building. (Baboon hawks, Old Birds, giant sapsucker)"); nutcrackerGunPrice = configFile.Bind("Enemy.Nutcracker", "Randomize Shotgun Price", false, "Restores randomization for the shotgun's price."); nutcrackerKevlar = configFile.Bind("Enemy.Nutcracker", "Last Stand", false, "Nutcrackers will resist instant death from a shotgun blast if they are at full health, immediately entering \"berserk\" state."); robotFog = configFile.Bind("Enemy.OldBird", "See Through Fog", true, "Old Birds can see through fog with their powerful searchlights."); pufferPower = configFile.Bind("Enemy.SporeLizard", "Decrease Power Level", true, "Decrease spore lizard's power level from 1 to 0.5, as like the Backwater Gunkfish, it is mostly passive to players and only incidentally dangerous."); } private static void MoonConfig() { moonsKillSwitch = configFile.Bind("Moons", "Kill Switch", false, "If this setting is enabled, all other settings in the \"Moon\" category will be disabled. This is helpful if you want to use an external mod to configure them."); experimentationBuffScrap = configFile.Bind("Moon.Experimentation", "Buff Scrap", true, "Increases the amount of scrap that spawns on Experimentation, like in v9. (8-11 -> 11-15)"); experimentationNoEvents = configFile.Bind("Moon.Experimentation", "No Random Events", true, "Disables all random events on Experimentation. (Meteor showers, infestations, spooky fog)"); experimentationNoGiants = configFile.Bind("Moon.Experimentation", "No Forest Keepers", true, "Forest Keepers no longer have a random chance to spawn on Experimentation."); experimentationNoEggs = configFile.Bind("Moon.Experimentation", "No Easter Eggs", true, "Easter eggs no longer appear in Experimentation's loot pool."); assuranceNerfScrap = configFile.Bind("Moon.Assurance", "Nerf Scrap", true, "Swaps several items' rarities with the corresponding values from Offense's loot pool."); assuranceMasked = configFile.Bind("Moon.Assurance", "Spawn Masked", true, "Allow \"Masked\" enemies to spawn very rarely on Assurance, since Comedy and Tragedy spawn there."); assuranceGiants = configFile.Bind("Moon.Assurance", "More Forest Giants", true, "Swaps Assurance's forest giant spawn chance with Offense's chances. This will also reduce forest giants on Offense."); vowMineshafts = configFile.Bind("Moon.Vow", "Mostly Mineshafts", true, "Significantly reduce the likelihood of factory interiors on Vow. Fewer \"mineshaft bonus items\" will spawn, and outside spawns will be slightly increased, to compensate for increased profits."); vowNoCoils = configFile.Bind("Moon.Vow", "No Coil-heads", true, "Coil-heads no longer have a random chance to spawn on Vow."); vowNoTraps = configFile.Bind("Moon.Vow", "No Traps", false, "Removes landmines and turrets from Vow, like in v9."); vowMisty = configFile.Bind("Moon.Vow", "Misty", true, "Makes Vow's natural fog much denser, like it was before v72."); marchBuffScrap = configFile.Bind("Moon.March", "Buff Scrap", false, "Slightly increase the amount and quality of scrap that spawns on March, to bring it a little closer with Adamance."); marchAdjustEnemies = configFile.Bind("Moon.March", "Adjust Outdoor Enemies", false, "Decreases dogs and increases giants."); adamanceReduceCadavers = configFile.Bind("Moon.Adamance", "Reduce Cadavers", true, "Cadavers are no longer guaranteed to appear when the ship lands. This greatly increases the spawn rate of other enemies to compensate."); adamanceBuffScrap = configFile.Bind("Moon.Adamance", "Buff Scrap", true, "Increases the amount of scrap that spawns on Adamance, like before v80. (14-16 -> 16-18)"); adamanceNerfEclipse = configFile.Bind("Moon.Adamance", "Nerf Eclipse", false, "Reduces enemy spawns per \"wave\" during eclipses on Adamance from 3 to 2."); adamanceInteriors = configFile.Bind("Moon.Adamance", "Adjust Interiors", false, "Increases mineshaft chance (like before v80) and also slightly increases manor chance (like v50 beta). Also adds butlers back to the spawn pool, as a bonus."); adamanceNoMasks = configFile.Bind("Moon.Adamance", "No Masked", true, "\"Masked\" no longer have a random chance to spawn on Adamance."); offenseBuffScrap = configFile.Bind("Moon.Offense", "Buff Scrap", true, "Swaps several items' rarities with the corresponding values from Assurance's loot pool. Also adds gold bars as a very rare spawn."); offenseBees = configFile.Bind("Moon.Offense", "Circuit Bees", false, "Allow circuit bees to spawn on Offense, like Assurance."); offenseMasked = configFile.Bind("Moon.Offense", "Spawn Masked", true, "Allow \"Masked\" enemies to spawn rarely on Offense, since Comedy spawns there - these rare spawns will completely replace brackens."); offenseNerfEclipse = configFile.Bind("Moon.Offense", "Nerf Eclipse", false, "Reduces enemy spawns per \"wave\" during eclipses on Offense from 4 to 3."); offenseNerfTraps = configFile.Bind("Moon.Offense", "Reduce Traps", true, "Reduces trap spawns (landmines and turrets) to pre-v80 spawn rates."); offenseFireExits = configFile.Bind("Moon.Offense", "Extra Fire Exit", false, "Adds the fire exit from v9 as an additional entrance to the building."); rendShrink = configFile.Bind("Moon.Rend", "Shrink Interior", false, "Reduces Rend's interior size multiplier from 1.8x to 1.6x."); rendWorms = configFile.Bind("Moon.Rend", "Restore Earth Leviathans", false, "Allow Earth Leviathans, which were removed from Rend in v56, to spawn again."); rendSnowmen = configFile.Bind("Moon.Rend", "Snowmen", SnowmanFrequency.Rare, "Allow snowmen, which were removed in v70, to spawn again."); dineScrapPool = configFile.Bind("Moon.Dine", "Scrap Pool", DineScrap.Consolidate, "What sort of scrap should spawn on Dine?\n\"DontChange\" will avoid making any changes, letting vanilla or other mods take priority.\n\"Consolidate\" will use V73+'s spawn pool, but 40% as many items will spawn with 1.75x value each.\n\"Rollback\" will revert the scrap pool to what it was in ButteRyBalance before v73."); dineMineshafts = configFile.Bind("Moon.Dine", "Dineshaft", true, "Increase the chance of mineshafts again, much like it was before v80."); dineReduceButlers = configFile.Bind("Moon.Dine", "Reduce Butler Chance", true, "Reduces the spawn weight of Butlers on Dine. Intended to be combined with the \"Manor Increased Chance\" setting for Butlers."); dineAdjustOutdoor = configFile.Bind("Moon.Dine", "Adjust Outdoor Enemies", true, "Decreases spawn chance for giants and increases spawn chance for Old Birds, leading to more varied outdoor gameplay."); dineFloods = configFile.Bind("Moon.Dine", "Fix Floods", true, "Reduces the water level at the start of flooded weather days on Dine, so that the main entrance no longer starts out underwater."); dineFireExits = configFile.Bind("Moon.Dine", "Extra Fire Exits", false, "Adds the fire exits from v49 and v56 as additional entrances to the building. Slightly increases the interior size and indoor spawns to compensate."); dineSnowmen = configFile.Bind("Moon.Dine", "Snowmen", SnowmanFrequency.Rare, "Allow snowmen, which were removed in v70, to spawn again."); titanBuffScrap = configFile.Bind("Moon.Titan", "Buff Scrap", true, "Increases scrap counts on Titan from 28-31 to 28-35, like in v50 betas."); titanAddGold = configFile.Bind("Moon.Titan", "Gold Rush", false, "Adds gold bars to Titan's loot pool as a rare find."); titanAdjustEnemies = configFile.Bind("Moon.Titan", "Adjust Enemies", true, "Slightly adjusts interior spawns to reduce the frequency of the Jester, and also increases Old Birds."); titanWeeds = configFile.Bind("Moon.Titan", "No Vain Shrouds", true, "Disable vain shroud growth on Titan, to prevent the kidnapper fox from camping the ship."); titanSnowmen = configFile.Bind("Moon.Titan", "Snowmen", SnowmanFrequency.Rare, "Allow snowmen, which were removed in v70, to spawn again."); artificeBuffScrap = configFile.Bind("Moon.Artifice", "Buff Scrap", true, "Restores Artifice's scrap counts from v56 (26-30 to 31-37), and also restores original gold bar spawn chance."); artificeInteriors = configFile.Bind("Moon.Artifice", "Adjust Interiors", false, "Adjusts interior chances to make manor dominant again. (15%/35%/50% -> 15%/50%/35%) Also increases the size of manors and factories from 1.8x to 2.0x, but mineshafts are not affected."); artificeTurrets = configFile.Bind("Moon.Artifice", "Increase Turrets", true, "Drastically increase the spawn rate of turrets, like in the v50 betas."); embrionMega = configFile.Bind("Moon.Embrion", "Bigger on the Inside", false, "Double the interior size, dramatically increase the chance of mineshafts, and greatly increase the number of scrap items."); embrionAdjustEnemies = configFile.Bind("Moon.Embrion", "Adjust Indoor Enemies", false, "Increase the spawn rates of non-biological enemies in the interior."); embrionWeeds = configFile.Bind("Moon.Embrion", "No Vain Shrouds", false, "Disable vain shroud growth on Embrion, since there is limited biological life on the surface."); } private static void MiscConfig() { nerfNightVision = configFile.Bind("Misc", "Reduce Night Vision", false, "Lower the distance you can see clearly in the dark without a light source, as it was in the original v80 beta."); foggyLimit = configFile.Bind("Misc", "Nerf Foggy Weather", true, "Reduce the maximum intensity of foggy weather."); randomIndoorFog = configFile.Bind("Misc", "Random Indoor Fog", true, "When the indoor fog event occurs, its density will be randomized between the vanilla value and a much less extreme value."); spikeTrapDistance = configFile.Bind("Misc", "Safely Distance Spike Traps", true, "Spike traps are no longer allowed to spawn directly on top of building entrances."); spikeTrapMineshaft = configFile.Bind("Misc", "Mineshaft Spike Traps", false, "Spike traps will be allowed in mineshaft interiors again, like before v80. It is *strongly recommended* to use \"Safely Distance Spike Traps\" in conjunction with this setting, or else spike traps will be allowed to spawn on top of the elevator!"); cavernsNoKeys = configFile.Bind("Misc", "No Keys in Caverns", true, "Adjusts key spawns in mineshafts, so that they can no longer spawn in cavern tiles, *similar* to pre-v80 behavior.\nAlso removes the distance limit from main entrance, which will allow keys to spawn near deep fire exits, normally impossible in vanilla."); proportionalFireExits = configFile.Bind("Misc", "Proportional Fire Exits", false, "Adjusts fire exit spawns so they are unable to spawn too close to main entrance, and less likely to spawn close to each other. WILL NOT WORK with Fairer Fire Exits installed."); } private static void InfestationConfig() { infestationRework = configFile.Bind("Infestations", "Rework Mechanics", true, "(REQUIRES SPAWN CYCLE FIXES!) Infestations no longer override a moon's power level, and enemy spawn chances are no longer altered. The \"infestation enemy\" takes up no power level during the event, and \"bonus spawns\" only occur until the infestation enemy hits their spawn cap."); infestationButlers = configFile.Bind("Infestations", "Butler Infestations", true, "Allow butlers to be selected as the subject of an infestation."); infestationMasked = configFile.Bind("Infestations", "Masked Infestations", true, "Allow \"masked\" to be selected as the subject of an infestation."); infestationBarbers = configFile.Bind("Infestations", "Barber Infestations", false, "Allow Barbers to be selected as the subject of an infestation. Other enemy spawns will be disabled. Won't occur inside mineshafts."); infestationThumpers = configFile.Bind("Infestations", "Thumper Infestations", false, "Allow thumpers to be selected as the subject of an infestation."); infestationSnareFlea = configFile.Bind("Infestations", "Snare Flea Infestations", false, "Allow snare fleas to be selected as the subject of an infestation."); infestationCoilhead = configFile.Bind("Infestations", "Coil-head Infestations", false, "Allow coil-heads to be selected as the subject of an infestation."); infestationGunkfish = configFile.Bind("Infestations", "Backwater Gunkfish Infestations", false, "Allow Backwater Gunkfish to be selected as the subject of an infestation."); } private static void MigrateLegacyConfig() { if (foggyLimit.Value) { if (!configFile.Bind("Misc", "Rework Foggy Weather", true, "Legacy setting, doesn't work").Value) { foggyLimit.Value = false; } configFile.Remove(configFile["Misc", "Rework Foggy Weather"].Definition); } if (!adamanceNerfEclipse.Value) { if (configFile.Bind("Moon.Adamance", "Reduce Chaos", false, "Legacy setting, doesn't work").Value) { adamanceNerfEclipse.Value = true; } configFile.Remove(configFile["Moon.Adamance", "Reduce Chaos"].Definition); } (string, string)[] array = new(string, string)[22] { ("Enemy.ForestKeeper", "Forget Out-of-Sight Players"), ("Item.TZPInhalant", "Expand Capacity"), ("Moon.Dine", "Buff Scrap"), ("Enemy.OldBird", "Restore Mech Riding"), ("Moon.March", "Shrink Interior"), ("Moon.March", "Always Rainy"), ("Misc", "Multiplayer Weather Multiplier"), ("Moon.Offense", "Mostly Mineshafts"), ("Misc", "Shrink Mineshafts"), ("Moon.Vow", "Adjust Scrap"), ("Moon.Experimentation", "No Nutcrackers"), ("Moon.Rend", "Rare Mineshafts"), ("Moon.Rend", "Adjust Scrap"), ("Moon.Dine", "Adjust Indoor Enemies"), ("Moon.Dine", "Adjust Spawn Curves"), ("Moon.Dine", "Add Masked"), ("Moon.Embrion", "Buff Scrap"), ("Moon.Embrion", "Increase Mineshafts"), ("Moon.Rend", "Adjust Indoor Enemies"), ("Enemy.KidnapperFox", "Squishy"), ("Moon.Titan", "Reduce Mineshafts"), ("Item.Jetpack", "v49 Controls") }; for (int i = 0; i < array.Length; i++) { (string, string) tuple = array[i]; try { configFile.Bind(tuple.Item1, tuple.Item2, string.Empty, "Legacy setting, doesn't work"); configFile.Remove(configFile[tuple.Item1, tuple.Item2].Definition); } catch { Plugin.Logger.LogWarning((object)("Can't delete \"" + tuple.Item1 + "\" - \"" + tuple.Item2 + "\" from config")); } } configFile.Save(); } } internal static class LobbyCompatibility { internal static void Init() { PluginHelper.RegisterPlugin("butterystancakes.lethalcompany.butterybalance", Version.Parse("0.6.0"), (CompatibilityLevel)2, (VersionStrictness)3); } } [BepInPlugin("butterystancakes.lethalcompany.butterybalance", "ButteRyBalance", "0.6.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal const string PLUGIN_GUID = "butterystancakes.lethalcompany.butterybalance"; internal const string PLUGIN_NAME = "ButteRyBalance"; internal const string PLUGIN_VERSION = "0.6.0"; internal static ManualLogSource Logger; private const string GUID_LOBBY_COMPATIBILITY = "BMX.LobbyCompatibility"; private const string GUID_ARTIFICE_BLIZZARD = "butterystancakes.lethalcompany.artificeblizzard"; private const string GUID_BARBER_FIXES = "butterystancakes.lethalcompany.barberfixes"; private const string GUID_SPAWN_CYCLE_FIXES = "butterystancakes.lethalcompany.spawncyclefixes"; private const string GUID_VERSION55_COMPANY_CRUISER = "scandal.v55cruiser"; private const string GUID_FAIRER_FIRE_EXITS = "OreoM.FairerFireExits"; internal const string GUID_BUTTERY_FIXES = "butterystancakes.lethalcompany.butteryfixes"; internal const string GUID_LETHAL_FIXES = "uk.1a3.lethalfixes"; internal const string GUID_LETHAL_LEVEL_LOADER = "imabatby.lethallevelloader"; private void Awake() { //IL_0104: Unknown result type (might be due to invalid IL or missing references) NetcodePatch(); Logger = ((BaseUnityPlugin)this).Logger; if (Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility")) { Logger.LogInfo((object)"CROSS-COMPATIBILITY - Lobby Compatibility detected"); LobbyCompatibility.Init(); } if (Chainloader.PluginInfos.ContainsKey("butterystancakes.lethalcompany.artificeblizzard")) { Logger.LogInfo((object)"CROSS-COMPATIBILITY - Artifice Blizzard detected"); Common.INSTALLED_ARTIFICE_BLIZZARD = true; } if (Chainloader.PluginInfos.ContainsKey("butterystancakes.lethalcompany.barberfixes")) { Logger.LogInfo((object)"CROSS-COMPATIBILITY - Barber Fixes detected"); Common.INSTALLED_BARBER_FIXES = true; } if (Chainloader.PluginInfos.ContainsKey("butterystancakes.lethalcompany.spawncyclefixes")) { Logger.LogInfo((object)"CROSS-COMPATIBILITY - Spawn Cycle Fixes detected"); Common.INSTALLED_SPAWN_CYCLE_FIXES = true; } if (Chainloader.PluginInfos.ContainsKey("scandal.v55cruiser")) { Logger.LogInfo((object)"CROSS-COMPATIBILITY - Version-55 Company Cruiser detected"); Common.INSTALLED_VERSION55_COMPANY_CRUISER = true; } if (Chainloader.PluginInfos.ContainsKey("OreoM.FairerFireExits")) { Logger.LogInfo((object)"CROSS-COMPATIBILITY - Fairer Fire Exits detected"); Common.INSTALLED_FAIRER_FIRE_EXITS = true; } Configuration.Init(((BaseUnityPlugin)this).Config); new Harmony("butterystancakes.lethalcompany.butterybalance").PatchAll(); SceneManager.sceneLoaded += SceneOverrides.OnSceneLoaded; Logger.LogInfo((object)"ButteRyBalance v0.6.0 loaded"); } private void NetcodePatch() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } } public static class PluginInfo { public const string PLUGIN_GUID = "ButteRyBalance"; public const string PLUGIN_NAME = "ButteRyBalance"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace ButteRyBalance.Utilities { internal static class InteriorObjectSpawner { internal static void PostProcessKeyNodes(ref GameObject[] nodes, ref int count) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)RoundManager.Instance).IsServer || !Configuration.cavernsNoKeys.Value) { return; } try { List list = new List(nodes); List list2 = new List(); if (list.Count < 1) { Plugin.Logger.LogWarning((object)"Key spawner was fed an invalid array of nodes - this shouldn't happen"); list = new List(RoundManager.Instance.insideAINodes); } bool flag = false; for (int num = list.Count - 1; num >= 0; num--) { if ((Object)(object)list[num] == (Object)null) { list.RemoveAt(num); } else { foreach (Bounds caveTile in Common.caveTiles) { Bounds current = caveTile; if (((Bounds)(ref current)).Contains(list[num].transform.position)) { list.RemoveAt(num); flag = true; break; } } if (flag) { flag = false; } else { GameObject[] allCaveNodes = RoundManager.Instance.allCaveNodes; foreach (GameObject val in allCaveNodes) { float num2 = Vector3.Distance(list[num].transform.position, val.transform.position); if (num2 < 12f) { if (num2 > 8f) { list2.Add(list[num]); } list.RemoveAt(num); break; } } } } } if (list.Count < 1) { if (list2.Count > 0) { Plugin.Logger.LogDebug((object)$"Key spawn nodes: {count} -> {list2.Count} (BACKUP)"); nodes = list2.ToArray(); count = nodes.Length; } else { Plugin.Logger.LogWarning((object)"Ignoring \"No Keys in Caverns\" for this round, because there are no valid nodes outside of cavern tiles"); } } else { Plugin.Logger.LogDebug((object)$"Key spawn nodes: {count} -> {list.Count}"); nodes = list.ToArray(); count = nodes.Length; } } catch (Exception ex) { Plugin.Logger.LogError((object)"An error occurred while filtering key spawns"); Plugin.Logger.LogError((object)ex); } } internal static void RandomlyActivateFireExits(GlobalProp[] fireExits, Random rand) { List list = new List(fireExits); for (int i = 0; i < Common.fireExitCount; i++) { int index = rand.Next(list.Count); ((Component)list[index]).gameObject.SetActive(true); list.RemoveAt(index); } } } } namespace ButteRyBalance.Patches { [HarmonyPatch(typeof(DungeonGenerator))] internal static class DungeonGeneratorPatches { [HarmonyPatch("ProcessGlobalProps")] [HarmonyPostfix] private static void DungeonGenerator_Post_ProcessGlobalProps(DungeonGenerator __instance) { //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) if (!BRBNetworker.Instance.ProportionalFireExits.Value || Common.fireExitCount <= 0) { return; } GameObject root = __instance.Root; GlobalProp[] array = ((root == null) ? null : root.GetComponentsInChildren(true)?.Where((GlobalProp globalProp) => globalProp.PropGroupID == 1231).ToArray()); if (array == null) { return; } Plugin.Logger.LogDebug((object)$"Total number of fire exit props: {array.Length}"); if (array.Length < 1) { GlobalProp[] componentsInChildren = __instance.Root.GetComponentsInChildren(true); foreach (GlobalProp val in componentsInChildren) { Plugin.Logger.LogDebug((object)$"Global prop: {((Object)val).name} (ID #{val.PropGroupID})"); } return; } if (Common.fireExitCount >= array.Length) { GlobalProp[] componentsInChildren = array; for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.SetActive(true); } Plugin.Logger.LogWarning((object)$"Enabled all fire exits ({Common.fireExitCount} required)"); return; } Random random = new Random(__instance.Seed); int num = array.Length / (Common.fireExitCount + 1); Plugin.Logger.LogDebug((object)$"Fire exit preferred chunk size is {num}"); if (num < 1) { Plugin.Logger.LogWarning((object)"Fire exit chunk size is 0. Falling back to random spawns"); InteriorObjectSpawner.RandomlyActivateFireExits(array, random); return; } Vector3 mainEntrancePos = Vector3.zero; SpawnSyncedObject[] componentsInChildren2 = __instance.Root.GetComponentsInChildren(); EntranceTeleport val3 = default(EntranceTeleport); foreach (SpawnSyncedObject val2 in componentsInChildren2) { if (!((Object)(object)val2.spawnPrefab == (Object)null) && ((val2.spawnPrefab.TryGetComponent(ref val3) && !val3.isEntranceToBuilding && val3.entranceId == 0) || ((Object)val2.spawnPrefab).name == "EntranceTeleportA")) { mainEntrancePos = ((Component)val2).transform.position; break; } } if (mainEntrancePos == Vector3.zero) { object obj; if (__instance == null) { obj = null; } else { Dungeon currentDungeon = __instance.CurrentDungeon; obj = ((currentDungeon != null) ? currentDungeon.AllTiles : null); } if (obj != null && __instance.CurrentDungeon.AllTiles.Count > 0) { Bounds bounds = __instance.CurrentDungeon.AllTiles[0].Bounds; mainEntrancePos = ((Bounds)(ref bounds)).center; } } if (mainEntrancePos != Vector3.zero) { array = array.OrderBy((GlobalProp fireExit) => Vector3.Distance(((Component)fireExit).transform.position, mainEntrancePos)).ToArray(); List[] array2 = new List[Common.fireExitCount + 1]; for (int j = 0; j < array2.Length; j++) { array2[j] = new List(); } for (int k = 0; k < array.Length; k++) { int num2 = Mathf.Min(k / num, array2.Length - 1); array2[num2].Add(array[k]); } for (int l = 1; l < array2.Length; l++) { if (array2[l].Count < 1) { Plugin.Logger.LogWarning((object)$"Fire exit chunk #{l} includes 0 elements. Falling back to random spawns"); InteriorObjectSpawner.RandomlyActivateFireExits(array, random); return; } } for (int m = 1; m < array2.Length; m++) { int num3 = random.Next(array2[m].Count); ((Component)array2[m][num3]).gameObject.SetActive(true); Plugin.Logger.LogDebug((object)$"Fire exit chunk #{m} ({array2[m].Count}) activating fire exit #{num3}"); } } else { Plugin.Logger.LogWarning((object)"Could not sort fire exits from main entrance. Falling back to random spawns"); InteriorObjectSpawner.RandomlyActivateFireExits(array, random); } } } [HarmonyPatch(typeof(GameNetworkManager))] internal static class GameNetworkManagerPatches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void GameNetworkManager_Post_Start() { BRBNetworker.Init(); } [HarmonyPatch("Disconnect")] [HarmonyPostfix] private static void GameNetworkManager_Post_Disconnect() { if ((Object)(object)RoundManager.Instance != (Object)null && ((NetworkBehaviour)RoundManager.Instance).IsServer) { InfestationOverrides.EndInfestation(); } Common.Disconnect(); } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatches { [HarmonyPatch("RefreshEnemiesList")] [HarmonyPostfix] private static void RoundManager_Post_RefreshEnemiesList(RoundManager __instance) { InfestationOverrides.EndInfestation(); Random random = new Random(StartOfRound.Instance.randomMapSeed + 5781); if (((Object)__instance.currentLevel).name == "ExperimentationLevel" && BRBNetworker.Instance.ExperimentationNoEvents.Value && !BRBNetworker.Instance.MoonsKillSwitch.Value) { __instance.enemyRushIndex = -1; __instance.currentMaxInsidePower = __instance.currentLevel.maxEnemyPowerCount; ((Component)__instance.indoorFog).gameObject.SetActive(false); } else { if (((NetworkBehaviour)__instance).IsServer && (__instance.enemyRushIndex >= 0 || (((Object)__instance.currentLevel).name == "EmbrionLevel" && BRBNetworker.Instance.EmbrionMega.Value && random.Next(100) <= 8)) && Configuration.infestationRework.Value && Common.INSTALLED_SPAWN_CYCLE_FIXES) { InfestationOverrides.CustomInfestation((__instance.enemyRushIndex >= 0 && ((Object)__instance.currentLevel.Enemies[__instance.enemyRushIndex].enemyType).name == "ClaySurgeon") ? __instance.enemyRushIndex : (-1)); } if (((Component)__instance.indoorFog).gameObject.activeSelf && BRBNetworker.Instance.RandomIndoorFog.Value) { __instance.indoorFog.parameters.meanFreePath = random.Next(5, 11); } } if (!((NetworkBehaviour)__instance).IsServer || !Configuration.barberDynamicSpawns.Value) { return; } if (Common.enemies.TryGetValue("ClaySurgeon", out var value)) { if (RoundManager.Instance.currentDungeonType == 4 && InfestationOverrides.GetInfesterName() != "ClaySurgeon") { value.MaxCount = 1; value.spawnInGroupsOf = 1; Plugin.Logger.LogDebug((object)"Barber - Dynamic Spawn Settings: 1/1 (Mineshaft)"); } else if (Common.INSTALLED_BARBER_FIXES) { value.MaxCount = 8; if (Common.INSTALLED_SPAWN_CYCLE_FIXES) { value.spawnInGroupsOf = 2; Plugin.Logger.LogDebug((object)$"Barber - Dynamic Spawn Settings: 2/8 (Interior ID: {RoundManager.Instance.currentDungeonType})"); } else { Plugin.Logger.LogWarning((object)"Can't increase Barber spawn group because Spawn Cycle Fixes is not loaded. Please install it and make sure it works correctly"); } } else { Plugin.Logger.LogWarning((object)"Can't increase Barber max count because Barber Fixes is not loaded. Please install it and make sure it works correctly, or disable \"Dynamic Spawn Settings\" in the \"Enemy.Barber\" config"); } } else { Plugin.Logger.LogWarning((object)"Failed to reference Barber enemy type. This should never happen"); } } [HarmonyPatch("GenerateNewFloor")] [HarmonyPrefix] private static void RoundManager_Pre_GenerateNewFloor(RoundManager __instance) { if (BRBNetworker.Instance.MoonsKillSwitch.Value) { return; } switch (((Object)__instance.currentLevel).name) { case "VowLevel": if (BRBNetworker.Instance.VowMineshafts.Value) { MoonOverrides.AdjustInteriors(__instance.currentLevel, VowOverrides.adjustedInteriors); } break; case "AdamanceLevel": if (BRBNetworker.Instance.AdamanceInteriors.Value) { MoonOverrides.AdjustInteriors(__instance.currentLevel, AdamanceOverrides.adjustedInteriors); } break; case "DineLevel": if (BRBNetworker.Instance.DineMineshafts.Value) { MoonOverrides.AdjustInteriors(__instance.currentLevel, DineOverrides.adjustedInteriors); } break; case "ArtificeLevel": if (BRBNetworker.Instance.ArtificeInteriors.Value) { MoonOverrides.AdjustInteriors(__instance.currentLevel, ArtificeOverrides.adjustedInteriors); } break; case "EmbrionLevel": if (BRBNetworker.Instance.EmbrionMega.Value) { MoonOverrides.AdjustInteriors(__instance.currentLevel, EmbrionOverrides.adjustedInteriors); } break; } } [HarmonyPatch("FinishGeneratingNewLevelClientRpc")] [HarmonyPostfix] private static void RoundManager_Post_FinishGeneratingNewLevelClientRpc(RoundManager __instance) { //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if (((Object)StartOfRound.Instance.currentLevel).name == "ArtificeLevel" && Common.INSTALLED_ARTIFICE_BLIZZARD) { Common.artificeBlizzard = GameObject.Find("/Systems/Audio/BlizzardAmbience"); if ((Object)(object)Common.artificeBlizzard != (Object)null) { Plugin.Logger.LogDebug((object)"Artifice Blizzard compatibility success"); } } if (((NetworkBehaviour)__instance).IsServer) { if (Configuration.spikeTrapDistance.Value) { SpikeRoofTrap[] array = Object.FindObjectsByType((FindObjectsSortMode)0); EntranceTeleport[] array2 = Object.FindObjectsByType((FindObjectsSortMode)0); MineshaftElevatorController val = __instance.currentMineshaftElevator ?? Object.FindAnyObjectByType(); SpikeRoofTrap[] array3 = array; foreach (SpikeRoofTrap val2 in array3) { bool flag = false; if ((Object)(object)val?.elevatorBottomPoint != (Object)null && Vector3.Distance(((Component)val2.spikeTrapAudio).transform.position, val.elevatorBottomPoint.position) < 7f) { Plugin.Logger.LogDebug((object)$"Spike trap #{((Object)val2).GetInstanceID()} will be destroyed (too close to the elevator)"); flag = true; } if (!flag) { EntranceTeleport[] array4 = array2; foreach (EntranceTeleport val3 in array4) { if (!val3.isEntranceToBuilding && !((Object)(object)val3.entrancePoint == (Object)null) && Vector3.Distance(((Component)val2.spikeTrapAudio).transform.position, val3.entrancePoint.position) < 4.5f) { flag = true; Plugin.Logger.LogDebug((object)$"Spike trap #{((Object)val2).GetInstanceID()} will be destroyed (too close to entrance \"{((Object)val3).name}\")"); break; } } } if (flag) { NetworkObject componentInParent = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && componentInParent.IsSpawned) { componentInParent.Despawn(true); } else { Plugin.Logger.LogWarning((object)"Error occurred while despawning spike trap (could not find network object, or it was not network spawned yet)"); } } } } if ((__instance.currentDungeonType == 0 || __instance.currentDungeonType == 2 || __instance.currentDungeonType == 3) && BRBNetworker.Instance.ApparatusPrice.Value) { LungProp componentInChildren = __instance.mapPropsContainer.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && componentInChildren.isLungDocked && ((GrabbableObject)componentInChildren).scrapValue == 80) { BRBNetworker.Instance.SyncScrapPriceRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)componentInChildren).NetworkObject), new Random(StartOfRound.Instance.randomMapSeed).Next(40, 131), node: false); } } } Common.CacheCaveTiles(); } [HarmonyPatch("SpawnOutsideHazards")] [HarmonyPrefix] private static void RoundManager_Pre_SpawnOutsideHazards(RoundManager __instance) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if (__instance.currentLevel.levelID >= 13) { return; } if ((Object)(object)RoundManager.Instance?.mapPropsContainer == (Object)null) { Plugin.Logger.LogWarning((object)"Can't create SpawnDenialPoint(s) because mapPropsContainer is missing, this *might* cause desync with other clients"); return; } EntranceTeleport[] array = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (EntranceTeleport val in array) { if (val.isEntranceToBuilding) { CreateSpawnDenialPoint(val.entrancePoint.position); Plugin.Logger.LogDebug((object)(((Object)__instance.currentLevel).name + ": SpawnDenialPoint (Entrance)")); } } InteractTrigger[] array2 = Object.FindObjectsByType((FindObjectsSortMode)0); foreach (InteractTrigger val2 in array2) { if (val2.isLadder && (Object)(object)val2.bottomOfLadderPosition != (Object)null) { CreateSpawnDenialPoint(val2.bottomOfLadderPosition.position); Plugin.Logger.LogDebug((object)(((Object)__instance.currentLevel).name + ": SpawnDenialPoint (Ladder)")); } } if (!BRBNetworker.Instance.MoonsKillSwitch.Value) { int num = ((Object)__instance.currentLevel).name switch { "RendLevel" => BRBNetworker.Instance.RendSnowmen.Value, "DineLevel" => BRBNetworker.Instance.DineSnowmen.Value, "TitanLevel" => BRBNetworker.Instance.TitanSnowmen.Value, _ => 0, }; if (num > 0) { MoonOverrides.RestoreSnowmen(__instance.currentLevel, num > 1); } } } private static void CreateSpawnDenialPoint(Vector3 pos) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Transform transform = new GameObject("SpawnDenialPointBRB") { tag = "SpawnDenialPoint" }.transform; transform.SetParent(RoundManager.Instance.mapPropsContainer.transform); transform.position = pos; } [HarmonyPatch("PlotOutEnemiesForNextHour")] [HarmonyPrefix] private static void RoundManager_Pre_PlotOutEnemiesForNextHour(RoundManager __instance, ref bool __state) { __state = false; if (((NetworkBehaviour)__instance).IsServer) { InfestationOverrides.SpawnInfestationWave(); if (((Object)__instance.currentLevel).name == "AdamanceLevel" && Configuration.adamanceReduceCadavers.Value && __instance.minEnemiesToSpawn < 1 && __instance.timeScript.hour > __instance.hourTimeBetweenEnemySpawnBatches && new Random(__instance.playersManager.randomMapSeed / Mathf.RoundToInt((float)__instance.timeScript.hour * __instance.timeScript.lengthOfHours)).NextDouble() < 0.8) { __state = true; __instance.minEnemiesToSpawn = 1; Plugin.Logger.LogDebug((object)("Adamance: Force inside spawn this batch (" + HUDManager.Instance.GetClockTimeFormatted(__instance.timeScript.normalizedTimeOfDay, (float)__instance.timeScript.numberOfHours, false) + ")")); } } } [HarmonyPatch("PlotOutEnemiesForNextHour")] [HarmonyPostfix] private static void RoundManager_Post_PlotOutEnemiesForNextHour(RoundManager __instance, bool __state) { if (__state) { __instance.minEnemiesToSpawn = 0; } } [HarmonyPatch("SpawnEnemiesOutside")] [HarmonyPostfix] private static void RoundManager_Post_SpawnEnemiesOutside(RoundManager __instance) { if (((NetworkBehaviour)__instance).IsServer && __instance.allEnemyVents.Length != 0 && __instance.cannotSpawnMoreInsideEnemies) { InfestationOverrides.SpawnInfestationWave(); } } [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPrefix] private static void RoundManager_Pre_SpawnScrapInLevel(RoundManager __instance, ref float[] __state) { __state = new float[2] { 1f, 1f }; if (!BRBNetworker.Instance.MoonsKillSwitch.Value) { switch (((Object)__instance.currentLevel).name) { case "AssuranceLevel": if (Configuration.assuranceNerfScrap.Value) { if (__instance.currentDungeonType != 4) { __instance.currentLevel.minScrap = 13; __instance.currentLevel.maxScrap = 16; } else { __instance.currentLevel.minScrap = 11; __instance.currentLevel.maxScrap = 16; } } break; case "VowLevel": if (BRBNetworker.Instance.VowMineshafts.Value) { if (__instance.currentDungeonType != 4) { __instance.currentLevel.minScrap = 12; __instance.currentLevel.maxScrap = 15; } else { __instance.currentLevel.minScrap = 10; __instance.currentLevel.maxScrap = 13; } } break; case "AdamanceLevel": if (Configuration.adamanceBuffScrap.Value) { if (__instance.currentDungeonType != 4 || !BRBNetworker.Instance.AdamanceInteriors.Value) { __instance.currentLevel.minScrap = 16; __instance.currentLevel.maxScrap = 19; } else { __instance.currentLevel.minScrap = 14; __instance.currentLevel.maxScrap = 17; } } break; case "DineLevel": if (Configuration.dineScrapPool.Value == Configuration.DineScrap.Rollback) { break; } if (__instance.currentLevel.minScrap >= 200) { if (__instance.currentDungeonType != 4 || !BRBNetworker.Instance.DineMineshafts.Value) { __instance.currentLevel.minScrap = 200; __instance.currentLevel.maxScrap = 250; } else { __instance.currentLevel.minScrap = 220; __instance.currentLevel.maxScrap = 270; } } if (Configuration.dineScrapPool.Value == Configuration.DineScrap.Consolidate) { __state[0] *= 0.4f; __instance.scrapAmountMultiplier *= __state[0]; __state[1] *= 1.75f; __instance.scrapValueMultiplier *= __state[1]; } break; case "TitanLevel": if (Configuration.titanBuffScrap.Value) { if (__instance.currentDungeonType != 4) { __instance.currentLevel.minScrap = 28; __instance.currentLevel.maxScrap = 36; } else { __instance.currentLevel.minScrap = 28; __instance.currentLevel.maxScrap = 32; } } break; case "ArtificeLevel": if (Configuration.artificeBuffScrap.Value) { if (__instance.currentDungeonType != 4) { __instance.currentLevel.minScrap = 31; __instance.currentLevel.maxScrap = 38; } else { __instance.currentLevel.minScrap = 26; __instance.currentLevel.maxScrap = 31; } } break; } } if (!BRBNetworker.Instance.MoonsKillSwitch.Value) { __instance.AnomalyRandom.NextDouble(); } } [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPostfix] private static void RoundManager_Post_SpawnScrapInLevel(RoundManager __instance, float[] __state) { BRBNetworker.Instance.SetScanValueMultiplierRpc(__instance.scrapValueMultiplier); __instance.scrapAmountMultiplier /= __state[0]; __instance.scrapValueMultiplier /= __state[1]; } [HarmonyPatch("SetLockedDoors")] [HarmonyTranspiler] private static IEnumerable RoundManager_Trans_SetLockedDoors(IEnumerable instructions) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown List list = instructions.ToList(); for (int i = 5; i < list.Count - 2; i++) { if (list[i].opcode == OpCodes.Div && list[i - 1].opcode == OpCodes.Ldc_I4_3 && list[i - 3].opcode == OpCodes.Ldlen) { list.InsertRange(i + 2, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldloca_S, list[i - 4].operand), new CodeInstruction(OpCodes.Ldloca_S, list[i + 1].operand), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(InteriorObjectSpawner), "PostProcessKeyNodes", (Type[])null, (Type[])null)) })); Plugin.Logger.LogDebug((object)"Transpiler (Locked doors): Post process key spawns"); return list; } } Plugin.Logger.LogWarning((object)"Locked doors transpiler failed"); return instructions; } [HarmonyPatch("DespawnPropsAtEndOfRound")] [HarmonyPostfix] private static void RoundManager_Post_DespawnPropsAtEndOfRound(RoundManager __instance) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsServer) { return; } if (Configuration.cruiserItemSafety.Value && (Object)(object)__instance.playersManager?.attachedVehicle != (Object)null && __instance.playersManager.attachedVehicle.vehicleID == 0 && !Common.INSTALLED_VERSION55_COMPANY_CRUISER) { Bounds bounds = __instance.playersManager.attachedVehicle.ontopOfTruckCollider.bounds; VehicleController attachedVehicle = __instance.playersManager.attachedVehicle; GrabbableObject[] array = ((attachedVehicle != null) ? ((Component)attachedVehicle).GetComponentsInChildren() : null); foreach (GrabbableObject val in array) { if (__instance.playersManager.attachedVehicle.backDoorOpen || ((Bounds)(ref bounds)).ClosestPoint(((Component)val).transform.position) == ((Component)val).transform.position) { Plugin.Logger.LogDebug((object)$"Cruiser item \"{((Object)val).name}\" (#{((Object)val).GetInstanceID()}) lost in orbit"); if ((Object)(object)((NetworkBehaviour)val).NetworkObject != (Object)null && ((NetworkBehaviour)val).NetworkObject.IsSpawned) { ((NetworkBehaviour)val).NetworkObject.Despawn(true); } else { Object.Destroy((Object)(object)((Component)val).gameObject); } } } } Common.CleanTemporaryNetworkObjects(); } [HarmonyPatch("DestroyTreeAtPosition")] [HarmonyTranspiler] private static IEnumerable RoundManager_Trans_DestroyTreeAtPosition(IEnumerable instructions) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown List list = instructions.ToList(); FieldInfo fieldInfo = AccessTools.Field(typeof(RoundManager), "breakTreeAudio2"); for (int i = 0; i < list.Count - 2; i++) { if (list[i].opcode == OpCodes.Ldfld && (FieldInfo)list[i].operand == fieldInfo) { list.Insert(i + 2, new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(VehicleControllerPatches), "JustDestroyedTree", (Type[])null, (Type[])null))); Plugin.Logger.LogDebug((object)"Transpiler (Destroy tree): Send signal to Cruiser"); return list; } } Plugin.Logger.LogWarning((object)"Destroy tree transpiler failed"); return instructions; } [HarmonyPatch("SpawnSyncedProps")] [HarmonyPostfix] private static void RoundManager_Post_SpawnSyncedProps(RoundManager __instance) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsServer || BRBNetworker.Instance.MoonsKillSwitch.Value) { return; } bool flag = false; switch (Common.lastSceneLoaded) { case "Level4March": flag = true; break; case "Level6Dine": flag = BRBNetworker.Instance.DineFireExits.Value; break; case "Level7Offense": flag = BRBNetworker.Instance.OffenseFireExits.Value; break; } if (!flag) { return; } EntranceTeleport entranceTeleport = SceneOverrides.entranceTeleport1; if ((Object)(object)((entranceTeleport != null) ? ((NetworkBehaviour)entranceTeleport).NetworkObject : null) != (Object)null) { BRBNetworker.Instance.SyncFireExitRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)SceneOverrides.entranceTeleport1).NetworkObject), 1, isEntranceToBuilding: true, 2, fresh: false); EntranceTeleport entranceTeleport2 = SceneOverrides.entranceTeleport2; if ((Object)(object)((entranceTeleport2 != null) ? ((NetworkBehaviour)entranceTeleport2).NetworkObject : null) != (Object)null) { BRBNetworker.Instance.SyncFireExitRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)SceneOverrides.entranceTeleport2).NetworkObject), 2, isEntranceToBuilding: true, 2, fresh: false); EntranceTeleport entranceTeleport3 = SceneOverrides.entranceTeleport3; if ((Object)(object)((entranceTeleport3 != null) ? ((NetworkBehaviour)entranceTeleport3).NetworkObject : null) != (Object)null) { BRBNetworker.Instance.SyncFireExitRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)SceneOverrides.entranceTeleport3).NetworkObject), 3, isEntranceToBuilding: true, 2, fresh: false); } return; } } Plugin.Logger.LogWarning((object)$"Failed to resync fire exits as host:\n#1 - {SceneOverrides.entranceTeleport1}\n#2 - {SceneOverrides.entranceTeleport2}\n#3 - {SceneOverrides.entranceTeleport3}"); } [HarmonyPatch("SetExitIDs")] [HarmonyFinalizer] [HarmonyPriority(0)] private static void RoundManager_Post_SetExitIDs() { if ((Object)(object)SceneOverrides.entranceTeleport1 != (Object)null || (Object)(object)SceneOverrides.entranceTeleport2 != (Object)null || (Object)(object)SceneOverrides.entranceTeleport3 != (Object)null) { Plugin.Logger.LogDebug((object)"Running final synchronization step for fire exits"); } if ((Object)(object)SceneOverrides.entranceTeleport1 != (Object)null) { if (SceneOverrides.entranceTeleport1.entranceId != 1) { Plugin.Logger.LogWarning((object)$"Fire exit \"{((Object)SceneOverrides.entranceTeleport1).name}\" is expressing an incorrect ID of {SceneOverrides.entranceTeleport1.entranceId} on this client (should be 1)"); SceneOverrides.entranceTeleport1.entranceId = 1; } else { Plugin.Logger.LogDebug((object)("Fire exit \"" + ((Object)SceneOverrides.entranceTeleport1).name + "\" is nutritious and healthy")); } } if ((Object)(object)SceneOverrides.entranceTeleport2 != (Object)null) { if (SceneOverrides.entranceTeleport2.entranceId != 2) { Plugin.Logger.LogWarning((object)$"Fire exit \"{((Object)SceneOverrides.entranceTeleport2).name}\" is expressing an incorrect ID of {SceneOverrides.entranceTeleport2.entranceId} on this client (should be 2)"); SceneOverrides.entranceTeleport2.entranceId = 2; } else { Plugin.Logger.LogDebug((object)("Fire exit \"" + ((Object)SceneOverrides.entranceTeleport2).name + "\" is nutritious and healthy")); } } if ((Object)(object)SceneOverrides.entranceTeleport3 != (Object)null) { if (SceneOverrides.entranceTeleport3.entranceId != 3) { Plugin.Logger.LogWarning((object)$"Fire exit \"{((Object)SceneOverrides.entranceTeleport3).name}\" is expressing an incorrect ID of {SceneOverrides.entranceTeleport3.entranceId} on this client (should be 3)"); SceneOverrides.entranceTeleport3.entranceId = 3; } else { Plugin.Logger.LogDebug((object)("Fire exit \"" + ((Object)SceneOverrides.entranceTeleport3).name + "\" is nutritious and healthy")); } } } } [HarmonyPatch(typeof(RuntimeDungeon))] internal static class RuntimeDungeonPatches { private const float DINE_REND_DIFF = 1.0833333f; [HarmonyPatch("Generate")] [HarmonyPrefix] [HarmonyBefore(new string[] { "imabatby.lethallevelloader" })] [HarmonyPriority(100)] private static void RuntimeDungeon_Pre_Generate(RuntimeDungeon __instance) { int fireExitCount = 0; if (!BRBNetworker.Instance.MoonsKillSwitch.Value) { switch (((Object)RoundManager.Instance.currentLevel).name) { case "OffenseLevel": if (BRBNetworker.Instance.OffenseFireExits.Value) { fireExitCount = 1; } break; case "RendLevel": if (BRBNetworker.Instance.RendShrink.Value) { DungeonGenerator generator4 = __instance.Generator; generator4.LengthMultiplier /= 1.125f; Plugin.Logger.LogDebug((object)"Shrink Rend"); } break; case "DineLevel": if (BRBNetworker.Instance.DineFireExits.Value) { DungeonGenerator generator2 = __instance.Generator; generator2.LengthMultiplier *= 1.0833333f; Plugin.Logger.LogDebug((object)"Increase Dine"); fireExitCount = 2; } break; case "ArtificeLevel": if (RoundManager.Instance.currentDungeonType != 4 && BRBNetworker.Instance.ArtificeInteriors.Value) { DungeonGenerator generator3 = __instance.Generator; generator3.LengthMultiplier /= 0.9f; Plugin.Logger.LogDebug((object)"Increase Artifice factory/manor"); } break; case "EmbrionLevel": if (BRBNetworker.Instance.EmbrionMega.Value) { switch (RoundManager.Instance.currentDungeonType) { case 0: __instance.Generator.LengthMultiplier = 2.35f * RoundManager.Instance.mapSizeMultiplier; break; case 1: __instance.Generator.LengthMultiplier = 2.4f * RoundManager.Instance.mapSizeMultiplier; break; case 4: __instance.Generator.LengthMultiplier = 2.2f * RoundManager.Instance.mapSizeMultiplier; break; default: { DungeonGenerator generator = __instance.Generator; generator.LengthMultiplier *= 3f; break; } } } break; } } __instance.Generator.LengthMultiplier = Mathf.Floor(__instance.Generator.LengthMultiplier * 100f) / 100f; Plugin.Logger.LogDebug((object)$"Final length multiplier: {__instance.Generator.LengthMultiplier} (Interior #{RoundManager.Instance.currentDungeonType}, seed: {StartOfRound.Instance.randomMapSeed})"); if (BRBNetworker.Instance.ProportionalFireExits.Value || (!BRBNetworker.Instance.MoonsKillSwitch.Value && (BRBNetworker.Instance.OffenseFireExits.Value || BRBNetworker.Instance.DineFireExits.Value))) { GlobalPropSettings val = __instance.Generator.DungeonFlow?.GlobalProps?.FirstOrDefault((Func)((GlobalPropSettings globalPropSettings) => globalPropSettings.ID == 1231)); if (val != null) { EntranceTeleport[] array = Object.FindObjectsByType((FindObjectsSortMode)0); Common.fireExitCount = fireExitCount; EntranceTeleport[] array2 = array; foreach (EntranceTeleport val2 in array2) { if (val2.entranceId != 0 && val2.isEntranceToBuilding && !Common.extraFireExits.Contains(val2)) { Common.fireExitCount++; } } if (BRBNetworker.Instance.ProportionalFireExits.Value) { val.Count.Min = 0; val.Count.Max = 0; } else { val.Count.Min = Common.fireExitCount; val.Count.Max = Common.fireExitCount; } Plugin.Logger.LogDebug((object)$"Fire exits: {Common.fireExitCount}"); } else { Plugin.Logger.LogError((object)"Failed to adjust interior's fire exit count"); } } Common.extraFireExits.Clear(); } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatches { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void StartOfRound_Post_Awake(StartOfRound __instance) { //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Expected O, but got Unknown //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown if (Common.enemies.Count < 1) { SelectableLevel val = Object.FindAnyObjectByType()?.testAllEnemiesLevel; if ((Object)(object)val != (Object)null) { List[] array = new List[3] { val.Enemies, val.OutsideEnemies, val.DaytimeEnemies }; for (int i = 0; i < array.Length; i++) { foreach (SpawnableEnemyWithRarity item in array[i]) { if (!Common.enemies.ContainsKey(((Object)item.enemyType).name)) { Common.enemies.Add(((Object)item.enemyType).name, item.enemyType); } } } } } EnemyType masked = Common.enemies["MaskedPlayerEnemy"]; EnemyType butler = Common.enemies["Butler"]; if ((Object)(object)masked != (Object)null && (Object)(object)butler != (Object)null) { SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val2 in levels) { if ((Object)(object)masked != (Object)null && (val2.sceneName == "Level2Assurance" || val2.sceneName == "Level7Offense") && !val2.Enemies.Any((SpawnableEnemyWithRarity enemy) => (Object)(object)enemy.enemyType == (Object)(object)masked)) { val2.Enemies.Add(new SpawnableEnemyWithRarity(masked, 0)); Plugin.Logger.LogDebug((object)("Added Masked to " + ((Object)val2).name + " pool on client (fallback)")); } else if ((Object)(object)butler != (Object)null && val2.sceneName == "Level10Adamance" && !val2.Enemies.Any((SpawnableEnemyWithRarity enemy) => (Object)(object)enemy.enemyType == (Object)(object)butler)) { val2.Enemies.Add(new SpawnableEnemyWithRarity(butler, 0)); Plugin.Logger.LogDebug((object)("Added butlers to " + ((Object)val2).name + " pool on client (fallback)")); } } } else { Plugin.Logger.LogWarning((object)"Failed to reference \"masked\" or butler enemy types. This should never happen"); } BRBNetworker.Create(); } } [HarmonyPatch(typeof(Terminal))] internal static class TerminalPatches { internal static float fakeValueMultiplier = 0.4f; [HarmonyPatch("TextPostProcess")] [HarmonyPrefix] [HarmonyBefore(new string[] { "butterystancakes.lethalcompany.butteryfixes", "uk.1a3.lethalfixes" })] [HarmonyPriority(500)] private static void Terminal_Pre_TextPostProcess(ref float __state) { __state = RoundManager.Instance.scrapValueMultiplier; RoundManager.Instance.scrapValueMultiplier = fakeValueMultiplier; } [HarmonyPatch("TextPostProcess")] [HarmonyPostfix] private static void Terminal_Post_TextPostProcess(float __state) { RoundManager.Instance.scrapValueMultiplier = __state; } [HarmonyPatch("SetItemSales")] [HarmonyTranspiler] private static IEnumerable Terminal_Trans_SetItemSales(IEnumerable instructions) { //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown List list = instructions.ToList(); MethodInfo methodInfo = AccessTools.DeclaredPropertyGetter(typeof(List), "Count"); MethodInfo methodInfo2 = AccessTools.Method(typeof(Random), "Next", new Type[2] { typeof(int), typeof(int) }, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(List), "RemoveAt", (Type[])null, (Type[])null); bool flag = false; bool flag2 = false; for (int i = 4; i < list.Count - 1; i++) { if (list[i].opcode == OpCodes.Callvirt) { if (!flag && list[i].operand as MethodInfo == methodInfo2 && list[i - 1].opcode == OpCodes.Callvirt && list[i - 1].operand as MethodInfo == methodInfo) { list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.DeclaredPropertyGetter(typeof(List), "Item"))); list.Insert(i - 4, new CodeInstruction(list[i - 2].opcode, list[i - 2].operand)); i++; flag = true; } else if (!flag2 && list[i].operand as MethodInfo == methodInfo3) { list[i].operand = AccessTools.Method(typeof(List), "Remove", (Type[])null, (Type[])null); list.Insert(i + 1, new CodeInstruction(OpCodes.Pop, (object)null)); i++; flag2 = true; } } if (flag && flag2) { Plugin.Logger.LogDebug((object)"Transpiler (Terminal): Fix discount calculations"); return list; } } Plugin.Logger.LogWarning((object)"Terminal transpiler failed"); return instructions; } [HarmonyPatch("RunTerminalEvents")] [HarmonyPostfix] private static void Terminal_Post_RunTerminalEvents(Terminal __instance, TerminalNode node) { if (node.terminalEvent == "cheat_ResetCredits" && ((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsServer) { switch (GameNetworkManager.Instance.localPlayerController.playerUsername) { case "Blueray": return; case "Puffo": return; } __instance.useCreditsCooldown = true; __instance.groupCredits = 2500; __instance.SyncGroupCreditsServerRpc(__instance.groupCredits, __instance.numberOfItemsInDropship); } } } [HarmonyPatch(typeof(TimeOfDay))] internal static class TimeOfDayPatches { [HarmonyPatch("SetWeatherBasedOnVariables")] [HarmonyPrefix] private static void TimeOfDay_Pre_SetWeatherBasedOnVariables(TimeOfDay __instance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 if (!StartOfRound.Instance.isChallengeFile && !BRBNetworker.Instance.MoonsKillSwitch.Value && ((Object)RoundManager.Instance.currentLevel).name == "DineLevel" && (int)__instance.currentLevelWeather == 4 && BRBNetworker.Instance.DineFloods.Value) { TimeOfDay.Instance.currentWeatherVariable = -16f; TimeOfDay.Instance.currentWeatherVariable2 = -5f; } } [HarmonyPatch("SetWeatherBasedOnVariables")] [HarmonyPostfix] private static void TimeOfDay_Post_SetWeatherBasedOnVariables(TimeOfDay __instance) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if ((int)StartOfRound.Instance.currentLevel.currentWeather == 3 && ((Behaviour)__instance.foggyWeather).enabled && BRBNetworker.Instance.FoggyLimit.Value) { __instance.foggyWeather.parameters.meanFreePath = Mathf.Max(__instance.foggyWeather.parameters.meanFreePath, 7f); } } [HarmonyPatch("DecideRandomDayEvents")] [HarmonyPrefix] private static bool TimeOfDay_Pre_DecideRandomDayEvents(TimeOfDay __instance) { if (((NetworkBehaviour)__instance).IsServer && Configuration.experimentationNoEvents.Value) { return !BRBNetworker.Instance.MoonsKillSwitch.Value; } return true; } } [HarmonyPatch(typeof(VehicleController))] internal static class VehicleControllerPatches { private const float MIN_STAMINA_DRAIN = 0.08f; private const float MAX_STAMINA_DRAIN = 0.125f; private const float STAMINA_MULT = 2f; internal static int criticalDurability = 16; internal static float regenInterval = 8f; internal static float scrapingStress = 0.2f; internal static float adjustableCrashSpeed = 28f; private static float timeAtLastTreeDestroyed; [HarmonyPatch("Start")] [HarmonyPostfix] private static void VehicleController_Post_Start(VehicleController __instance) { if (__instance.vehicleID == 0) { Common.vehicleController = __instance; } } [HarmonyPatch("CarReactToObstacle")] [HarmonyPrefix] private static bool VehicleController_Pre_CarReactToObstacle(VehicleController __instance, ref int __state, CarObstacleType type, EnemyAI enemyScript, ref bool dealDamage) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 __state = __instance.carHP; if (Common.INSTALLED_VERSION55_COMPANY_CRUISER || __instance.vehicleID != 0) { return true; } if ((int)type == 1 && (Object)(object)enemyScript != (Object)null && BRBNetworker.Instance.FoxSlender.Value && enemyScript is BushWolfEnemy) { return false; } if ((int)type == 2 && Time.realtimeSinceStartup - timeAtLastTreeDestroyed < Time.fixedDeltaTime) { dealDamage = true; Plugin.Logger.LogDebug((object)"Cruiser received damage in response to tree destruction"); } return true; } [HarmonyPatch("CarReactToObstacle")] [HarmonyPostfix] private static void VehicleController_Post_CarReactToObstacle(VehicleController __instance, int __state, Vector3 vel, CarObstacleType type, float obstacleSize, EnemyAI enemyScript) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) if (Common.INSTALLED_VERSION55_COMPANY_CRUISER || __instance.vehicleID != 0 || __instance.carHP <= 0 || (int)type != 1 || !((Object)(object)enemyScript != (Object)null) || __instance.carHP > __state || !BRBNetworker.Instance.CruiserEnemyDamage.Value) { return; } int num = __instance.carHP - (__state - 2); if (num < 1) { return; } if (!__instance.ignitionStarted && (int)__instance.gear == 3 && (Object)(object)__instance.currentDriver == (Object)null && (Object)(object)__instance.currentPassenger == (Object)null) { bool flag = true; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { if (!((Object)(object)StartOfRound.Instance.allPlayerScripts[i] == (Object)null) && (Object)(object)StartOfRound.Instance.allPlayerScripts[i].physicsParent != (Object)null && (Object)(object)StartOfRound.Instance.allPlayerScripts[i].physicsParent == (Object)(object)((Component)__instance).transform) { flag = false; break; } } if (flag) { return; } } if (!(enemyScript is FlowerSnakeEnemy)) { float num2 = ((obstacleSize > 2f) ? 15f : 9f); Vector3 val = vel; val.y = 0f; if (!(((Vector3)(ref val)).magnitude >= num2)) { Plugin.Logger.LogDebug((object)$"Cruiser takes extra {num} damage from collision with enemy \"{((Object)enemyScript).name}\" (#{((Object)enemyScript).GetInstanceID()})"); __instance.DealPermanentDamage(num, default(Vector3)); } } } [HarmonyPatch("DoTurboBoost")] [HarmonyPrefix] private static bool VehicleController_Pre_DoTurboBoost(VehicleController __instance, CallbackContext context) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (Common.INSTALLED_VERSION55_COMPANY_CRUISER || __instance.vehicleID != 0 || __instance.turboBoosts > 0 || !BRBNetworker.Instance.CruiserExhaust.Value) { return true; } if (((CallbackContext)(ref context)).performed && __instance.localPlayerInControl && !__instance.keyIsInDriverHand && (Object)(object)__instance.currentDriver == (Object)(object)GameNetworkManager.Instance.localPlayerController) { if (__instance.currentDriver.isExhausted || __instance.currentDriver.sprintMeter <= 0.3f) { return false; } if (!__instance.jumpingInCar) { float num = 0.08f; if (Vector3.Angle(Vector3.up, ((Component)__instance).transform.forward) < Vector3.Angle(Vector3.down, ((Component)__instance).transform.forward)) { num = Mathf.Lerp(num, 0.125f, (Vector3.Angle(Vector3.up, ((Component)__instance).transform.up) - __instance.physicsRegion.maxTippingAngle) / (90f - __instance.physicsRegion.maxTippingAngle)); } __instance.currentDriver.sprintMeter = Mathf.Clamp01(__instance.currentDriver.sprintMeter - num * 2f); if (__instance.currentDriver.sprintMeter <= 0.3f) { __instance.currentDriver.sprintMeter = 0.1f; __instance.currentDriver.isExhausted = true; } } return true; } return true; } [HarmonyPatch("ReactToDamage")] [HarmonyTranspiler] private static IEnumerable VehicleController_Trans_ReactToDamage(IEnumerable instructions) { List list = instructions.ToList(); FieldInfo fieldInfo = AccessTools.Field(typeof(VehicleController), "carHP"); FieldInfo fieldInfo2 = AccessTools.Field(typeof(VehicleController), "timeAtLastDamage"); bool flag = false; bool flag2 = false; for (int i = 2; i < list.Count; i++) { if (!flag && list[i].opcode == OpCodes.Ldc_I4_S && (sbyte)list[i].operand == criticalDurability && list[i - 1].opcode == OpCodes.Ldfld && (FieldInfo)list[i - 1].operand == fieldInfo) { list[i].opcode = OpCodes.Ldsfld; list[i].operand = AccessTools.Field(typeof(VehicleControllerPatches), "criticalDurability"); flag = true; } else if (!flag2 && list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == regenInterval && list[i - 1].opcode == OpCodes.Sub && list[i - 2].opcode == OpCodes.Ldfld && (FieldInfo)list[i - 2].operand == fieldInfo2) { list[i].opcode = OpCodes.Ldsfld; list[i].operand = AccessTools.Field(typeof(VehicleControllerPatches), "regenInterval"); flag2 = true; } if (flag && flag2) { Plugin.Logger.LogDebug((object)"Transpiler (Cruiser): Dynamic regen"); return list; } } Plugin.Logger.LogWarning((object)"Cruiser regen transpiler failed"); return instructions; } internal static void JustDestroyedTree() { Plugin.Logger.LogDebug((object)"A tree was just destroyed"); if ((Object)(object)Common.vehicleController != (Object)null && Common.vehicleController.vehicleID == 0 && !Common.INSTALLED_VERSION55_COMPANY_CRUISER && ((NetworkBehaviour)Common.vehicleController).IsOwner && BRBNetworker.Instance.CruiserTrees.Value) { timeAtLastTreeDestroyed = Time.realtimeSinceStartup; } } internal static void DealExtraCrashDamage(VehicleController vehicleController, int damage) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)vehicleController != (Object)null && vehicleController.vehicleID == 0 && !Common.INSTALLED_VERSION55_COMPANY_CRUISER && BRBNetworker.Instance.CruiserCrashDamage.Value) { Plugin.Logger.LogDebug((object)$"Cruiser takes extra {damage} damage from collision with geometry"); vehicleController.DealPermanentDamage(damage, default(Vector3)); } } [HarmonyPatch("OnCollisionEnter")] [HarmonyTranspiler] private static IEnumerable VehicleController_Trans_OnCollisionEnter(IEnumerable instructions) { //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Expected O, but got Unknown //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Expected O, but got Unknown //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Expected O, but got Unknown //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Expected O, but got Unknown //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Expected O, but got Unknown //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Expected O, but got Unknown //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Expected O, but got Unknown List list = instructions.ToList(); MethodInfo methodInfo = AccessTools.Method(typeof(VehicleController), "SetInternalStress", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.DeclaredPropertyGetter(typeof(Vector3), "magnitude"); MethodInfo methodInfo3 = AccessTools.Method(typeof(VehicleController), "DealPermanentDamage", (Type[])null, (Type[])null); MethodInfo methodInfo4 = AccessTools.Method(typeof(VehicleControllerPatches), "DealExtraCrashDamage", (Type[])null, (Type[])null); FieldInfo fieldInfo = AccessTools.Field(typeof(VehicleController), "averageVelocity"); bool flag = false; bool flag2 = false; int num = 0; for (int i = 4; i < list.Count - 1; i++) { if (list[i].opcode == OpCodes.Ldc_R4) { if (!flag && (float)list[i].operand == scrapingStress && list[i + 1].opcode == OpCodes.Call && list[i + 1].operand as MethodInfo == methodInfo) { list[i].opcode = OpCodes.Ldsfld; list[i].operand = AccessTools.Field(typeof(VehicleControllerPatches), "scrapingStress"); flag = true; } else if (!flag2 && (float)list[i].operand == adjustableCrashSpeed && list[i - 1].opcode == OpCodes.Call && list[i - 1].operand as MethodInfo == methodInfo2) { list[i].opcode = OpCodes.Ldsfld; list[i].operand = AccessTools.Field(typeof(VehicleControllerPatches), "adjustableCrashSpeed"); flag2 = true; } } else if (num == 0 && flag2 && list[i].opcode == OpCodes.Call && list[i].operand as MethodInfo == methodInfo3 && list[i - 4].opcode == OpCodes.Ldc_I4_2) { list.InsertRange(i + 1, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldc_I4_4, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo4) })); i += 3; num++; } else if (num == 1 && list[i].opcode == OpCodes.Call && list[i].operand as MethodInfo == methodInfo3 && list[i - 4].opcode == OpCodes.Ldc_I4_1) { list.InsertRange(i + 1, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldc_I4_1, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo4) })); i += 3; num++; } else if (num == 2 && list[i].opcode == OpCodes.Call && list[i].operand as MethodInfo == methodInfo2 && list[i - 1].opcode == OpCodes.Ldflda && (FieldInfo)list[i - 1].operand == fieldInfo && list[i + 1].opcode == OpCodes.Ldc_R4 && (float)list[i + 1].operand == 1.5f && list[i - 3].opcode == OpCodes.Br) { list.InsertRange(i - 3, new <>z__ReadOnlyArray((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldc_I4_1, (object)null), new CodeInstruction(OpCodes.Call, (object)methodInfo4) })); i += 3; num++; } if (flag && flag2 && num == 3) { Plugin.Logger.LogDebug((object)"Transpiler (Cruiser): Extra crash damage"); return list; } } Plugin.Logger.LogWarning((object)"Cruiser crash transpiler failed"); return instructions; } } } namespace ButteRyBalance.Patches.Items { [HarmonyPatch(typeof(LungProp))] internal static class ApparatusPatches { [HarmonyPatch("EquipItem")] [HarmonyPrefix] private static void LungProp_Pre_EquipItem(LungProp __instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)__instance).IsOwner && __instance.isLungDocked && BRBNetworker.Instance.ApparatusPrice.Value) { BRBNetworker.Instance.SyncScrapPriceRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), ((GrabbableObject)__instance).scrapValue); } } } [HarmonyPatch(typeof(JetpackItem))] internal static class JetpackPatches { private static readonly AnimationCurve accelerationCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[4] { new Keyframe(1.5f, 10f), new Keyframe(1.73f, 10f), new Keyframe(2f, 4f), new Keyframe(2.3f, 2f) }); private static readonly AnimationCurve handlingCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[4] { new Keyframe(1.5f, 20f), new Keyframe(1.73f, 20f), new Keyframe(2f, 35f), new Keyframe(2.3f, 50f) }); private static readonly AnimationCurve decelerationCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(1.5f, 75f), new Keyframe(2f, 50f), new Keyframe(2.23f, 45f) }); private static float timeSpentFlying; [HarmonyPatch("EquipItem")] [HarmonyPostfix] private static void JetpackItem_Post_EquipItem(JetpackItem __instance) { if (BRBNetworker.Instance.JetpackBattery.Value) { ((GrabbableObject)__instance).itemProperties.batteryUsage = 40f; } switch ((Configuration.JetpackControls)BRBNetworker.Instance.JetpackControls.Value) { case Configuration.JetpackControls.V49: __instance.jetpackForceChangeSpeed = 1f; __instance.jetpackDeaccelleration = 75f; break; case Configuration.JetpackControls.Vanilla: __instance.jetpackForceChangeSpeed = 50f; break; } } [HarmonyPatch(typeof(JetpackItem), "Update")] [HarmonyTranspiler] private static IEnumerable JetpackItem_Trans_Update(IEnumerable instructions) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown List list = instructions.ToList(); for (int i = 1; i < list.Count - 3; i++) { if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 50f && list[i + 1].opcode == OpCodes.Mul) { list[i].opcode = OpCodes.Ldfld; list[i].operand = AccessTools.Field(typeof(JetpackItem), "jetpackForceChangeSpeed"); list.Insert(i, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); Plugin.Logger.LogDebug((object)"Transpiler (Jetpack): Dynamic inertia"); return list; } } return instructions; } [HarmonyPatch("Update")] [HarmonyPrefix] private static void JetpackItem_Pre_Update(JetpackItem __instance) { if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null || (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)(object)GameNetworkManager.Instance?.localPlayerController) { return; } float num = 10f; if (BRBNetworker.Instance.JetpackControls.Value == 2) { num = accelerationCurve.Evaluate(((GrabbableObject)__instance).playerHeldBy.carryWeight); __instance.jetpackForceChangeSpeed = handlingCurve.Evaluate(((GrabbableObject)__instance).playerHeldBy.carryWeight); __instance.jetpackDeaccelleration = decelerationCurve.Evaluate(((GrabbableObject)__instance).playerHeldBy.carryWeight); } if (BRBNetworker.Instance.JetpackWarmUp.Value) { if (!((GrabbableObject)__instance).playerHeldBy.jetpackControls) { timeSpentFlying = 0f; } else if (__instance.jetpackActivated) { timeSpentFlying += Time.deltaTime; } if (timeSpentFlying < 2f) { __instance.jetpackAcceleration = 2f * __instance.verticalMultiplier; } else { __instance.jetpackAcceleration = Mathf.Lerp(2f, num, Mathf.InverseLerp(2f, 4f, timeSpentFlying)); } } else { __instance.jetpackAcceleration = num; } } } [HarmonyPatch(typeof(KnifeItem))] internal static class KnifePatches { private static float knifeCooldown = 0.43f; private static float timeAtLastSwing; private static InputAction activateItem; [HarmonyPatch(typeof(GrabbableObject), "Start")] [HarmonyPostfix] private static void GrabbableObject_Post_Start(GrabbableObject __instance) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)__instance).IsServer && !StartOfRound.Instance.inShipPhase && __instance.scrapValue == 35 && Configuration.butlerKnifePrice.Value && __instance is KnifeItem) { Plugin.Logger.LogInfo((object)"Trying to sync knife price on server"); BRBNetworker.Instance.SyncScrapPriceRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), Random.Range(28, 84)); } } [HarmonyPatch("EquipItem")] [HarmonyPostfix] private static void KnifeItem_Post_EquipItem(KnifeItem __instance) { knifeCooldown = (BRBNetworker.Instance.KnifeShortCooldown.Value ? 0.37f : 0.43f); } [HarmonyPatch("HitKnife")] [HarmonyTranspiler] private static IEnumerable KnifeItem_Trans_HitKnife(IEnumerable instructions) { List list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 0.43f) { list[i].opcode = OpCodes.Ldsfld; list[i].operand = AccessTools.Field(typeof(KnifePatches), "knifeCooldown"); Plugin.Logger.LogDebug((object)"Transpiler (Knife): Dynamic cooldown"); return list; } } return instructions; } [HarmonyPatch(typeof(PlayerControllerB), "OnEnable")] [HarmonyPostfix] private static void PlayerControllerB_Post_OnEnable() { activateItem = InputSystem.actions.FindAction("ActivateItem", false); } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void PlayerControllerB_Post_Update(PlayerControllerB __instance) { if (!((Object)(object)__instance.currentlyHeldObjectServer != (Object)null) || !(__instance.timeSinceSwitchingSlots >= 0.075f)) { return; } GrabbableObject currentlyHeldObjectServer = __instance.currentlyHeldObjectServer; KnifeItem val = (KnifeItem)(object)((currentlyHeldObjectServer is KnifeItem) ? currentlyHeldObjectServer : null); if (val != null && Configuration.knifeAutoSwing.Value && __instance.CanUseItem() && activateItem.IsPressed() && Time.realtimeSinceStartup - timeAtLastSwing > 0.12f && Time.realtimeSinceStartup - val.timeAtLastDamageDealt > knifeCooldown) { if (Time.realtimeSinceStartup - timeAtLastSwing <= 0.5f) { ShipBuildModeManager.Instance.CancelBuildMode(true); __instance.currentlyHeldObjectServer.UseItemOnClient(true); __instance.timeSinceSwitchingSlots = 0f; } timeAtLastSwing = Time.realtimeSinceStartup + Random.Range(0f, 0.01f); } } } [HarmonyPatch(typeof(Shovel))] internal static class ShovelPatches { private static float timeLastBuffered; private static InputAction activateItem; [HarmonyPatch("ItemActivate")] [HarmonyPrefix] private static void Shovel_Post_ItemActivate(Shovel __instance, bool buttonDown) { if (buttonDown && __instance.reelingUp) { timeLastBuffered = Time.realtimeSinceStartup; } } [HarmonyPatch(typeof(PlayerControllerB), "OnEnable")] [HarmonyPostfix] private static void PlayerControllerB_Post_OnEnable() { activateItem = InputSystem.actions.FindAction("ActivateItem", false); } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void PlayerControllerB_Post_Update(PlayerControllerB __instance) { if ((Object)(object)__instance.currentlyHeldObjectServer != (Object)null && __instance.timeSinceSwitchingSlots >= 0.075f && __instance.currentlyHeldObjectServer is Shovel && Configuration.shovelBuffer.Value && __instance.CanUseItem() && activateItem.IsPressed() && Time.realtimeSinceStartup - timeLastBuffered < 0.5f) { if (Time.realtimeSinceStartup - timeLastBuffered <= 0.5f) { ShipBuildModeManager.Instance.CancelBuildMode(true); __instance.currentlyHeldObjectServer.UseItemOnClient(true); __instance.timeSinceSwitchingSlots = 0f; } timeLastBuffered = Time.realtimeSinceStartup + Random.Range(0f, 0.01f); } } } [HarmonyPatch(typeof(SprayPaintItem))] internal static class SprayPaintPatches { internal static int damageNumber = 8; [HarmonyPatch("HealPlayerInfection")] [HarmonyTranspiler] private static IEnumerable SprayPaintItem_Trans_HealPlayerInfection(IEnumerable instructions) { List list = instructions.ToList(); MethodInfo methodInfo = AccessTools.Method(typeof(PlayerControllerB), "DamagePlayer", (Type[])null, (Type[])null); for (int i = 0; i < list.Count - 9; i++) { if (list[i].opcode == OpCodes.Ldc_I4_8 && list[i + 9].opcode == OpCodes.Callvirt && list[i + 9].operand as MethodInfo == methodInfo) { list[i].opcode = OpCodes.Ldsfld; list[i].operand = AccessTools.Field(typeof(SprayPaintPatches), "damageNumber"); Plugin.Logger.LogDebug((object)"Transpiler (Spray paint): Dynamic damage"); return list; } } return instructions; } } [HarmonyPatch(typeof(PatcherTool))] internal static class ZapGunPatches { [HarmonyPatch("EquipItem")] [HarmonyPostfix] private static void PatcherTool_Post_EquipItem(PatcherTool __instance) { if (BRBNetworker.Instance.ZapGunBattery.Value) { ((GrabbableObject)__instance).itemProperties.batteryUsage = 120f; } } } } namespace ButteRyBalance.Patches.Enemies { [HarmonyPatch(typeof(StingrayAI))] internal static class BackwaterGunkfishPatches { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StingrayAI_Post_Start(StingrayAI __instance) { if (BRBNetworker.Instance.GunkfishSquishy.Value) { ((EnemyAI)__instance).enemyHP = 3; } } } [HarmonyPatch(typeof(ButlerEnemyAI))] internal static class ButlerPatches { [HarmonyPatch("OnCollideWithPlayer")] [HarmonyPrefix] private static bool ButlerEnemyAI_Pre_OnCollideWithPlayer(ButlerEnemyAI __instance, Collider other) { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) if (!BRBNetworker.Instance.ButlerStealthStab.Value && !BRBNetworker.Instance.ButlerLongCooldown.Value) { return true; } if (((EnemyAI)__instance).isEnemyDead) { return false; } if (((EnemyAI)__instance).currentBehaviourStateIndex != 2 && __instance.berserkModeTimer <= 0f) { if (Time.realtimeSinceStartup - __instance.timeSinceStealthStab < 10f) { return false; } __instance.timeSinceStealthStab = Time.realtimeSinceStartup; if (Random.Range(0, 100) < 95) { return false; } } float num = 0.25f; if (BRBNetworker.Instance.ButlerLongCooldown.Value && __instance.timeAtLastButlerDamage <= 0f && __instance.berserkModeTimer <= 3f) { num = 0.35f; } if (__instance.timeSinceHittingPlayer < num) { return false; } PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { __instance.timeSinceHittingPlayer = 0f; val.DamagePlayer(10, true, true, (CauseOfDeath)14, 0, false, default(Vector3)); bool flag = ((EnemyAI)__instance).currentBehaviourStateIndex != 2; if (flag && BRBNetworker.Instance.ButlerStealthStab.Value) { flag = !val.NearOtherPlayers(15f); if (flag) { for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { if (!((Object)(object)StartOfRound.Instance.allPlayerScripts[i] == (Object)(object)GameNetworkManager.Instance.localPlayerController) && !StartOfRound.Instance.allPlayerScripts[i].isPlayerDead && StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled && ((EnemyAI)__instance).CheckLineOfSightForPosition(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, 110f, 60, 2f, (Transform)null)) { flag = false; break; } } } } if (flag) { __instance.berserkModeTimer = 3f; } __instance.StabPlayerServerRpc((int)val.playerClientId, flag); } return false; } [HarmonyPatch("HitEnemy")] [HarmonyPrefix] private static void ButlerEnemyAI_Pre_HitEnemy(ButlerEnemyAI __instance, ref int force, int hitID) { if (force > 2 && BRBNetworker.Instance.ButlerSquishy.Value && hitID != 1) { force += 3; } } [HarmonyPatch("HitEnemy")] [HarmonyPostfix] private static void ButlerEnemyAI_Post_HitEnemy(ButlerEnemyAI __instance, PlayerControllerB playerWhoHit) { if ((Object)(object)playerWhoHit != (Object)null && BRBNetworker.Instance.ButlerLongCooldown.Value) { __instance.timeAtLastButlerDamage = Time.realtimeSinceStartup; } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void ButlerEnemyAI_Post_Start(ButlerEnemyAI __instance) { if (BRBNetworker.Instance.ButlerLongCooldown.Value) { ((EnemyAI)__instance).enemyHP = Mathf.Max(((EnemyAI)__instance).enemyHP, 3); } } [HarmonyPatch("SyncSearchingMadlyServerRpc")] [HarmonyPostfix] private static void ButlerEnemyAI_Post_SyncSearchingMadlyServerRpc(ref bool isSearching) { if (isSearching && StartOfRound.Instance.connectedPlayersAmount < 1 && Configuration.butlerNoSearch.Value) { isSearching = false; } } [HarmonyPatch("LookForChanceToMurder")] [HarmonyPostfix] private static void ButlerEnemyAI_Post_LookForChanceToMurder(ButlerEnemyAI __instance) { if (__instance.madlySearchingForPlayers && StartOfRound.Instance.connectedPlayersAmount < 1 && Configuration.butlerNoSearch.Value) { __instance.madlySearchingForPlayers = false; if (__instance.roamAndSweepFloor.searchPrecision >= 16f) { __instance.roamAndSweepFloor.searchPrecision = 10f; } } } } [HarmonyPatch(typeof(SpringManAI))] internal static class CoilHeadPatches { [HarmonyPatch(typeof(EnemyAI), "SetEnemyStunned")] [HarmonyPrefix] private static void EnemyAI_Pre_SetEnemyStunned(EnemyAI __instance, float setToStunTime) { SpringManAI val = (SpringManAI)(object)((__instance is SpringManAI) ? __instance : null); if (val != null && ((NetworkBehaviour)__instance).IsServer && Configuration.coilheadStunReset.Value && val.onCooldownPhase <= 0f && setToStunTime > 0.5f) { val.onCooldownPhase = setToStunTime * __instance.enemyType.stunTimeMultiplier; val.setOnCooldown = true; val.inCooldownAnimation = true; val.SetCoilheadOnCooldownServerRpc(true); } } [HarmonyPatch("SetCoilheadOnCooldownClientRpc")] [HarmonyPostfix] private static void SpringManAI_Post_SetCoilheadOnCooldownClientRpc(SpringManAI __instance, bool setTrue) { if (setTrue) { __instance.onCooldownPhase = Mathf.Max(__instance.onCooldownPhase, ((EnemyAI)__instance).stunNormalizedTimer * ((EnemyAI)__instance).enemyType.stunTimeMultiplier); } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void SpringManAI_Post_Update(SpringManAI __instance) { if (!((EnemyAI)__instance).isEnemyDead && !__instance.setOnCooldown && ((EnemyAI)__instance).currentBehaviourStateIndex == 0 && ((EnemyAI)__instance).creatureAnimator.GetFloat("walkSpeed") == 4.7f) { ((EnemyAI)__instance).creatureAnimator.SetFloat("walkSpeed", 2.5f); } if (((NetworkBehaviour)__instance).IsServer && Configuration.coilheadPersistence.Value) { __instance.timeSpentMoving = 0f; } } } [HarmonyPatch(typeof(ForestGiantAI))] internal static class ForestKeeperPatches { [HarmonyPatch(typeof(EnemyAI), "GetAllPlayersInLineOfSight")] [HarmonyPrefix] private static void EnemyAI_Pre_GetAllPlayersInLineOfSight(EnemyAI __instance, ref int range) { if (__instance.isOutside && !__instance.enemyType.canSeeThroughFog && range > 30 && ((NetworkBehaviour)__instance).IsOwner && __instance is ForestGiantAI && Configuration.giantSnowSight.Value && Common.IsSnowLevel()) { range = 30; } } [HarmonyPatch("HitEnemy")] [HarmonyPrefix] private static void ForestGiantAI_Pre_HitEnemy(ref int force, int hitID) { if (force != 12 || !BRBNetworker.Instance.GiantSquishy.Value) { return; } switch (hitID) { default: if (!((Object)(object)Common.vehicleController != (Object)null)) { break; } goto case 331; case 331: force += 100; break; case 1: case 5: break; } } } [HarmonyPatch(typeof(HoarderBugAI))] internal static class HoardingBugPatches { [HarmonyPatch("Update")] [HarmonyPostfix] private static void HoarderBugAI_Post_Update(HoarderBugAI __instance) { if (((NetworkBehaviour)__instance).IsOwner && Configuration.hoarderAngerManagement.Value && __instance.angryTimer > 0f) { __instance.annoyanceMeter = 0f; } } } [HarmonyPatch(typeof(JesterAI))] internal static class JesterPatches { [HarmonyPatch(typeof(EnemyAI), "SwitchToBehaviourStateOnLocalClient")] [HarmonyPostfix] private static void EnemyAI_Post_SwitchToBehaviourStateOnLocalClient(EnemyAI __instance, int stateIndex) { JesterAI val = (JesterAI)(object)((__instance is JesterAI) ? __instance : null); if (val != null && stateIndex == 1 && BRBNetworker.Instance.JesterWalkThrough.Value) { val.mainCollider.isTrigger = true; } } [HarmonyPatch("SetJesterInitialValues")] [HarmonyPostfix] private static void JesterAI_Post_SetJesterInitialValues(JesterAI __instance) { if (StartOfRound.Instance.connectedPlayersAmount < 4 && BRBNetworker.Instance.JesterLongCooldown.Value) { __instance.beginCrankingTimer = Mathf.Max(__instance.beginCrankingTimer, Random.Range(12f, 28f)); } } } [HarmonyPatch(typeof(CaveDwellerAI))] internal class ManeaterPatches { private static bool playersHaveEnteredBuilding; private static float GROWTH_SPEED_MULTIPLIER = 0.045f; [HarmonyPatch("HitEnemy")] [HarmonyPrefix] private static void CaveDwellerAI_Pre_HitEnemy(CaveDwellerAI __instance, ref float __state) { __state = __instance.growthMeter; } [HarmonyPatch("HitEnemy")] [HarmonyPostfix] private static void CaveDwellerAI_Post_HitEnemy(CaveDwellerAI __instance, float __state, PlayerControllerB playerWhoHit) { if (((NetworkBehaviour)__instance).IsServer && ((EnemyAI)__instance).currentBehaviourStateIndex == 0 && (Object)(object)playerWhoHit == (Object)null && !__instance.hasPlayerFoundBaby && BRBNetworker.Instance.ManeaterLimitGrowth.Value) { __instance.growthMeter = __state; } } [HarmonyPatch("KillEnemy")] [HarmonyPrefix] private static void CaveDwellerAI_Pre_KillEnemy(CaveDwellerAI __instance, ref float __state) { __state = __instance.growthMeter; } [HarmonyPatch("KillEnemy")] [HarmonyPostfix] private static void CaveDwellerAI_Post_KillEnemy(CaveDwellerAI __instance, float __state) { if (((NetworkBehaviour)__instance).IsServer && ((EnemyAI)__instance).currentBehaviourStateIndex == 0 && !__instance.hasPlayerFoundBaby && BRBNetworker.Instance.ManeaterLimitGrowth.Value) { __instance.growthMeter = __state; } } [HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayerClientRpc")] [HarmonyPostfix] private static void EntranceTeleport_Post_TeleportPlayerClientRpc() { playersHaveEnteredBuilding = true; } [HarmonyPatch(typeof(StartOfRound), "EndOfGameClientRpc")] [HarmonyPostfix] private static void StartOfRound_Post_EndOfGameClientRpc() { playersHaveEnteredBuilding = false; } [HarmonyPatch("SetCryingLocalClient")] [HarmonyPrefix] private static void CaveDwellerAI_Pre_SetCryingLocalClient(CaveDwellerAI __instance, ref bool setCrying) { if (setCrying && !((EnemyAI)__instance).isOutside && ((EnemyAI)__instance).currentBehaviourStateIndex == 0 && !playersHaveEnteredBuilding && BRBNetworker.Instance.ManeaterLimitGrowth.Value) { setCrying = false; } } [HarmonyPatch("IncreaseBabyGrowthMeter")] [HarmonyPrefix] private static void CaveDwellerAI_Pre_IncreaseBabyGrowthMeter(CaveDwellerAI __instance, ref float __state) { __state = __instance.growthMeter; } [HarmonyPatch("IncreaseBabyGrowthMeter")] [HarmonyPostfix] private static void CaveDwellerAI_Post_IncreaseBabyGrowthMeter(CaveDwellerAI __instance, float __state) { if (BRBNetworker.Instance.ManeaterLimitGrowth.Value) { if (!playersHaveEnteredBuilding) { __instance.growthMeter = 0f; } else if ((Object)(object)((GrabbableObject)(__instance.propScript?)).playerHeldBy != (Object)null && __instance.rockingBaby < 2 && !__instance.stopCryingWhenReleased) { __instance.growthMeter = __state + (__instance.growthMeter - __state) / 1.3f; } } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void CaveDwellerAI_Post_Start(CaveDwellerAI __instance) { GROWTH_SPEED_MULTIPLIER = __instance.growthSpeedMultiplier; } [HarmonyPatch("StopObserving")] [HarmonyPostfix] private static void CaveDwellerAI_Post_StopObserving(CaveDwellerAI __instance, bool eatScrap) { if (eatScrap && Configuration.maneaterScrapGrowth.Value) { if (__instance.scrapEaten == 1) { __instance.growthSpeedMultiplier = GROWTH_SPEED_MULTIPLIER * 0.75f; } else { __instance.growthSpeedMultiplier = GROWTH_SPEED_MULTIPLIER * 0.5f; } } } [HarmonyPatch("DoNonBabyUpdateLogic")] [HarmonyPostfix] private static void CaveDwellerAI_Post_DoNonBabyUpdateLogic(CaveDwellerAI __instance) { if (((NetworkBehaviour)__instance).IsOwner && BRBNetworker.Instance.ManeaterWideTurns.Value) { if (__instance.leaping && !((EnemyAI)__instance).isOutside) { ((EnemyAI)__instance).agent.angularSpeed = 220f; } else { ((EnemyAI)__instance).agent.angularSpeed = 700f; } } } [HarmonyPatch("StartTransformationAnim")] [HarmonyPostfix] private static void CaveDwellerAI_Post_StartTransformationAnim(CaveDwellerAI __instance) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (BRBNetworker.Instance.ManeaterTarget.Value) { ((Component)__instance).gameObject.layer = LayerMask.NameToLayer("Enemies"); if (!((Component)__instance).GetComponents().Any((Collider collider) => collider.isTrigger)) { float num = 1f / ((((Component)__instance).transform.localScale.x + ((Component)__instance).transform.localScale.y + ((Component)__instance).transform.localScale.z) / 3f); BoxCollider obj = ((Component)__instance).gameObject.AddComponent(); ((Collider)obj).isTrigger = true; obj.center = new Vector3(0f, 2.13f * num, 0f); obj.size = new Vector3(num, num, num); } } } } [HarmonyPatch(typeof(NutcrackerEnemyAI))] internal class NutcrackerPatches { [HarmonyPatch(typeof(NutcrackerEnemyAI), "GrabGun")] [HarmonyPostfix] private static void NutcrackerEnemyAI_Post_GrabGun(NutcrackerEnemyAI __instance) { if (!((NetworkBehaviour)__instance).IsServer && ((GrabbableObject)__instance.gun).scrapValue == 60 && BRBNetworker.Instance.NutcrackerGunPrice.Value) { RandomizeShotgunPrice(__instance.gun, __instance.randomSeedNumber); } } [HarmonyPatch(typeof(NutcrackerEnemyAI), "InitializeNutcrackerValuesClientRpc")] [HarmonyPostfix] private static void NutcrackerEnemyAI_Post_InitializeNutcrackerValuesClientRpc(NutcrackerEnemyAI __instance) { if ((Object)(object)__instance.gun != (Object)null && BRBNetworker.Instance.NutcrackerGunPrice.Value) { RandomizeShotgunPrice(__instance.gun, __instance.randomSeedNumber); } } private static void RandomizeShotgunPrice(ShotgunItem gun, int seed) { ((GrabbableObject)gun).SetScrapValue(new Random(seed).Next(25, 90)); } [HarmonyPatch(typeof(NutcrackerEnemyAI), "HitEnemy")] [HarmonyPrefix] private static void NutcrackerEnemyAI_Pre_HitEnemy(NutcrackerEnemyAI __instance, ref int force, int hitID) { if (((NetworkBehaviour)__instance).IsOwner && force == 5 && Configuration.nutcrackerKevlar.Value && hitID == -1) { force = 4; } } } } namespace ButteRyBalance.Overrides { internal class InfestationOverrides { private static int infestationEnemyIndex = -1; private static EnemyType infestationEnemy; private static float rollbackPowerLevel = -1f; private static int rollbackMaxCount = -1; private static int hourOfLastInfestationWave = -1; private static List compatibleEnemies = new List { "HoarderBug", "Nutcracker", "Butler", "MaskedPlayerEnemy", "ClaySurgeon", "Crawler", "Centipede", "SpringMan", "Stingray" }; private static readonly Dictionary> vanillaLevels = new Dictionary> { { "ExperimentationLevel", ExperimentationOverrides.infestations }, { "AssuranceLevel", AssuranceOverrides.infestations }, { "VowLevel", VowOverrides.infestations }, { "MarchLevel", MarchOverrides.infestations }, { "AdamanceLevel", AdamanceOverrides.infestations }, { "OffenseLevel", OffenseOverrides.infestations }, { "RendLevel", RendOverrides.infestations }, { "DineLevel", DineOverrides.infestations }, { "TitanLevel", TitanOverrides.infestations }, { "ArtificeLevel", ArtificeOverrides.infestations }, { "EmbrionLevel", EmbrionOverrides.infestations } }; private static List infestationEnemies = new List(); internal static void FilterInfestations() { if (Configuration.infestationButlers.Value) { if (!compatibleEnemies.Contains("Butler")) { compatibleEnemies.Add("Butler"); } } else { compatibleEnemies.Remove("Butler"); } if (Configuration.infestationMasked.Value) { if (!compatibleEnemies.Contains("MaskedPlayerEnemy")) { compatibleEnemies.Add("MaskedPlayerEnemy"); } } else { compatibleEnemies.Remove("MaskedPlayerEnemy"); } if (Configuration.infestationBarbers.Value && RoundManager.Instance.currentDungeonType != 4) { if (!compatibleEnemies.Contains("ClaySurgeon")) { compatibleEnemies.Add("ClaySurgeon"); } } else { compatibleEnemies.Remove("ClaySurgeon"); } if (Configuration.infestationThumpers.Value) { if (!compatibleEnemies.Contains("Crawler")) { compatibleEnemies.Add("Crawler"); } } else { compatibleEnemies.Remove("Crawler"); } if (Configuration.infestationSnareFlea.Value) { if (!compatibleEnemies.Contains("Centipede")) { compatibleEnemies.Add("Centipede"); } } else { compatibleEnemies.Remove("Centipede"); } if (Configuration.infestationCoilhead.Value) { if (!compatibleEnemies.Contains("SpringMan")) { compatibleEnemies.Add("SpringMan"); } } else { compatibleEnemies.Remove("SpringMan"); } if (Configuration.infestationGunkfish.Value) { if (!compatibleEnemies.Contains("Stingray")) { compatibleEnemies.Add("Stingray"); } } else { compatibleEnemies.Remove("Stingray"); } } internal static void CustomInfestation(int forceIndex = -1) { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown SelectableLevel currentLevel = RoundManager.Instance.currentLevel; infestationEnemyIndex = RoundManager.Instance.enemyRushIndex; RoundManager.Instance.enemyRushIndex = -1; infestationEnemies.Clear(); vanillaLevels.TryGetValue(((Object)currentLevel).name, out var value); Random random = new Random(StartOfRound.Instance.randomMapSeed + 5781); if (forceIndex >= 0) { infestationEnemyIndex = forceIndex; } else if (compatibleEnemies.Except(new <>z__ReadOnlyArray(new string[2] { "HoardingBug", "Nutcracker" })).Any()) { FilterInfestations(); for (int i = 0; i < currentLevel.Enemies.Count; i++) { if (!compatibleEnemies.Contains(((Object)currentLevel.Enemies[i].enemyType).name) || currentLevel.Enemies[i].rarity == 0) { continue; } if (value != null) { if (value.TryGetValue(((Object)currentLevel.Enemies[i].enemyType).name, out var value2)) { infestationEnemies.Add(new IntWithRarity(i, value2, (LevelAmbienceLibrary)null)); } } else { infestationEnemies.Add(new IntWithRarity(i, currentLevel.Enemies[i].rarity, (LevelAmbienceLibrary)null)); } } Plugin.Logger.LogDebug((object)("Infestation weights for \"" + ((Object)currentLevel).name + "\":")); foreach (IntWithRarity infestationEnemy in infestationEnemies) { Plugin.Logger.LogDebug((object)$"{((Object)currentLevel.Enemies[infestationEnemy.id].enemyType).name} - {infestationEnemy.rarity}"); } infestationEnemyIndex = infestationEnemies[RoundManager.Instance.GetRandomWeightedIndex(infestationEnemies.Select((IntWithRarity x) => x.rarity).ToArray(), random)].id; } InfestationOverrides.infestationEnemy = currentLevel.Enemies[infestationEnemyIndex].enemyType; Plugin.Logger.LogDebug((object)("Starting " + ((Object)InfestationOverrides.infestationEnemy).name + " infestation")); rollbackPowerLevel = InfestationOverrides.infestationEnemy.PowerLevel; InfestationOverrides.infestationEnemy.PowerLevel = 0f; switch (((Object)InfestationOverrides.infestationEnemy).name) { case "HoardingBug": rollbackMaxCount = InfestationOverrides.infestationEnemy.MaxCount; InfestationOverrides.infestationEnemy.MaxCount = 8; break; case "Crawler": rollbackMaxCount = InfestationOverrides.infestationEnemy.MaxCount; InfestationOverrides.infestationEnemy.MaxCount = Mathf.Min(InfestationOverrides.infestationEnemy.MaxCount * 2, 8); break; case "Centipede": rollbackMaxCount = InfestationOverrides.infestationEnemy.MaxCount; InfestationOverrides.infestationEnemy.MaxCount = 20; break; } if (((Object)InfestationOverrides.infestationEnemy).name != "ClaySurgeon") { RoundManager.Instance.currentMaxInsidePower = RoundManager.Instance.currentLevel.maxEnemyPowerCount; RoundManager.Instance.increasedInsideEnemySpawnRateIndex = infestationEnemyIndex; } else { RoundManager.Instance.currentMaxInsidePower = 0f; } } internal static void EndInfestation() { hourOfLastInfestationWave = -1; if (infestationEnemyIndex >= 0) { RoundManager.Instance.increasedInsideEnemySpawnRateIndex = -1; if (rollbackPowerLevel > 0f) { infestationEnemy.PowerLevel = rollbackPowerLevel; rollbackPowerLevel = -1f; } if (rollbackMaxCount > 0) { infestationEnemy.MaxCount = rollbackMaxCount; rollbackMaxCount = -1; } infestationEnemyIndex = -1; infestationEnemy = null; } } internal static void SpawnInfestationWave() { if (infestationEnemyIndex < 0 || RoundManager.Instance.currentHour == hourOfLastInfestationWave) { return; } hourOfLastInfestationWave = RoundManager.Instance.currentHour; RoundManager.Instance.currentEnemySpawnIndex = 0; if (RoundManager.Instance.firstTimeSpawningEnemies) { foreach (SpawnableEnemyWithRarity enemy in RoundManager.Instance.currentLevel.Enemies) { if (!enemy.enemyType.isOutsideEnemy && !enemy.enemyType.isDaytimeEnemy) { enemy.enemyType.numberSpawned = 0; enemy.enemyType.hasSpawnedAtLeastOne = false; } } RoundManager.Instance.firstTimeSpawningEnemies = false; } List list = RoundManager.Instance.allEnemyVents.Where((EnemyVent enemyVent) => !enemyVent.occupied).ToList(); for (int i = 0; i < 2; i++) { if (infestationEnemy.numberSpawned >= infestationEnemy.MaxCount || list.Count < 1) { Plugin.Logger.LogDebug((object)"Can no longer spawn infestation enemies"); break; } int num = RoundManager.Instance.IndoorEnemySpawnPlacementRandom.Next((int)(TimeOfDay.Instance.lengthOfHours * (float)TimeOfDay.Instance.hour) + 10, (int)(TimeOfDay.Instance.lengthOfHours * (float)(RoundManager.Instance.currentHour + 1))); EnemyVent val = list[RoundManager.Instance.IndoorEnemySpawnPlacementRandom.Next(list.Count)]; val.enemyType = infestationEnemy; val.enemyTypeIndex = infestationEnemyIndex; val.occupied = true; val.spawnTime = num; if (TimeOfDay.Instance.hour - RoundManager.Instance.currentHour <= 0) { val.SyncVentSpawnTimeClientRpc(num, infestationEnemyIndex); } EnemyType obj = infestationEnemy; obj.numberSpawned++; if (!infestationEnemy.hasSpawnedAtLeastOne) { infestationEnemy.hasSpawnedAtLeastOne = true; RoundManager instance = RoundManager.Instance; instance.currentInsideEnemyDiversityLevel += infestationEnemy.DiversityPowerLevel; } Plugin.Logger.LogDebug((object)"Added infestation enemy to vent"); if (!(((Object)infestationEnemy).name == "ClaySurgeon")) { list.Remove(val); continue; } break; } } internal static string GetInfesterName() { if (infestationEnemyIndex < 0) { return string.Empty; } return ((Object)RoundManager.Instance.currentLevel.Enemies[infestationEnemyIndex].enemyType).name; } } internal class OverrideCoordinator { private const int VANILLA_CRUISER_PRICE = 370; private const int VANILLA_JETPACK_PRICE = 900; internal static void ApplyOnServer() { List list = new List(); SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { if (!BRBNetworker.Instance.MoonsKillSwitch.Value) { switch (((Object)val).name) { case "ExperimentationLevel": ExperimentationOverrides.Setup(val); break; case "AssuranceLevel": AssuranceOverrides.Setup(val); break; case "VowLevel": VowOverrides.Setup(val); break; case "OffenseLevel": OffenseOverrides.Setup(val); break; case "MarchLevel": MarchOverrides.Setup(val); break; case "AdamanceLevel": AdamanceOverrides.Setup(val); break; case "RendLevel": RendOverrides.Setup(val); break; case "DineLevel": DineOverrides.Setup(val); break; case "TitanLevel": TitanOverrides.Setup(val); break; case "ArtificeLevel": ArtificeOverrides.Setup(val); break; case "EmbrionLevel": EmbrionOverrides.Setup(val); break; } } IndoorMapHazard[] indoorMapHazards = val.indoorMapHazards; foreach (IndoorMapHazard val2 in indoorMapHazards) { if ((Object)(object)val2.hazardType != (Object)null && !list.Contains(val2.hazardType)) { list.Add(val2.hazardType); } } } foreach (KeyValuePair enemy in Common.enemies) { switch (enemy.Key) { case "Butler": if (Configuration.butlerManorChance.Value) { enemy.Value.increasedChanceInterior = 1; Plugin.Logger.LogDebug((object)"Butler: Increased chance in manors"); } break; case "CadaverGrowths": if (Configuration.cadaversPower.Value) { Plugin.Logger.LogDebug((object)$"Cadavers: Power level {enemy.Value.PowerLevel} -> 4"); enemy.Value.PowerLevel = 4f; } break; case "CaveDweller": if (Configuration.maneaterPower.Value) { Plugin.Logger.LogDebug((object)$"Maneater: Power level {enemy.Value.PowerLevel} -> 3"); enemy.Value.PowerLevel = 3f; } break; case "Puffer": if (Configuration.pufferPower.Value) { Plugin.Logger.LogDebug((object)$"Spore lizard: Power level {enemy.Value.PowerLevel} -> 0.5"); enemy.Value.PowerLevel = 0.5f; } break; case "RadMech": if (Configuration.robotFog.Value) { enemy.Value.canSeeThroughFog = true; Plugin.Logger.LogDebug((object)"Old Bird: See through fog"); } break; case "SpringMan": if (Configuration.coilheadCurves.Value) { enemy.Value.probabilityCurve = AnimationCurve.EaseInOut(0.1f, 0.5882353f, 0.3333333f, 1f); Plugin.Logger.LogDebug((object)"Coil-head: Time of day curve"); enemy.Value.numberSpawnedFalloff = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); enemy.Value.useNumberSpawnedFalloff = true; Plugin.Logger.LogDebug((object)"Coil-head: Spawn count curve"); } if (Configuration.coilheadPower.Value) { Plugin.Logger.LogDebug((object)$"Coil-head: Power level {enemy.Value.PowerLevel} -> 2"); enemy.Value.PowerLevel = 2f; } break; } } foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (((Object)items).name == "MetalSheet" && Configuration.metalSheetPrice.Value) { Plugin.Logger.LogDebug((object)$"{((Object)items).name}.minValue: {items.minValue} -> 35"); items.minValue = 35; Plugin.Logger.LogDebug((object)$"{((Object)items).name}.maxValue: {items.maxValue} -> 85"); items.maxValue = 85; } } } internal static void ApplyOnAllClients() { //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = new Dictionary(); if (BRBNetworker.Instance.ScrapAdjustWeights.Value) { Extensions.AddRange(dictionary, new Dictionary { { "BottleBin", 1.15f }, { "Brush", 1.07f }, { "Candy", 1f }, { "Clock", 1.2f }, { "Cog1", 1.23f }, { "EnginePart1", 1.18f }, { "FancyCup", 1.2f }, { "FancyLamp", 1.25f }, { "Flask", 1.1f }, { "GarbageLid", 1.1f }, { "Hairdryer", 1.1f }, { "MetalSheet", 1.2f }, { "Ring", 1.08f }, { "SoccerBall", 1.13f }, { "TeaKettle", 1.15f } }); } if (BRBNetworker.Instance.WeaponsAdjustWeights.Value) { Extensions.AddRange(dictionary, new Dictionary { { "Shovel", 1.15f }, { "StopSign", 1.08f }, { "YieldSign", 1.13f } }); } foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { switch (((Object)items).name) { case "Jetpack": if (BRBNetworker.Instance.JetpackReduceDiscount.Value && items.highestSalePercentage != 60) { Plugin.Logger.LogDebug((object)$"{((Object)items).name}.highestSalePercentage: {items.highestSalePercentage}% -> 60%"); items.highestSalePercentage = 60; } if (BRBNetworker.Instance.JetpackUtility.Value && !items.disallowUtilitySlot) { items.disallowUtilitySlot = true; Plugin.Logger.LogDebug((object)(((Object)items).name + ".item.disallowUtilitySlot: False -> True")); } if (BRBNetworker.Instance.JetpackPrice.Value != 0 && BRBNetworker.Instance.JetpackPrice.Value != 900) { Plugin.Logger.LogDebug((object)$"{((Object)items).name}.creditsWorth: ${items.creditsWorth} -> ${BRBNetworker.Instance.JetpackPrice.Value}"); items.creditsWorth = BRBNetworker.Instance.JetpackPrice.Value; } break; case "ProFlashlight": if (BRBNetworker.Instance.ProFlashlightPrice.Value && items.creditsWorth != 32) { Plugin.Logger.LogDebug((object)$"{((Object)items).name}.creditsWorth: ${items.creditsWorth} -> $32"); items.creditsWorth = 32; } break; case "RadarBooster": if (BRBNetworker.Instance.RadarBoosterPrice.Value && items.creditsWorth != 50) { Plugin.Logger.LogDebug((object)$"{((Object)items).name}.creditsWorth: ${items.creditsWorth} -> $50"); items.creditsWorth = 50; } break; case "StunGrenade": if (BRBNetworker.Instance.StunGrenadePrice.Value && items.creditsWorth != 40) { Plugin.Logger.LogDebug((object)$"{((Object)items).name}.creditsWorth: ${items.creditsWorth} -> $40"); items.creditsWorth = 40; } break; case "ZapGun": if (BRBNetworker.Instance.ZapGunPrice.Value && items.creditsWorth != 200) { Plugin.Logger.LogDebug((object)$"{((Object)items).name}.creditsWorth: ${items.creditsWorth} -> $200"); items.creditsWorth = 200; } break; } if (dictionary.TryGetValue(((Object)items).name, out var value) && items.weight != value) { Plugin.Logger.LogDebug((object)$"{((Object)items).name}.weight: ${items.weight} -> {value}"); items.weight = value; } } if (BRBNetworker.Instance.NerfNightVision.Value) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { HDAdditionalLightData component = ((Component)val.nightVision).GetComponent(); if ((Object)(object)component != (Object)null) { component.intensity = 2488f; component.range = 8.3f; } else { val.nightVision.intensity = 622f / MathF.PI; val.nightVision.range = 8.3f; } } } foreach (KeyValuePair enemy in Common.enemies) { switch (enemy.Key) { case "CadaverBloom": { if (!BRBNetworker.Instance.CadaverTarget.Value || !((Object)(object)enemy.Value.enemyPrefab != (Object)null) || enemy.Value.enemyPrefab.GetComponentInChildren() != null) { break; } CadaverBloomAI componentInChildren2 = enemy.Value.enemyPrefab.GetComponentInChildren(); if ((Object)(object)componentInChildren2 != (Object)null) { ((Component)componentInChildren2).gameObject.AddComponent().cadaverBloomAI = componentInChildren2; Plugin.Logger.LogDebug((object)"Cadaver Bloom: Add IVisibleThreat"); if (!Object.op_Implicit((Object)(object)((Component)componentInChildren2).GetComponent())) { BoxCollider obj = ((Component)componentInChildren2).gameObject.AddComponent(); ((Collider)obj).isTrigger = true; obj.center = new Vector3(0f, 0.4428673f, 0f); obj.size = new Vector3(0f, 0.4412155f, 0f); Plugin.Logger.LogDebug((object)"Cadaver Bloom: Add collider"); } } break; } case "CaveDweller": if (BRBNetworker.Instance.ManeaterTarget.Value && (Object)(object)enemy.Value.enemyPrefab != (Object)null && enemy.Value.enemyPrefab.GetComponentInChildren() == null) { CaveDwellerAI componentInChildren = enemy.Value.enemyPrefab.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { ((Component)componentInChildren).gameObject.AddComponent().caveDwellerAI = componentInChildren; Plugin.Logger.LogDebug((object)"Maneater: Add IVisibleThreat"); } } break; case "Crawler": if (BRBNetworker.Instance.StunLonger.Value) { Plugin.Logger.LogDebug((object)$"Thumper: Stun multiplier {enemy.Value.stunTimeMultiplier} -> 1"); enemy.Value.stunTimeMultiplier = 1f; } break; case "HoarderBug": if (BRBNetworker.Instance.StunLonger.Value) { Plugin.Logger.LogDebug((object)$"Hoarding bug: Stun multiplier {enemy.Value.stunTimeMultiplier} -> 0.5"); enemy.Value.stunTimeMultiplier = 0.5f; } break; } } if (!Common.INSTALLED_VERSION55_COMPANY_CRUISER) { if (BRBNetworker.Instance.CruiserPrice.Value != 0 && BRBNetworker.Instance.CruiserPrice.Value != 370 && Common.Terminal?.buyableVehicles != null) { BuyableVehicle val2 = ((IEnumerable)Common.Terminal.buyableVehicles).FirstOrDefault((Func)((BuyableVehicle buyableVehicle) => buyableVehicle.vehicleDisplayName == "Cruiser")); if (val2 != null) { int creditsWorth = val2.creditsWorth; val2.creditsWorth = BRBNetworker.Instance.CruiserPrice.Value; if (Common.Terminal.terminalNodes?.allKeywords != null) { TerminalKeyword val3 = ((IEnumerable)Common.Terminal.terminalNodes.allKeywords).FirstOrDefault((Func)((TerminalKeyword keyword) => keyword.word == "buy")); TerminalKeyword cruiserKeyword = ((IEnumerable)Common.Terminal.terminalNodes.allKeywords).FirstOrDefault((Func)((TerminalKeyword keyword) => keyword.word == "cruiser")); if (val3?.compatibleNouns != null && (Object)(object)cruiserKeyword != (Object)null) { TerminalNode val4 = ((IEnumerable)val3.compatibleNouns).FirstOrDefault((Func)((CompatibleNoun compatibleNoun) => (Object)(object)compatibleNoun.noun == (Object)(object)cruiserKeyword))?.result; if ((Object)(object)val4 != (Object)null) { val4.itemCost = BRBNetworker.Instance.CruiserPrice.Value; if (val4.terminalOptions != null) { TerminalKeyword confirmKeyword = ((IEnumerable)Common.Terminal.terminalNodes.allKeywords).FirstOrDefault((Func)((TerminalKeyword keyword) => keyword.word == "confirm")); if ((Object)(object)confirmKeyword != (Object)null) { TerminalNode val5 = ((IEnumerable)val4.terminalOptions).FirstOrDefault((Func)((CompatibleNoun compatibleNoun) => (Object)(object)compatibleNoun.noun == (Object)(object)confirmKeyword))?.result; if ((Object)(object)val5 != (Object)null) { val5.itemCost = BRBNetworker.Instance.CruiserPrice.Value; Plugin.Logger.LogDebug((object)$"Cruiser: Price ${creditsWorth} -> ${BRBNetworker.Instance.CruiserPrice.Value}"); } } } } } } } } if (BRBNetworker.Instance.CruiserRegen.Value) { Plugin.Logger.LogDebug((object)$"Cruiser: Regen ({VehicleControllerPatches.criticalDurability}, {VehicleControllerPatches.regenInterval}) => (7, 16)"); VehicleControllerPatches.criticalDurability = 7; VehicleControllerPatches.regenInterval = 16f; } if (BRBNetworker.Instance.CruiserCrashDamage.Value) { Plugin.Logger.LogDebug((object)$"Cruiser: Crash ({VehicleControllerPatches.scrapingStress}, {VehicleControllerPatches.adjustableCrashSpeed}) => (0.35, 27)"); VehicleControllerPatches.scrapingStress = 0.35f; VehicleControllerPatches.adjustableCrashSpeed = 27f; } } if (BRBNetworker.Instance.WeedKillerDamage.Value != 0) { Plugin.Logger.LogDebug((object)$"Weed killer: Damage {SprayPaintPatches.damageNumber} => {BRBNetworker.Instance.WeedKillerDamage.Value}"); SprayPaintPatches.damageNumber = BRBNetworker.Instance.WeedKillerDamage.Value; } } } internal static class SceneOverrides { private static GameObject fireExitPrefab; internal static EntranceTeleport entranceTeleport1; internal static EntranceTeleport entranceTeleport2; internal static EntranceTeleport entranceTeleport3; internal static void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) if ((int)mode != 1) { return; } string text = "/Environment/Lighting/BrightDay/Local Volumetric Fog"; entranceTeleport1 = null; entranceTeleport2 = null; entranceTeleport3 = null; Common.lastSceneLoaded = ((Scene)(ref scene)).name; switch (Common.lastSceneLoaded) { case "Level3Vow": if (!BRBNetworker.Instance.MoonsKillSwitch.Value && BRBNetworker.Instance.VowMisty.Value) { GameObject obj5 = GameObject.Find(text); LocalVolumetricFog val2 = ((obj5 != null) ? obj5.GetComponent() : null); if ((Object)(object)val2 != (Object)null) { val2.parameters.meanFreePath = 15.1f; } } break; case "Level4March": { if (BRBNetworker.Instance.MoonsKillSwitch.Value) { break; } string text2 = "/Environment/Teleports"; GameObject obj = GameObject.Find(text2); Transform val = ((obj != null) ? obj.transform : null); if ((Object)(object)val != (Object)null) { Transform obj2 = val.Find("EntranceTeleportB"); entranceTeleport1 = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); Transform obj3 = val.Find("EntranceTeleportC"); entranceTeleport2 = ((obj3 != null) ? ((Component)obj3).GetComponent() : null); Transform obj4 = val.Find("EntranceTeleportD"); entranceTeleport3 = ((obj4 != null) ? ((Component)obj4).GetComponent() : null); if ((Object)(object)entranceTeleport1 != (Object)null && (Object)(object)entranceTeleport2 != (Object)null && (Object)(object)entranceTeleport3 != (Object)null) { Plugin.Logger.LogDebug((object)$"{((Scene)(ref scene)).name}{text2}/{((Object)entranceTeleport1).name}.entranceId: {entranceTeleport1.entranceId} -> 3"); entranceTeleport1.entranceId = 3; Plugin.Logger.LogDebug((object)$"{((Scene)(ref scene)).name}{text2}/{((Object)entranceTeleport2).name}.entranceId: {entranceTeleport2.entranceId} -> 1"); entranceTeleport2.entranceId = 1; Plugin.Logger.LogDebug((object)$"{((Scene)(ref scene)).name}{text2}/{((Object)entranceTeleport3).name}.entranceId: {entranceTeleport3.entranceId} -> 2"); entranceTeleport3.entranceId = 2; break; } } Plugin.Logger.LogError((object)"Failed to overwrite fire exit values on March"); break; } case "Level5Rend": if (!BRBNetworker.Instance.MoonsKillSwitch.Value) { GameObject val8 = GameObject.Find(text + " (2)"); if ((Object)(object)val8 != (Object)null) { val8.SetActive(false); } } break; case "Level6Dine": { if (BRBNetworker.Instance.MoonsKillSwitch.Value || !BRBNetworker.Instance.DineFireExits.Value) { break; } GameObject obj6 = GameObject.Find("/Environment/Map/CementFacility1/Cube.002"); Transform val3 = ((obj6 != null) ? obj6.transform : null); if ((Object)(object)val3 != (Object)null) { Transform obj7 = Object.Instantiate(val3, val3.parent); obj7.SetLocalPositionAndRotation(new Vector3(-15.040002f, 5.422f, 29.941002f), Quaternion.Euler(-90.156f, 86.789f, 112.546f)); obj7.localScale = new Vector3(0.68341416f, 0.8991684f, 0.6834146f); Transform obj8 = obj7.Find("Cube"); GameObject val4 = ((obj8 != null) ? ((Component)obj8).gameObject : null); if ((Object)(object)val4 != (Object)null) { val4.SetActive(false); } Object.Instantiate(obj7, obj7.parent).SetLocalPositionAndRotation(new Vector3(21.48f, 1.69f, 54.769997f), Quaternion.Euler(-89.907f, 0f, 173.213f)); GameObject obj9 = GameObject.Find("/Environment/FireExitDoorContainer"); Transform val5 = ((obj9 != null) ? obj9.transform : null); if ((Object)(object)val5 != (Object)null) { Object.Instantiate(val5, val5.parent).SetLocalPositionAndRotation(new Vector3(-13.7140465f, 0.036733627f, -67.93593f), Quaternion.Euler(-0.072f, 136.001f, 0.003f)); Object.Instantiate(val5, val5.parent).SetLocalPositionAndRotation(new Vector3(149.9961f, -17.140043f, 51.12207f), Quaternion.Euler(0f, 109.805f, 0f)); } } entranceTeleport3 = SpawnFireExit(3, new Vector3(49.488266f, 9.300285f, 62.257103f), Quaternion.Euler(-0.035f, 109.308f, -0.063f)); entranceTeleport2 = SpawnFireExit(2, new Vector3(-115.09624f, -7.864108f, -50.721016f), Quaternion.Euler(0f, 83.113f, 0f)); GameObject obj10 = GameObject.Find("/Environment/Teleports/EntranceTeleportB"); entranceTeleport1 = ((obj10 != null) ? obj10.GetComponent() : null); break; } case "Level7Offense": { if (BRBNetworker.Instance.MoonsKillSwitch.Value || !BRBNetworker.Instance.OffenseFireExits.Value) { break; } GameObject obj11 = GameObject.Find("/Environment/Map/CementFacility1/Cube.002"); Transform val6 = ((obj11 != null) ? obj11.transform : null); if ((Object)(object)val6 != (Object)null) { Object.Instantiate(val6, val6.parent).SetLocalPositionAndRotation(new Vector3(4.8600006f, 1.8200003f, -30.089989f), Quaternion.Euler(-89.901f, 0f, 175.644f)); GameObject obj12 = GameObject.Find("/Environment/FireExitDoorContainer"); Transform val7 = ((obj12 != null) ? obj12.transform : null); if ((Object)(object)val7 != (Object)null) { Object.Instantiate(val7, val7.parent).SetLocalPositionAndRotation(new Vector3(28.030003f, -2.2200003f, 47.79f), Quaternion.Euler(0f, 102.006f, 0f)); } } string text3 = "/Environment/Teleports/EntranceTeleportB"; GameObject obj13 = GameObject.Find(text3); entranceTeleport2 = ((obj13 != null) ? obj13.GetComponent() : null); if ((Object)(object)entranceTeleport2 != (Object)null) { Plugin.Logger.LogDebug((object)$"{((Scene)(ref scene)).name}{text3}.entranceId: {entranceTeleport2.entranceId} -> 2"); entranceTeleport2.entranceId = 2; entranceTeleport1 = SpawnFireExit(1, new Vector3(113.45921f, 6.9392705f, -171.7966f), Quaternion.Euler(0f, -79.002f, 0f)); } break; } case "Level10Adamance": if (!BRBNetworker.Instance.MoonsKillSwitch.Value) { if ((Object)(object)RoundManager.Instance.mapPropsContainer == (Object)null) { RoundManager.Instance.mapPropsContainer = GameObject.FindGameObjectWithTag("MapPropsContainer"); } Object.Instantiate(RoundManager.Instance.quicksandPrefab, new Vector3(-117.79688f, -23.5f, 51.95452f), Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); } break; } } private static EntranceTeleport SpawnFireExit(int id, Vector3 pos, Quaternion rot) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)RoundManager.Instance).IsServer) { return null; } if ((Object)(object)fireExitPrefab == (Object)null) { CacheFireExitPrefab(); } if ((Object)(object)fireExitPrefab == (Object)null) { Plugin.Logger.LogError((object)"Failed to discover fire exit prefab, this will cause problems in gameplay"); return null; } if ((Object)(object)RoundManager.Instance.mapPropsContainer == (Object)null) { RoundManager.Instance.mapPropsContainer = GameObject.FindGameObjectWithTag("MapPropsContainer"); } NetworkObject component = Object.Instantiate(fireExitPrefab, pos, rot, RoundManager.Instance.mapPropsContainer.transform).GetComponent(); component.Spawn(true); Common.tempNetObjs.Add(component); BRBNetworker.Instance.SyncFireExitRpc(NetworkObjectReference.op_Implicit(component), id); return ((Component)component).GetComponent(); } private static void CacheFireExitPrefab() { IndoorMapType val = ((IEnumerable)RoundManager.Instance.dungeonFlowTypes).FirstOrDefault((Func)delegate(IndoorMapType dungeonFlowType) { object obj; if (dungeonFlowType == null) { obj = null; } else { DungeonFlow dungeonFlow = dungeonFlowType.dungeonFlow; obj = ((dungeonFlow != null) ? ((Object)dungeonFlow).name : null); } return (string?)obj == "Level1Flow"; }); if (val == null) { return; } foreach (GraphNode node in val.dungeonFlow.Nodes) { foreach (TileSet tileSet in node.TileSets) { if (((Object)tileSet).name != "Level1RoomTiles") { continue; } GameObject val2 = ((IEnumerable)tileSet.TileWeights.Weights).FirstOrDefault((Func)delegate(GameObjectChance weight) { GameObject value = weight.Value; return ((value != null) ? ((Object)value).name : null) == "MediumRoomHallway1B"; })?.Value; if ((Object)(object)val2 == (Object)null) { return; } Doorway componentInChildren = val2.GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null)) { GameObject gameObject = ((IEnumerable)componentInChildren.BlockerPrefabWeights).FirstOrDefault((Func)delegate(GameObjectWeight blockerPrefabWeight) { GameObject gameObject2 = blockerPrefabWeight.GameObject; return ((gameObject2 != null) ? ((Object)gameObject2).name : null) == "NormalDoorBlockerWhiteCement"; }).GameObject; if (!((Object)(object)gameObject == (Object)null)) { fireExitPrefab = gameObject.GetComponentInChildren()?.spawnPrefab; } } return; } } } } } namespace ButteRyBalance.Overrides.Moons { internal class AdamanceOverrides { internal static readonly Dictionary adjustedInteriors = new Dictionary { { 1, 17 }, { 4, 135 } }; internal static readonly Dictionary infestations = new Dictionary { { "HoarderBug", 225 }, { "Nutcracker", 75 }, { "MaskedPlayerEnemy", 1 }, { "Butler", 10 }, { "ClaySurgeon", 50 }, { "Crawler", 300 }, { "Centipede", 64 }, { "SpringMan", 40 }, { "Stingray", 200 } }; internal static void Setup(SelectableLevel level) { if (Configuration.adamanceBuffScrap.Value) { MoonOverrides.adjustedScrap.Add("EasterEgg", 71); } if (Configuration.adamanceNerfEclipse.Value) { MoonOverrides.adjustedEclipse = 2; } if (Configuration.adamanceReduceCadavers.Value && level.specialEnemyRarity != null && (Object)(object)level.specialEnemyRarity.overrideEnemy != (Object)null && ((Object)level.specialEnemyRarity.overrideEnemy).name == "CadaverGrowths") { level.specialEnemyRarity.overrideEnemy = null; level.specialEnemyRarity.percentageChance = 0f; } if (Configuration.adamanceInteriors.Value) { MoonOverrides.adjustedEnemies.Add("Butler", 10); } if (Configuration.adamanceNoMasks.Value) { MoonOverrides.adjustedEnemies.Add("MaskedPlayerEnemy", 0); } MoonOverrides.Apply(level); } } internal class ArtificeOverrides { internal static readonly Dictionary adjustedInteriors = new Dictionary { { 0, 94 }, { 1, 300 } }; internal static readonly Dictionary infestations = new Dictionary { { "HoarderBug", 207 }, { "Nutcracker", 69 }, { "MaskedPlayerEnemy", 151 }, { "Butler", 100 }, { "ClaySurgeon", 64 }, { "Crawler", 48 }, { "Centipede", 50 }, { "SpringMan", 1 }, { "Stingray", 75 } }; internal static void Setup(SelectableLevel level) { if (Configuration.artificeBuffScrap.Value) { MoonOverrides.adjustedScrap.Add("GoldBar", 36); } if (Configuration.artificeTurrets.Value) { IndoorMapHazard val = ((IEnumerable)level.indoorMapHazards).FirstOrDefault((Func)delegate(IndoorMapHazard indoorMapHazard) { IndoorMapHazardType hazardType = indoorMapHazard.hazardType; object obj; if (hazardType == null) { obj = null; } else { GameObject prefabToSpawn2 = hazardType.prefabToSpawn; obj = ((prefabToSpawn2 != null) ? ((Object)prefabToSpawn2).name : null); } return (string?)obj == "TurretContainer"; }); if (val != null) { AnimationCurve val2 = ((IEnumerable)((IEnumerable)StartOfRound.Instance.levels).FirstOrDefault((Func)((SelectableLevel x) => ((Object)x).name == "LiquidationLevel"))?.spawnableMapObjects).FirstOrDefault((Func)delegate(SpawnableMapObject spawnableMapObject) { GameObject prefabToSpawn = spawnableMapObject.prefabToSpawn; return ((prefabToSpawn != null) ? ((Object)prefabToSpawn).name : null) == "TurretContainer"; })?.numberToSpawn; if (val2 != null) { val.numberToSpawn = val2; Plugin.Logger.LogDebug((object)(((Object)level).name + ".indoorMapHazards." + ((Object)val.hazardType).name)); } } } MoonOverrides.Apply(level); } } internal class AssuranceOverrides { internal static readonly Dictionary infestations = new Dictionary { { "HoarderBug", 300 }, { "Nutcracker", 100 }, { "MaskedPlayerEnemy", 3 }, { "ClaySurgeon", 1 }, { "Crawler", 75 }, { "Centipede", 300 }, { "Stingray", 40 } }; internal static void Setup(SelectableLevel level) { if (Configuration.assuranceNerfScrap.Value) { Extensions.AddRange(MoonOverrides.adjustedScrap, new Dictionary { { "Cog1", 94 }, { "EnginePart1", 80 }, { "BigBolt", 89 }, { "ToyCube", 11 }, { "BottleBin", 67 }, { "MetalSheet", 65 }, { "StopSign", 27 }, { "YieldSign", 28 }, { "DiyFlashbang", 13 }, { "ToiletPaperRolls", 18 }, { "Candy", 50 } }); } if (Configuration.assuranceMasked.Value) { MoonOverrides.adjustedEnemies.Add("MaskedPlayerEnemy", 2); } if (Configuration.assuranceGiants.Value) { MoonOverrides.adjustedEnemies.Add("ForestGiant", 9); } MoonOverrides.Apply(level); } } internal class DineOverrides { internal const float CONSOLIDATE_AMOUNT = 0.4f; internal const float CONSOLIDATE_VALUE = 1.75f; internal static readonly Dictionary adjustedInteriors = new Dictionary { { 4, 140 } }; internal static readonly Dictionary infestations = new Dictionary { { "HoarderBug", 3 }, { "Nutcracker", 1 }, { "MaskedPlayerEnemy", 40 }, { "Butler", 300 }, { "ClaySurgeon", 14 }, { "Crawler", 17 }, { "Centipede", 8 }, { "SpringMan", 4 }, { "Stingray", 94 } }; internal static void Setup(SelectableLevel level) { if (Configuration.dineScrapPool.Value != 0) { if (Configuration.dineScrapPool.Value == Configuration.DineScrap.Rollback) { MoonOverrides.minScrap = 22; MoonOverrides.maxScrap = 28; Extensions.AddRange(MoonOverrides.adjustedScrap, new Dictionary { { "Cog1", 15 }, { "EnginePart1", 14 }, { "BottleBin", 30 }, { "FancyLamp", 54 }, { "Ring", 26 }, { "RobotToy", 26 }, { "PerfumeBottle", 34 }, { "Hairdryer", 22 }, { "Airhorn", 16 }, { "ClownHorn", 17 }, { "CashRegister", 12 }, { "TragedyMask", 64 }, { "GiftBox", 69 }, { "PillBottle", 4 }, { "Toothpaste", 24 }, { "TeaKettle", 25 }, { "Candy", 15 }, { "Brush", 25 }, { "MagnifyingGlass", 37 }, { "Bell", 49 }, { "DustPan", 32 }, { "FishTestProp", 5 }, { "BigBolt", 4 }, { "ToyCube", 33 }, { "PickleJar", 30 }, { "FlashLaserPointer", 5 }, { "FancyCup", 36 }, { "FancyPainting", 44 }, { "Mug", 48 }, { "Phone", 8 }, { "SodaCanRed", 50 }, { "Dentures", 44 }, { "7Ball", 24 }, { "RubberDuck", 25 }, { "DiyFlashbang", 20 }, { "ComedyMask", 47 }, { "WhoopieCushion", 12 }, { "EasterEgg", 44 }, { "GarbageLid", 22 }, { "ToiletPaperRolls", 28 }, { "Zeddog", 1 }, { "SeveredHand", 0 }, { "SeveredBone", 0 }, { "SeveredBoneRib", 0 }, { "SeveredEar", 0 }, { "SeveredFoot", 0 }, { "SeveredThigh", 0 }, { "SeveredHeart", 0 }, { "SeveredTongue", 0 } }); } else { Extensions.AddRange(MoonOverrides.adjustedScrap, new Dictionary { { "SeveredHand", 100 }, { "SeveredBone", 79 }, { "SeveredBoneRib", 79 }, { "SeveredEar", 41 }, { "SeveredFoot", 100 }, { "SeveredThigh", 55 }, { "SeveredHeart", 6 }, { "SeveredTongue", 32 }, { "Cog1", 0 }, { "EnginePart1", 0 }, { "FishTestProp", 0 }, { "BigBolt", 0 }, { "FancyLamp", 0 }, { "ToyCube", 0 }, { "PickleJar", 0 }, { "FlashLaserPointer", 0 }, { "FancyCup", 0 }, { "FancyPainting", 0 }, { "Bell", 0 }, { "Ring", 0 }, { "RobotToy", 0 }, { "Toothpaste", 0 }, { "Brush", 0 }, { "PillBottle", 0 }, { "PerfumeBottle", 0 }, { "Mug", 0 }, { "BottleBin", 0 }, { "MagnifyingGlass", 0 }, { "Hairdryer", 0 }, { "Phone", 0 }, { "SodaCanRed", 0 }, { "Dentures", 0 }, { "7Ball", 0 }, { "RubberDuck", 0 }, { "TeaKettle", 0 }, { "Airhorn", 0 }, { "ClownHorn", 0 }, { "CashRegister", 0 }, { "Candy", 0 }, { "DiyFlashbang", 0 }, { "GiftBox", 0 }, { "TragedyMask", 0 }, { "ComedyMask", 0 }, { "WhoopieCushion", 1 }, { "EasterEgg", 1 }, { "GarbageLid", 0 }, { "ToiletPaperRolls", 0 }, { "Zeddog", 0 } }); } } if (Configuration.dineReduceButlers.Value) { MoonOverrides.adjustedEnemies.Add("Butler", 12); } if (Configuration.dineAdjustOutdoor.Value) { Extensions.AddRange(MoonOverrides.adjustedEnemies, new Dictionary { { "ForestGiant", 28 }, { "RadMech", 13 } }); MoonOverrides.outsidePowerCount = 10; } if (BRBNetworker.Instance.DineFireExits.Value) { MoonOverrides.powerCount = 15; } MoonOverrides.Apply(level); } } internal class EmbrionOverrides { internal static readonly Dictionary adjustedInteriors = new Dictionary { { 0, 13 }, { 1, 4 }, { 4, 118 } }; internal static readonly Dictionary infestations = new Dictionary { { "HoarderBug", 300 }, { "Nutcracker", 100 }, { "ClaySurgeon", 250 }, { "Crawler", 115 }, { "Centipede", 140 }, { "SpringMan", 150 } }; internal static void Setup(SelectableLevel level) { if (Configuration.embrionMega.Value) { MoonOverrides.minScrap = 28; MoonOverrides.maxScrap = 45; Extensions.AddRange(MoonOverrides.adjustedScrap, new Dictionary { { "YieldSign", 12 }, { "EasterEgg", 92 }, { "FlashLaserPointer", 10 }, { "RobotToy", 49 }, { "MagnifyingGlass", 37 }, { "Phone", 45 }, { "Airhorn", 39 }, { "DiyFlashbang", 13 } }); } if (Configuration.embrionAdjustEnemies.Value) { Extensions.AddRange(MoonOverrides.adjustedEnemies, new Dictionary { { "Nutcracker", 37 }, { "SpringMan", 42 }, { "ClaySurgeon", 61 }, { "HoarderBug", 57 } }); } if (Configuration.embrionWeeds.Value) { level.canSpawnMold = false; } MoonOverrides.Apply(level); } } internal class ExperimentationOverrides { internal static readonly Dictionary infestations = new Dictionary { { "HoarderBug", 300 }, { "Nutcracker", 100 }, { "Crawler", 14 }, { "Centipede", 300 }, { "Stingray", 50 } }; internal static void Setup(SelectableLevel level) { if (Configuration.experimentationBuffScrap.Value) { MoonOverrides.minScrap = 11; MoonOverrides.maxScrap = 16; MoonOverrides.adjustedScrap.Add("CashRegister", 6); } if (Configuration.experimentationNoEggs.Value) { MoonOverrides.adjustedScrap.Add("EasterEgg", 0); } if (Configuration.experimentationNoGiants.Value) { MoonOverrides.adjustedEnemies.Add("ForestGiant", 0); } MoonOverrides.Apply(level); } } internal class MarchOverrides { internal static readonly Dictionary infestations = new Dictionary { { "HoarderBug", 192 }, { "Nutcracker", 64 }, { "Crawler", 151 }, { "Centipede", 150 }, { "SpringMan", 28 }, { "Stingray", 300 } }; internal static void Setup(SelectableLevel level) { if (Configuration.marchBuffScrap.Value) { MoonOverrides.minScrap = 14; MoonOverrides.maxScrap = 18; Extensions.AddRange(MoonOverrides.adjustedScrap, new Dictionary { { "ToyCube", 24 }, { "MagnifyingGlass", 21 }, { "FishTestProp", 32 } }); MoonOverrides.adjustedEnemies.Add("RedLocustBees", 72); } if (Configuration.marchAdjustEnemies.Value) { Extensions.AddRange(MoonOverrides.adjustedEnemies, new Dictionary { { "ForestGiant", 81 }, { "MouthDog", 38 } }); } MoonOverrides.Apply(level); } } internal class MoonOverrides { internal static int minScrap = -1; internal static int maxScrap = -1; internal static int adjustedEclipse = -1; internal static int powerCount = -1; internal static int outsidePowerCount = -1; internal static Dictionary adjustedScrap = new Dictionary(); internal static Dictionary adjustedEnemies = new Dictionary(); private static SpawnableOutsideObject snowman; private static SpawnableOutsideObject snowmanTall; private static AnimationCurve snowmanCurve; private static AnimationCurve snowmanTallCurve; internal static void Apply(SelectableLevel level) { AdjustScrap(level); AdjustEnemies(level); if (adjustedEclipse >= 0) { RandomWeatherWithVariables val = ((IEnumerable)level.randomWeathers).FirstOrDefault((Func)((RandomWeatherWithVariables randomWeather) => (int)randomWeather.weatherType == 5)); if (val != null) { Plugin.Logger.LogDebug((object)$"{((Object)level).name}.randomWeathers.Eclipsed.weatherVariable: {val.weatherVariable} -> {adjustedEclipse}"); val.weatherVariable = adjustedEclipse; } adjustedEclipse = -1; } } private static void AdjustScrap(SelectableLevel level) { //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown if (minScrap >= 0) { Plugin.Logger.LogDebug((object)$"{((Object)level).name}.minScrap: {level.minScrap} => {minScrap}"); level.minScrap = minScrap; minScrap = -1; } if (maxScrap >= 0) { Plugin.Logger.LogDebug((object)$"{((Object)level).name}.maxScrap: {level.maxScrap} => {maxScrap}"); level.maxScrap = maxScrap; maxScrap = -1; } if (adjustedScrap.Count <= 0) { return; } foreach (SpawnableItemWithRarity item in level.spawnableScrap) { if (adjustedScrap.TryGetValue(((Object)item.spawnableItem).name, out var value)) { Plugin.Logger.LogDebug((object)$"{((Object)level).name}.spawnableScrap: {item.spawnableItem.itemName} - {item.rarity} => {value}"); item.rarity = value; adjustedScrap.Remove(((Object)item.spawnableItem).name); } } if (adjustedScrap.Count > 0) { foreach (KeyValuePair itemID in adjustedScrap) { if (itemID.Value > 0) { Item val = ((IEnumerable)StartOfRound.Instance.allItemsList.itemsList).FirstOrDefault((Func)((Item item) => ((Object)item).name == itemID.Key)); if ((Object)(object)val != (Object)null) { level.spawnableScrap.Add(new SpawnableItemWithRarity(val, itemID.Value)); } Plugin.Logger.LogDebug((object)$"{((Object)level).name}.spawnableScrap: +({val.itemName}, {itemID.Value})"); } } } adjustedScrap.Clear(); } private static void AdjustEnemies(SelectableLevel level) { //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown if (powerCount >= 0) { Plugin.Logger.LogDebug((object)$"{((Object)level).name}.maxEnemyPowerCount: {level.maxEnemyPowerCount} => {powerCount}"); level.maxEnemyPowerCount = powerCount; powerCount = -1; } if (outsidePowerCount >= 0) { Plugin.Logger.LogDebug((object)$"{((Object)level).name}.maxOutsideEnemyPowerCount: {level.maxOutsideEnemyPowerCount} => {outsidePowerCount}"); level.maxOutsideEnemyPowerCount = outsidePowerCount; outsidePowerCount = -1; } if (adjustedEnemies.Count <= 0) { return; } foreach (KeyValuePair adjustedEnemy in adjustedEnemies) { if (Common.enemies.TryGetValue(adjustedEnemy.Key, out var enemy)) { List list = null; list = (enemy.isDaytimeEnemy ? level.DaytimeEnemies : ((!enemy.isOutsideEnemy || !(((Object)enemy).name != "MaskedPlayerEnemy")) ? level.Enemies : level.OutsideEnemies)); SpawnableEnemyWithRarity val = ((IEnumerable)list).FirstOrDefault((Func)((SpawnableEnemyWithRarity spawnableEnemyWithRarity) => (Object)(object)spawnableEnemyWithRarity.enemyType == (Object)(object)enemy)); if (val != null) { Plugin.Logger.LogDebug((object)$"{((Object)level).name}: {val.enemyType.enemyName} - {val.rarity} => {adjustedEnemy.Value}"); val.rarity = adjustedEnemy.Value; } else if (enemy.isOutsideEnemy) { list.Add(new SpawnableEnemyWithRarity(enemy, adjustedEnemy.Value)); Plugin.Logger.LogDebug((object)$"{((Object)level).name}: +({enemy.enemyName}, {adjustedEnemy.Value})"); } } } adjustedEnemies.Clear(); } internal static void AdjustInteriors(SelectableLevel level, Dictionary adjustedInteriors) { IntWithRarity[] dungeonFlowTypes = level.dungeonFlowTypes; foreach (IntWithRarity val in dungeonFlowTypes) { if (adjustedInteriors.TryGetValue(val.id, out var value)) { Plugin.Logger.LogDebug((object)$"{((Object)level).name}.dungeonFlowTypes: {((Object)RoundManager.Instance.dungeonFlowTypes[val.id].dungeonFlow).name}, {val.rarity} -> {value}"); val.rarity = value; } } } internal static void RestoreSnowmen(SelectableLevel level, bool jolly) { //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Expected O, but got Unknown //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown //IL_033d: Expected O, but got Unknown //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown if ((Object)(object)snowman == (Object)null || (Object)(object)snowmanTall == (Object)null || snowmanCurve == null || snowmanTallCurve == null) { SelectableLevel val = Object.FindAnyObjectByType()?.testAllEnemiesLevel; if ((Object)(object)val != (Object)null) { if ((Object)(object)snowman == (Object)null || snowmanCurve == null) { SpawnableOutsideObjectWithRarity val2 = ((IEnumerable)val.spawnableOutsideObjects).FirstOrDefault((Func)((SpawnableOutsideObjectWithRarity spawnableOutsideObject) => ((Object)spawnableOutsideObject.spawnableObject).name == "SnowmanShort")); if (val2 != null) { snowman = val2.spawnableObject; snowmanCurve = val2.randomAmount; } } if ((Object)(object)snowmanTall == (Object)null || snowmanTallCurve == null) { SpawnableOutsideObjectWithRarity val3 = ((IEnumerable)val.spawnableOutsideObjects).FirstOrDefault((Func)((SpawnableOutsideObjectWithRarity spawnableOutsideObject) => ((Object)spawnableOutsideObject.spawnableObject).name == "SnowmanShort")); if (val3 != null) { snowmanTall = val3.spawnableObject; snowmanTallCurve = val3.randomAmount; } } } } if ((Object)(object)snowman != (Object)null && !level.spawnableOutsideObjects.Any((SpawnableOutsideObjectWithRarity spawnableOutsideObject) => (Object)(object)spawnableOutsideObject.spawnableObject == (Object)(object)snowman)) { object obj = level; SpawnableOutsideObjectWithRarity[] spawnableOutsideObjects = level.spawnableOutsideObjects; int num = 0; SpawnableOutsideObjectWithRarity[] array = (SpawnableOutsideObjectWithRarity[])(object)new SpawnableOutsideObjectWithRarity[1 + spawnableOutsideObjects.Length]; ReadOnlySpan readOnlySpan = new ReadOnlySpan(spawnableOutsideObjects); readOnlySpan.CopyTo(new Span(array).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; object obj2 = array; int num2 = num; obj2 = snowman; obj = ((jolly && snowmanCurve != null) ? ((object)snowmanCurve) : ((object)new AnimationCurve((Keyframe[])(object)new Keyframe[4] { new Keyframe(0f, 1f), new Keyframe(0.91526645f, 0.51239717f), new Keyframe(0.9849292f, 2.1915612f), new Keyframe(1f, 20.047966f) }))); ((object[])obj2)[num2] = (object)new SpawnableOutsideObjectWithRarity((SpawnableOutsideObject)obj2, (AnimationCurve)obj); ((SelectableLevel)obj).spawnableOutsideObjects = array; Plugin.Logger.LogDebug((object)(((Object)level).name + ".spawnableOutsideObjects: " + ((Object)snowman).name)); } if ((Object)(object)snowmanTall != (Object)null && !level.spawnableOutsideObjects.Any((SpawnableOutsideObjectWithRarity spawnableOutsideObject) => (Object)(object)spawnableOutsideObject.spawnableObject == (Object)(object)snowmanTall)) { object obj3 = level; SpawnableOutsideObjectWithRarity[] array = level.spawnableOutsideObjects; int num = 0; SpawnableOutsideObjectWithRarity[] spawnableOutsideObjects = (SpawnableOutsideObjectWithRarity[])(object)new SpawnableOutsideObjectWithRarity[1 + array.Length]; ReadOnlySpan readOnlySpan = new ReadOnlySpan(array); readOnlySpan.CopyTo(new Span(spawnableOutsideObjects).Slice(num, readOnlySpan.Length)); num += readOnlySpan.Length; object obj4 = spawnableOutsideObjects; int num3 = num; obj4 = snowmanTall; obj3 = ((jolly && snowmanTallCurve != null) ? ((object)snowmanTallCurve) : ((object)new AnimationCurve((Keyframe[])(object)new Keyframe[4] { new Keyframe(0f, 0f), new Keyframe(0.5777875f, 0.1802702f), new Keyframe(0.974945f, 0.6073564f), new Keyframe(1f, 3.4162483f) }))); ((object[])obj4)[num3] = (object)new SpawnableOutsideObjectWithRarity((SpawnableOutsideObject)obj4, (AnimationCurve)obj3); ((SelectableLevel)obj3).spawnableOutsideObjects = spawnableOutsideObjects; Plugin.Logger.LogDebug((object)(((Object)level).name + ".spawnableOutsideObjects: " + ((Object)snowmanTall).name)); } } } internal class OffenseOverrides { internal static readonly Dictionary infestations = new Dictionary { { "HoarderBug", 150 }, { "Nutcracker", 50 }, { "MaskedPlayerEnemy", 200 }, { "Crawler", 300 }, { "Centipede", 100 }, { "SpringMan", 300 }, { "Stingray", 44 } }; internal static void Setup(SelectableLevel level) { if (Configuration.offenseBuffScrap.Value) { Extensions.AddRange(MoonOverrides.adjustedScrap, new Dictionary { { "YieldSign", 12 }, { "Cog1", 30 }, { "EnginePart1", 40 }, { "MetalSheet", 23 }, { "BigBolt", 59 }, { "ToyCube", 31 }, { "StopSign", 40 }, { "GoldBar", 4 }, { "DiyFlashbang", 14 }, { "ToiletPaperRolls", 19 } }); } if (Configuration.offenseMasked.Value) { Extensions.AddRange(MoonOverrides.adjustedEnemies, new Dictionary { { "MaskedPlayerEnemy", 5 }, { "Flowerman", 0 }, { "SpringMan", 25 } }); } if (Configuration.offenseNerfEclipse.Value) { MoonOverrides.adjustedEclipse = 3; } if (Configuration.offenseBees.Value) { MoonOverrides.adjustedEnemies.Add("RedLocustBees", 31); level.daytimeEnemySpawnChanceThroughDay = AnimationCurve.EaseInOut(0f, -1.272499f, 1f, -14.8181f); } if (Configuration.offenseNerfTraps.Value) { IndoorMapHazard[] indoorMapHazards = level.indoorMapHazards; foreach (IndoorMapHazard val in indoorMapHazards) { SpawnableMapObject[] spawnableMapObjects = level.spawnableMapObjects; foreach (SpawnableMapObject val2 in spawnableMapObjects) { object obj; if (val == null) { obj = null; } else { IndoorMapHazardType hazardType = val.hazardType; if (hazardType == null) { obj = null; } else { GameObject prefabToSpawn = hazardType.prefabToSpawn; obj = ((prefabToSpawn != null) ? ((Object)prefabToSpawn).name : null); } } object obj2; if (val2 == null) { obj2 = null; } else { GameObject prefabToSpawn2 = val2.prefabToSpawn; obj2 = ((prefabToSpawn2 != null) ? ((Object)prefabToSpawn2).name : null); } if ((string?)obj == (string?)obj2) { val.numberToSpawn = val2.numberToSpawn; Plugin.Logger.LogDebug((object)(((Object)level).name + ".indoorMapHazards." + ((Object)val.hazardType).name)); } } } } if (Configuration.assuranceGiants.Value) { MoonOverrides.adjustedEnemies.Add("ForestGiant", 1); } MoonOverrides.Apply(level); } } internal class RendOverrides { internal static readonly Dictionary infestations = new Dictionary { { "Nutcracker", 300 }, { "MaskedPlayerEnemy", 200 }, { "Butler", 4 }, { "ClaySurgeon", 75 }, { "Centipede", 100 }, { "SpringMan", 150 }, { "Stingray", 11 } }; internal static void Setup(SelectableLevel level) { if (Configuration.rendWorms.Value) { MoonOverrides.adjustedEnemies.Add("SandWorm", 18); } MoonOverrides.adjustedScrap.Add("Zeddog", 8); MoonOverrides.Apply(level); } } internal class TitanOverrides { internal static readonly Dictionary infestations = new Dictionary { { "HoarderBug", 135 }, { "Nutcracker", 45 }, { "MaskedPlayerEnemy", 300 }, { "Crawler", 140 }, { "Centipede", 28 }, { "SpringMan", 100 }, { "Stingray", 150 } }; internal static void Setup(SelectableLevel level) { if (Configuration.titanAddGold.Value) { MoonOverrides.adjustedScrap.Add("GoldBar", 9); } if (Configuration.titanAdjustEnemies.Value) { Extensions.AddRange(MoonOverrides.adjustedEnemies, new Dictionary { { "DressGirl", 28 }, { "RadMech", 13 }, { "Blob", 41 }, { "HoarderBug", 55 } }); } if (Configuration.titanWeeds.Value) { level.canSpawnMold = false; } MoonOverrides.Apply(level); } } internal class VowOverrides { internal static readonly Dictionary adjustedInteriors = new Dictionary { { 0, 50 }, { 4, 300 } }; internal static readonly Dictionary infestations = new Dictionary { { "HoarderBug", 151 }, { "ClaySurgeon", 100 }, { "Crawler", 44 }, { "Centipede", 117 }, { "SpringMan", 13 }, { "Stingray", 250 } }; internal static void Setup(SelectableLevel level) { if (Configuration.vowMineshafts.Value && level.maxOutsideEnemyPowerCount == 6) { MoonOverrides.outsidePowerCount = 7; } if (Configuration.vowNoCoils.Value) { MoonOverrides.adjustedEnemies.Add("SpringMan", 0); } if (Configuration.vowNoTraps.Value) { level.indoorMapHazards = Array.Empty(); Plugin.Logger.LogDebug((object)(((Object)level).name + ".indoorMapHazards")); } MoonOverrides.adjustedScrap.Add("Zeddog", 5); MoonOverrides.Apply(level); } } } namespace ButteRyBalance.Network { internal class BRBNetworker : NetworkBehaviour { internal static GameObject prefab; internal static BRBNetworker Instance { get; private set; } internal NetworkVariable JesterWalkThrough { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable JesterLongCooldown { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ButlerStealthStab { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ButlerLongCooldown { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable KnifeShortCooldown { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ManeaterLimitGrowth { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ManeaterWideTurns { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable MoonsKillSwitch { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable FoggyLimit { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ExperimentationNoEvents { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable RandomIndoorFog { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable VowMineshafts { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable RendShrink { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable DineFloods { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable NutcrackerGunPrice { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable JetpackBattery { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable JetpackReduceDiscount { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ArtificeInteriors { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ZapGunPrice { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable RadarBoosterPrice { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable StunGrenadePrice { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ScrapAdjustWeights { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable EmbrionMega { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ZapGunBattery { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ApparatusPrice { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ButlerSquishy { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable GiantSquishy { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable FoxSlender { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable JetpackUtility { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable AdamanceInteriors { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable DineMineshafts { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ProFlashlightPrice { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable VowMisty { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable NerfNightVision { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable GunkfishSquishy { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable StunLonger { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ManeaterTarget { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable CadaverTarget { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable JetpackWarmUp { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable CruiserExhaust { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable CruiserRegen { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable CruiserTrees { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable CruiserEnemyDamage { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable CruiserCrashDamage { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable WeaponsAdjustWeights { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable OffenseFireExits { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable DineFireExits { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable ProportionalFireExits { get; private set; } = new NetworkVariable(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable RendSnowmen { get; private set; } = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable DineSnowmen { get; private set; } = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable TitanSnowmen { get; private set; } = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable CruiserPrice { get; private set; } = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable JetpackPrice { get; private set; } = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable JetpackControls { get; private set; } = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal NetworkVariable WeedKillerDamage { get; private set; } = new NetworkVariable(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); internal static void Init() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown if ((Object)(object)prefab != (Object)null) { Plugin.Logger.LogDebug((object)"Skipped network handler registration, because it has already been initialized"); return; } try { prefab = new GameObject("BRBNetworker") { hideFlags = (HideFlags)61 }; NetworkObject obj = prefab.AddComponent(); byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(typeof(BRBNetworker).Assembly.GetName().Name + ((Object)prefab).name)); obj.GlobalObjectIdHash = BitConverter.ToUInt32(value, 0); prefab.AddComponent(); NetworkManager.Singleton.AddNetworkPrefab(prefab); Plugin.Logger.LogDebug((object)"Successfully registered network handler. This is good news!"); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Encountered some fatal error while registering network handler. The mod will not function like this!\n{arg}"); } } internal static void Create() { try { if (NetworkManager.Singleton.IsServer && (Object)(object)prefab != (Object)null) { Object.Instantiate(prefab).GetComponent().Spawn(true); } } catch { Plugin.Logger.LogError((object)"Encountered some fatal error while spawning network handler. It is likely that registration failed earlier on start-up, please consult your logs."); } } private void Awake() { Instance = this; } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if ((Object)(object)Instance != (Object)(object)this) { NetworkObject val = default(NetworkObject); if (((Component)Instance).TryGetComponent(ref val) && !val.IsSpawned && (Object)(object)Instance != (Object)(object)prefab) { Object.Destroy((Object)(object)Instance); } Plugin.Logger.LogWarning((object)"There are 2 BRBNetworkers instantiated, and the wrong one was assigned as Instance. This shouldn't happen, but is recoverable"); Instance = this; } Plugin.Logger.LogDebug((object)"Successfully spawned network handler."); OverrideCoordinator.ApplyOnAllClients(); } private void Start() { if (!((Object)(object)this != (Object)(object)Instance) && ((NetworkBehaviour)this).IsSpawned && ((NetworkBehaviour)this).IsServer) { UpdateConfig(); } } private void UpdateConfig() { if (((NetworkBehaviour)this).IsServer) { JesterWalkThrough.Value = Configuration.jesterWalkThrough.Value; JesterLongCooldown.Value = Configuration.jesterLongCooldown.Value; ButlerStealthStab.Value = Configuration.butlerStealthStab.Value; ButlerLongCooldown.Value = Configuration.butlerLongCooldown.Value; KnifeShortCooldown.Value = Configuration.knifeShortCooldown.Value; ManeaterLimitGrowth.Value = Configuration.maneaterLimitGrowth.Value; ManeaterWideTurns.Value = Configuration.maneaterWideTurns.Value; MoonsKillSwitch.Value = Configuration.moonsKillSwitch.Value; FoggyLimit.Value = Configuration.foggyLimit.Value; ExperimentationNoEvents.Value = Configuration.experimentationNoEvents.Value; RandomIndoorFog.Value = Configuration.randomIndoorFog.Value; VowMineshafts.Value = Configuration.vowMineshafts.Value; RendShrink.Value = Configuration.rendShrink.Value; DineFloods.Value = Configuration.dineFloods.Value; NutcrackerGunPrice.Value = Configuration.nutcrackerGunPrice.Value; JetpackBattery.Value = Configuration.jetpackBattery.Value; JetpackReduceDiscount.Value = Configuration.jetpackReduceDiscount.Value; ArtificeInteriors.Value = Configuration.artificeInteriors.Value; ZapGunPrice.Value = Configuration.zapGunPrice.Value; RadarBoosterPrice.Value = Configuration.radarBoosterPrice.Value; StunGrenadePrice.Value = Configuration.stunGrenadePrice.Value; ScrapAdjustWeights.Value = Configuration.scrapAdjustWeights.Value; EmbrionMega.Value = Configuration.embrionMega.Value; ZapGunBattery.Value = Configuration.zapGunBattery.Value; ApparatusPrice.Value = Configuration.apparatusPrice.Value; ButlerSquishy.Value = Configuration.butlerSquishy.Value; RendSnowmen.Value = (int)Configuration.rendSnowmen.Value; DineSnowmen.Value = (int)Configuration.dineSnowmen.Value; TitanSnowmen.Value = (int)Configuration.titanSnowmen.Value; GiantSquishy.Value = Configuration.giantSquishy.Value; FoxSlender.Value = Configuration.foxSlender.Value; JetpackUtility.Value = Configuration.jetpackUtility.Value; AdamanceInteriors.Value = Configuration.adamanceInteriors.Value; DineMineshafts.Value = Configuration.dineMineshafts.Value; ProFlashlightPrice.Value = Configuration.proFlashlightPrice.Value; VowMisty.Value = Configuration.vowMisty.Value; NerfNightVision.Value = Configuration.nerfNightVision.Value; GunkfishSquishy.Value = Configuration.gunkfishSquishy.Value; StunLonger.Value = Configuration.stunLonger.Value; CruiserPrice.Value = Configuration.cruiserPrice.Value; JetpackPrice.Value = Configuration.jetpackPrice.Value; ManeaterTarget.Value = Configuration.maneaterTarget.Value; CadaverTarget.Value = Configuration.cadaverTarget.Value; JetpackControls.Value = (int)Configuration.jetpackControls.Value; JetpackWarmUp.Value = Configuration.jetpackWarmUp.Value; CruiserExhaust.Value = Configuration.cruiserExhaust.Value; CruiserRegen.Value = Configuration.cruiserRegen.Value; CruiserTrees.Value = Configuration.cruiserTrees.Value; CruiserEnemyDamage.Value = Configuration.cruiserEnemyDamage.Value; CruiserCrashDamage.Value = Configuration.cruiserCrashDamage.Value; WeaponsAdjustWeights.Value = Configuration.weaponsAdjustWeights.Value; OffenseFireExits.Value = Configuration.offenseFireExits.Value; DineFireExits.Value = Configuration.dineFireExits.Value; ProportionalFireExits.Value = Configuration.proportionalFireExits.Value && !Common.INSTALLED_FAIRER_FIRE_EXITS; WeedKillerDamage.Value = Configuration.weedKillerDamage.Value; OverrideCoordinator.ApplyOnServer(); OverrideCoordinator.ApplyOnAllClients(); } } [Rpc(/*Could not decode attribute arguments.*/)] internal void SyncScrapPriceRpc(NetworkObjectReference scrap, int value, bool node = true) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val2 = default(RpcParams); FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(4273441453u, val2, val, (SendTo)7, (RpcDelivery)0); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref scrap, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val3, value); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref node, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val3, 4273441453u, val2, val, (SendTo)7, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val4 = default(NetworkObject); GrabbableObject val5 = default(GrabbableObject); if (((NetworkObjectReference)(ref scrap)).TryGet(ref val4, (NetworkManager)null) && ((Component)val4).TryGetComponent(ref val5)) { if (node) { val5.SetScrapValue(value); } else { val5.scrapValue = value; } } else { Plugin.Logger.LogError((object)"Failed to sync scrap price"); } } [Rpc(/*Could not decode attribute arguments.*/)] internal void SetScanValueMultiplierRpc(float value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val2 = default(RpcParams); FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2623281175u, val2, val, (SendTo)7, (RpcDelivery)0); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val3, 2623281175u, val2, val, (SendTo)7, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; TerminalPatches.fakeValueMultiplier = value; } } } [Rpc(/*Could not decode attribute arguments.*/)] internal void SyncFireExitRpc(NetworkObjectReference tele, int entranceId, bool isEntranceToBuilding = true, int audioReverbPreset = 2, bool fresh = true) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val2 = default(RpcParams); FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(4184975973u, val2, val, (SendTo)7, (RpcDelivery)0); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref tele, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val3, entranceId); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref isEntranceToBuilding, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val3, audioReverbPreset); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref fresh, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val3, 4184975973u, val2, val, (SendTo)7, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val4 = default(NetworkObject); EntranceTeleport val5 = default(EntranceTeleport); if (((NetworkObjectReference)(ref tele)).TryGet(ref val4, (NetworkManager)null) && ((Component)val4).TryGetComponent(ref val5)) { if (fresh) { if (isEntranceToBuilding && !val5.isEntranceToBuilding) { Common.extraFireExits.Add(val5); } } else { if (entranceId == val5.entranceId && isEntranceToBuilding == val5.isEntranceToBuilding && audioReverbPreset == val5.audioReverbPreset) { Plugin.Logger.LogDebug((object)("Fire exit \"" + ((Object)val5).name + "\" is already synced")); } else if (entranceId != val5.entranceId) { Plugin.Logger.LogWarning((object)$"Fire exit #{entranceId} is currently ID {val5.entranceId} on this client!!"); } if (isEntranceToBuilding) { switch (entranceId) { case 1: if ((Object)(object)SceneOverrides.entranceTeleport1 == (Object)null) { SceneOverrides.entranceTeleport1 = val5; } break; case 2: if ((Object)(object)SceneOverrides.entranceTeleport2 == (Object)null) { SceneOverrides.entranceTeleport2 = val5; } break; case 3: if ((Object)(object)SceneOverrides.entranceTeleport3 == (Object)null) { SceneOverrides.entranceTeleport3 = val5; } break; } } } val5.isEntranceToBuilding = isEntranceToBuilding; val5.entranceId = entranceId; val5.audioReverbPreset = audioReverbPreset; if (isEntranceToBuilding) { Transform val6 = ((Component)val5).transform.Find("Plane"); if ((Object)(object)val6 != (Object)null) { ((Component)val6).gameObject.SetActive(false); } } Plugin.Logger.LogDebug((object)string.Format("Synced {0}fire exit \"{1}\" @ {2} (ID: {3}, Entrance: {4})", fresh ? "new " : string.Empty, ((Object)val5).name, val5.entrancePoint.position, val5.entranceId, val5.isEntranceToBuilding)); } else { Plugin.Logger.LogError((object)$"Failed to sync entrance teleport #{entranceId}"); } } protected override void __initializeVariables() { if (JesterWalkThrough == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)JesterWalkThrough).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)JesterWalkThrough, "JesterWalkThrough"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)JesterWalkThrough); if (JesterLongCooldown == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)JesterLongCooldown).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)JesterLongCooldown, "JesterLongCooldown"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)JesterLongCooldown); if (ButlerStealthStab == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ButlerStealthStab).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ButlerStealthStab, "ButlerStealthStab"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ButlerStealthStab); if (ButlerLongCooldown == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ButlerLongCooldown).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ButlerLongCooldown, "ButlerLongCooldown"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ButlerLongCooldown); if (KnifeShortCooldown == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)KnifeShortCooldown).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)KnifeShortCooldown, "KnifeShortCooldown"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)KnifeShortCooldown); if (ManeaterLimitGrowth == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ManeaterLimitGrowth).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ManeaterLimitGrowth, "ManeaterLimitGrowth"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ManeaterLimitGrowth); if (ManeaterWideTurns == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ManeaterWideTurns).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ManeaterWideTurns, "ManeaterWideTurns"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ManeaterWideTurns); if (MoonsKillSwitch == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)MoonsKillSwitch).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)MoonsKillSwitch, "MoonsKillSwitch"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)MoonsKillSwitch); if (FoggyLimit == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)FoggyLimit).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)FoggyLimit, "FoggyLimit"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)FoggyLimit); if (ExperimentationNoEvents == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ExperimentationNoEvents).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ExperimentationNoEvents, "ExperimentationNoEvents"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ExperimentationNoEvents); if (RandomIndoorFog == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)RandomIndoorFog).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)RandomIndoorFog, "RandomIndoorFog"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)RandomIndoorFog); if (VowMineshafts == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VowMineshafts).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VowMineshafts, "VowMineshafts"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VowMineshafts); if (RendShrink == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)RendShrink).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)RendShrink, "RendShrink"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)RendShrink); if (DineFloods == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)DineFloods).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)DineFloods, "DineFloods"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)DineFloods); if (NutcrackerGunPrice == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)NutcrackerGunPrice).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)NutcrackerGunPrice, "NutcrackerGunPrice"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)NutcrackerGunPrice); if (JetpackBattery == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)JetpackBattery).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)JetpackBattery, "JetpackBattery"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)JetpackBattery); if (JetpackReduceDiscount == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)JetpackReduceDiscount).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)JetpackReduceDiscount, "JetpackReduceDiscount"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)JetpackReduceDiscount); if (ArtificeInteriors == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ArtificeInteriors).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ArtificeInteriors, "ArtificeInteriors"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ArtificeInteriors); if (ZapGunPrice == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ZapGunPrice).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ZapGunPrice, "ZapGunPrice"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ZapGunPrice); if (RadarBoosterPrice == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)RadarBoosterPrice).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)RadarBoosterPrice, "RadarBoosterPrice"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)RadarBoosterPrice); if (StunGrenadePrice == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)StunGrenadePrice).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)StunGrenadePrice, "StunGrenadePrice"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)StunGrenadePrice); if (ScrapAdjustWeights == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ScrapAdjustWeights).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ScrapAdjustWeights, "ScrapAdjustWeights"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ScrapAdjustWeights); if (EmbrionMega == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)EmbrionMega).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)EmbrionMega, "EmbrionMega"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)EmbrionMega); if (ZapGunBattery == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ZapGunBattery).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ZapGunBattery, "ZapGunBattery"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ZapGunBattery); if (ApparatusPrice == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ApparatusPrice).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ApparatusPrice, "ApparatusPrice"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ApparatusPrice); if (ButlerSquishy == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ButlerSquishy).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ButlerSquishy, "ButlerSquishy"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ButlerSquishy); if (GiantSquishy == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)GiantSquishy).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)GiantSquishy, "GiantSquishy"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)GiantSquishy); if (FoxSlender == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)FoxSlender).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)FoxSlender, "FoxSlender"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)FoxSlender); if (JetpackUtility == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)JetpackUtility).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)JetpackUtility, "JetpackUtility"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)JetpackUtility); if (AdamanceInteriors == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)AdamanceInteriors).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)AdamanceInteriors, "AdamanceInteriors"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)AdamanceInteriors); if (DineMineshafts == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)DineMineshafts).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)DineMineshafts, "DineMineshafts"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)DineMineshafts); if (ProFlashlightPrice == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ProFlashlightPrice).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ProFlashlightPrice, "ProFlashlightPrice"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ProFlashlightPrice); if (VowMisty == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VowMisty).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VowMisty, "VowMisty"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VowMisty); if (NerfNightVision == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)NerfNightVision).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)NerfNightVision, "NerfNightVision"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)NerfNightVision); if (GunkfishSquishy == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)GunkfishSquishy).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)GunkfishSquishy, "GunkfishSquishy"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)GunkfishSquishy); if (StunLonger == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)StunLonger).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)StunLonger, "StunLonger"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)StunLonger); if (ManeaterTarget == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ManeaterTarget).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ManeaterTarget, "ManeaterTarget"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ManeaterTarget); if (CadaverTarget == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)CadaverTarget).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)CadaverTarget, "CadaverTarget"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)CadaverTarget); if (JetpackWarmUp == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)JetpackWarmUp).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)JetpackWarmUp, "JetpackWarmUp"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)JetpackWarmUp); if (CruiserExhaust == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)CruiserExhaust).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)CruiserExhaust, "CruiserExhaust"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)CruiserExhaust); if (CruiserRegen == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)CruiserRegen).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)CruiserRegen, "CruiserRegen"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)CruiserRegen); if (CruiserTrees == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)CruiserTrees).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)CruiserTrees, "CruiserTrees"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)CruiserTrees); if (CruiserEnemyDamage == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)CruiserEnemyDamage).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)CruiserEnemyDamage, "CruiserEnemyDamage"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)CruiserEnemyDamage); if (CruiserCrashDamage == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)CruiserCrashDamage).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)CruiserCrashDamage, "CruiserCrashDamage"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)CruiserCrashDamage); if (WeaponsAdjustWeights == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)WeaponsAdjustWeights).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)WeaponsAdjustWeights, "WeaponsAdjustWeights"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)WeaponsAdjustWeights); if (OffenseFireExits == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)OffenseFireExits).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)OffenseFireExits, "OffenseFireExits"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)OffenseFireExits); if (DineFireExits == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)DineFireExits).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)DineFireExits, "DineFireExits"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)DineFireExits); if (ProportionalFireExits == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)ProportionalFireExits).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)ProportionalFireExits, "ProportionalFireExits"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)ProportionalFireExits); if (RendSnowmen == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)RendSnowmen).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)RendSnowmen, "RendSnowmen"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)RendSnowmen); if (DineSnowmen == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)DineSnowmen).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)DineSnowmen, "DineSnowmen"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)DineSnowmen); if (TitanSnowmen == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)TitanSnowmen).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)TitanSnowmen, "TitanSnowmen"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)TitanSnowmen); if (CruiserPrice == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)CruiserPrice).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)CruiserPrice, "CruiserPrice"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)CruiserPrice); if (JetpackPrice == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)JetpackPrice).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)JetpackPrice, "JetpackPrice"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)JetpackPrice); if (JetpackControls == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)JetpackControls).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)JetpackControls, "JetpackControls"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)JetpackControls); if (WeedKillerDamage == null) { throw new Exception("BRBNetworker.k__BackingField cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)WeedKillerDamage).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)WeedKillerDamage, "WeedKillerDamage"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)WeedKillerDamage); ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4273441453u, new RpcReceiveHandler(__rpc_handler_4273441453), "SyncScrapPriceRpc"); ((NetworkBehaviour)this).__registerRpc(2623281175u, new RpcReceiveHandler(__rpc_handler_2623281175), "SetScanValueMultiplierRpc"); ((NetworkBehaviour)this).__registerRpc(4184975973u, new RpcReceiveHandler(__rpc_handler_4184975973), "SyncFireExitRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_4273441453(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference scrap = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref scrap, default(ForNetworkSerializable)); int value = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref value); bool node = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref node, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((BRBNetworker)(object)target).SyncScrapPriceRpc(scrap, value, node); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2623281175(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float scanValueMultiplierRpc = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref scanValueMultiplierRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((BRBNetworker)(object)target).SetScanValueMultiplierRpc(scanValueMultiplierRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4184975973(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference tele = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref tele, default(ForNetworkSerializable)); int entranceId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref entranceId); bool isEntranceToBuilding = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isEntranceToBuilding, default(ForPrimitives)); int audioReverbPreset = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref audioReverbPreset); bool fresh = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref fresh, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((BRBNetworker)(object)target).SyncFireExitRpc(tele, entranceId, isEntranceToBuilding, audioReverbPreset, fresh); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "BRBNetworker"; } } } namespace ButteRyBalance.Components { public class CadaverBloomThreat : MonoBehaviour, IVisibleThreat { internal CadaverBloomAI cadaverBloomAI; ThreatType IVisibleThreat.type => (ThreatType)6; private void Update() { if ((Object)(object)cadaverBloomAI == (Object)null) { cadaverBloomAI = ((Component)this).GetComponent(); } } int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition) { return 3; } int IVisibleThreat.GetInterestLevel() { return 0; } Transform IVisibleThreat.GetThreatLookTransform() { if ((Object)(object)cadaverBloomAI != (Object)null) { return ((EnemyAI)cadaverBloomAI).eye; } return ((Component)this).transform; } Transform IVisibleThreat.GetThreatTransform() { return ((Component)this).transform; } Vector3 IVisibleThreat.GetThreatVelocity() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cadaverBloomAI != (Object)null && ((NetworkBehaviour)cadaverBloomAI).IsOwner) { return ((EnemyAI)cadaverBloomAI).agent.velocity; } return Vector3.zero; } float IVisibleThreat.GetVisibility() { if ((Object)(object)cadaverBloomAI == (Object)null || ((EnemyAI)cadaverBloomAI).isEnemyDead) { return 0f; } return 1f; } int IVisibleThreat.SendSpecialBehaviour(int id) { return 0; } GrabbableObject IVisibleThreat.GetHeldObject() { return null; } bool IVisibleThreat.IsThreatDead() { if ((Object)(object)cadaverBloomAI != (Object)null) { return ((EnemyAI)cadaverBloomAI).isEnemyDead; } return false; } } public class ManeaterThreat : MonoBehaviour, IVisibleThreat { internal CaveDwellerAI caveDwellerAI; ThreatType IVisibleThreat.type => (ThreatType)3; private void Update() { if ((Object)(object)caveDwellerAI == (Object)null) { caveDwellerAI = ((Component)this).GetComponent(); } } int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition) { int num = 1; if ((Object)(object)caveDwellerAI != (Object)null) { if (((EnemyAI)caveDwellerAI).currentBehaviourStateIndex == 0) { return num; } num += 2; if (((EnemyAI)caveDwellerAI).enemyHP > 2) { num += 2; } if (((EnemyAI)caveDwellerAI).creatureAnimator.GetBool("Leaping")) { num += 3; } } return num; } int IVisibleThreat.GetInterestLevel() { return 0; } Transform IVisibleThreat.GetThreatLookTransform() { if ((Object)(object)caveDwellerAI != (Object)null) { return ((EnemyAI)caveDwellerAI).eye; } return ((Component)this).transform; } Transform IVisibleThreat.GetThreatTransform() { return ((Component)this).transform; } Vector3 IVisibleThreat.GetThreatVelocity() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)caveDwellerAI != (Object)null && ((NetworkBehaviour)caveDwellerAI).IsOwner) { return ((EnemyAI)caveDwellerAI).agent.velocity; } return Vector3.zero; } float IVisibleThreat.GetVisibility() { if ((Object)(object)caveDwellerAI == (Object)null || ((EnemyAI)caveDwellerAI).isEnemyDead) { return 0f; } if (((EnemyAI)caveDwellerAI).currentBehaviourStateIndex == 0) { return 0.5f; } if (((EnemyAI)caveDwellerAI).creatureAnimator.GetBool("Leaping")) { return 1f; } return 0.75f; } int IVisibleThreat.SendSpecialBehaviour(int id) { return 0; } GrabbableObject IVisibleThreat.GetHeldObject() { return null; } bool IVisibleThreat.IsThreatDead() { if ((Object)(object)caveDwellerAI != (Object)null) { return ((EnemyAI)caveDwellerAI).isEnemyDead; } return false; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } [CompilerGenerated] internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable(); } } } namespace ButteRyBalance.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }