Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BetterRCompany v1.2.2
BetterRCompany.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Threading; using BepInEx; using BepInEx.Logging; using BetterRCompany.Patches; using HarmonyLib; using LethalLib; using RealCompany.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("BetterRCompany")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterRCompany")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a5af0ca3-92a7-42ed-be96-79c90bed5da0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace RealCompany.Patches { internal class EnemyPatches : Plugin { public static List<int> rn = new List<int>(); private static int randomNumberGen() { int item = new Random().Next(1, 11); rn.Add(item); return rn[rn.Count - 1]; } [HarmonyPatch(typeof(ForestGiantAI), "Update")] [HarmonyPostfix] private static void ForestGiantPatch(ForestGiantAI __instance) { ((EnemyAI)__instance).agent.speed = 3f; } [HarmonyPatch(typeof(Landmine), "PressMineServerRpc")] [HarmonyPostfix] private static void LandmineTPatch(Landmine __instance) { if (randomNumberGen() < 2) { __instance.ToggleMine(false); } else { __instance.ToggleMine(true); } } } internal class PlayerPatches : Plugin { } } namespace BetterRCompany { [BepInPlugin("BetterRCompany.Teku", "BetterRCompany", "1.2.2")] public class MainPlugin : BaseUnityPlugin { private const string modGUID = "BetterRCompany.Teku"; private const string modName = "BetterRCompany"; private const string modVersion = "1.2.2"; private readonly Harmony harmony = new Harmony("BetterRCompany.Teku"); private static MainPlugin Instance; public static ManualLogSource mls; public static Dictionary<string, Dictionary<(float, float), string>> MapEvents = new Dictionary<string, Dictionary<(float, float), string>> { { "41 Experimentation", new Dictionary<(float, float), string> { { (0f, 0.15f), "LandmineEvent" }, { (0.15f, 0.23f), "BrackenEvent" }, { (0.23f, 0.38f), "TimeTravelEvent" }, { (0.38f, 0.48f), "CockroachPartyEvent" }, { (0.48f, 0.56f), "ClownFiestaEvent" }, { (0.56f, 0.6f), "FakeFreeRoamEvent" }, { (0.6f, 0.64f), "RealFreeRoamEvent" }, { (0.64f, 0.79f), "ArachnophobiaEvent" }, { (0.79f, 0.83f), "BankRollEvent" }, { (0.83f, 1f), "TaxEvent" } } }, { "220 Assurance", new Dictionary<(float, float), string> { { (0f, 0.15f), "LandmineEvent" }, { (0.15f, 0.23f), "BrackenEvent" }, { (0.23f, 0.38f), "TimeTravelEvent" }, { (0.38f, 0.48f), "CockroachPartyEvent" }, { (0.48f, 0.56f), "ClownFiestaEvent" }, { (0.56f, 0.6f), "FakeFreeRoamEvent" }, { (0.6f, 0.64f), "RealFreeRoamEvent" }, { (0.64f, 0.79f), "ArachnophobiaEvent" }, { (0.79f, 0.83f), "BankRollEvent" }, { (0.83f, 1f), "TaxEvent" } } }, { "56 Vow", new Dictionary<(float, float), string> { { (0f, 0.15f), "LandmineEvent" }, { (0.15f, 0.23f), "BrackenEvent" }, { (0.23f, 0.38f), "TimeTravelEvent" }, { (0.38f, 0.48f), "CockroachPartyEvent" }, { (0.48f, 0.56f), "ClownFiestaEvent" }, { (0.56f, 0.6f), "FakeFreeRoamEvent" }, { (0.6f, 0.64f), "RealFreeRoamEvent" }, { (0.64f, 0.79f), "ArachnophobiaEvent" }, { (0.79f, 0.83f), "BankRollEvent" }, { (0.83f, 1f), "TaxEvent" } } }, { "21 Offense", new Dictionary<(float, float), string> { { (0f, 0.15f), "LandmineEvent" }, { (0.15f, 0.23f), "BrackenEvent" }, { (0.23f, 0.38f), "TimeTravelEvent" }, { (0.38f, 0.48f), "CockroachPartyEvent" }, { (0.48f, 0.56f), "ClownFiestaEvent" }, { (0.56f, 0.6f), "FakeFreeRoamEvent" }, { (0.6f, 0.64f), "RealFreeRoamEvent" }, { (0.64f, 0.79f), "ArachnophobiaEvent" }, { (0.79f, 0.83f), "BankRollEvent" }, { (0.83f, 1f), "TaxEvent" } } }, { "61 March", new Dictionary<(float, float), string> { { (0f, 0.15f), "LandmineEvent" }, { (0.15f, 0.23f), "BrackenEvent" }, { (0.23f, 0.38f), "TimeTravelEvent" }, { (0.38f, 0.48f), "CockroachPartyEvent" }, { (0.48f, 0.56f), "ClownFiestaEvent" }, { (0.56f, 0.6f), "FakeFreeRoamEvent" }, { (0.6f, 0.64f), "RealFreeRoamEvent" }, { (0.64f, 0.79f), "ArachnophobiaEvent" }, { (0.79f, 0.83f), "BankRollEvent" }, { (0.83f, 1f), "TaxEvent" } } }, { "20 Adamance", new Dictionary<(float, float), string> { { (0f, 0.15f), "LandmineEvent" }, { (0.15f, 0.23f), "BrackenEvent" }, { (0.23f, 0.38f), "TimeTravelEvent" }, { (0.38f, 0.48f), "CockroachPartyEvent" }, { (0.48f, 0.56f), "ClownFiestaEvent" }, { (0.56f, 0.6f), "FakeFreeRoamEvent" }, { (0.6f, 0.64f), "RealFreeRoamEvent" }, { (0.64f, 0.79f), "ArachnophobiaEvent" }, { (0.79f, 0.83f), "BankRollEvent" }, { (0.83f, 1f), "TaxEvent" } } }, { "85 Rend", new Dictionary<(float, float), string> { { (0f, 0.07f), "LandmineEvent" }, { (0.07f, 0.12f), "BrackenEvent" }, { (0.12f, 0.19f), "TimeTravelEvent" }, { (0.19f, 0.25f), "CockroachPartyEvent" }, { (0.25f, 0.32f), "ClownFiestaEvent" }, { (0.32f, 0.34f), "FakeFreeRoamEvent" }, { (0.34f, 0.36f), "RealFreeRoamEvent" }, { (0.36f, 0.43f), "ArachnophobiaEvent" }, { (0.43f, 0.91f), "NutBlasterEvent" }, { (0.91f, 0.93f), "BankRollEvent" }, { (0.93f, 1f), "TaxEvent" } } }, { "7 Dine", new Dictionary<(float, float), string> { { (0f, 0.07f), "LandmineEvent" }, { (0.07f, 0.12f), "BrackenEvent" }, { (0.12f, 0.19f), "TimeTravelEvent" }, { (0.19f, 0.25f), "CockroachPartyEvent" }, { (0.25f, 0.32f), "ClownFiestaEvent" }, { (0.32f, 0.34f), "FakeFreeRoamEvent" }, { (0.34f, 0.36f), "RealFreeRoamEvent" }, { (0.36f, 0.43f), "ArachnophobiaEvent" }, { (0.43f, 0.91f), "NutBlasterEvent" }, { (0.91f, 0.93f), "BankRollEvent" }, { (0.93f, 1f), "TaxEvent" } } }, { "5 Embrion", new Dictionary<(float, float), string> { { (0f, 0.07f), "LandmineEvent" }, { (0.07f, 0.12f), "BrackenEvent" }, { (0.12f, 0.19f), "TimeTravelEvent" }, { (0.19f, 0.25f), "CockroachPartyEvent" }, { (0.25f, 0.32f), "ClownFiestaEvent" }, { (0.32f, 0.34f), "FakeFreeRoamEvent" }, { (0.34f, 0.36f), "RealFreeRoamEvent" }, { (0.36f, 0.43f), "ArachnophobiaEvent" }, { (0.43f, 0.91f), "NutBlasterEvent" }, { (0.91f, 0.93f), "BankRollEvent" }, { (0.93f, 1f), "TaxEvent" } } }, { "68 Artifice", new Dictionary<(float, float), string> { { (0f, 0.07f), "LandmineEvent" }, { (0.07f, 0.12f), "BrackenEvent" }, { (0.12f, 0.19f), "TimeTravelEvent" }, { (0.19f, 0.25f), "CockroachPartyEvent" }, { (0.25f, 0.32f), "ClownFiestaEvent" }, { (0.32f, 0.34f), "FakeFreeRoamEvent" }, { (0.34f, 0.36f), "RealFreeRoamEvent" }, { (0.36f, 0.43f), "ArachnophobiaEvent" }, { (0.43f, 0.91f), "NutBlasterEvent" }, { (0.91f, 0.93f), "BankRollEvent" }, { (0.93f, 1f), "TaxEvent" } } }, { "8 Titan", new Dictionary<(float, float), string> { { (0f, 0.15f), "LandmineEvent" }, { (0.15f, 0.23f), "BrackenEvent" }, { (0.23f, 0.38f), "TimeTravelEvent" }, { (0.38f, 0.48f), "CockroachPartyEvent" }, { (0.48f, 0.56f), "ClownFiestaEvent" }, { (0.56f, 0.6f), "FakeFreeRoamEvent" }, { (0.6f, 0.64f), "RealFreeRoamEvent" }, { (0.64f, 0.79f), "ArachnophobiaEvent" }, { (0.79f, 0.83f), "BankRollEvent" }, { (0.83f, 1f), "TaxEvent" } } } }; public static Item ShotgunAmmo; public static Item MyShotgun; public static bool EventActive = false; public static bool eventTpd = false; public static string currentPlanetName; public static string currentEventName; public static int BunkerSpiderIndex; public static int BrackenIndex; public static EnemyVent[] EnemyVents; public static Timer timer; public static int HoardingBugIndex; public static AnimationCurve DefaultLandmineSpawnRate = new AnimationCurve((Keyframe[])(object)new Keyframe[1] { new Keyframe(0f, 2.5f) }); public static bool ModifiedLootPool = false; public static List<SpawnableItemWithRarity> OriginalLootPool = new List<SpawnableItemWithRarity>(); public static double EventIDRolled; public static double currentChance = 0.7; public static List<string> ClownItems = new List<string> { "Clown horn", "Large axle", "Toy robot", "Airhorn", "Clownhorn", "Dentures", "Cash register" }; public static List<string> LandmineMessages = new List<string> { "Footstep Frenzy", "Watch Your Step", "Explosive trails", "Minefield Madness", "Boom Tango", "Explosive Ballet", "Toe Tapper Trap", "Stompocalypse", "Minesweeper's Nightmare", "Explosion Elegance", "Mambo No. Mines" }; public static List<string> BrackenMessages = new List<string> { "Phantom Prowlers", "Nightmare Stalkers", "White Eyes of Despair", "Full-Moon Eyes", "Wraith Gaze", "They Are Watching", "Terror Stare", "Terrorising Eyes" }; public static List<string> TimeTravelMessages = new List<string> { "Paradox Playtime", "Quantum Gambit", "Temporal Turbulence", "Temporal Dillema", "Time Roulette" }; public static List<string> CockroachPartyMessages = new List<string> { "Insect Insurgence", "Roach Rampage", "Bug Bash Bash", "Cockroach Party", "Pest Party Parade", "Critter Convention", "Roach Rave" }; public static List<string> ClownFiestaMessages = new List<string> { "Havoc Honk", "Circus Attendees", "Clown Fiesta", "The Jokes On You" }; public static List<string> ArachnophobiaMessages = new List<string> { "Big Ass Spiders" }; public static List<string> NutBlasterMessages = new List<string> { "Blast-Away", "Nutblaster" }; public static List<string> BankRollMessages = new List<string> { "Big money", "Bankroll" }; public static List<string> TaxMessages = new List<string> { "Get Taxed", "Poland income tax", "Romanian income tax" }; public static List<string> RandomTPMessages = new List<string> { "Get Inverse TP'd" }; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("BetterRCompany.Teku"); mls.LogInfo((object)"================================"); mls.LogInfo((object)"= MOD ONLINE STARTED ="); mls.LogInfo((object)"================================"); harmony.PatchAll(typeof(MainPlugin)); harmony.PatchAll(typeof(MoonEventsPatch)); harmony.PatchAll(typeof(GeneratingNumbers)); harmony.PatchAll(typeof(PlayerPatches)); harmony.PatchAll(typeof(EnemyPatches)); } } } namespace BetterRCompany.Patches { internal class GeneratingNumbers { public static Random GenRandomNumber = new Random(); public static double EventChanceRoll() { return GenRandomNumber.NextDouble(); } } internal class MoonEventsPatch : MainPlugin { private static void AnnounceEvent() { try { Terminal val = Object.FindObjectOfType<Terminal>(); string text = MainPlugin.currentEventName; if (text == null) { return; } switch (text.Length) { case 13: switch (text[0]) { case 'L': if (text == "LandmineEvent") { HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[The Company]:</color> " + MainPlugin.LandmineMessages[GeneratingNumbers.GenRandomNumber.Next(0, MainPlugin.LandmineMessages.Count())] + ".", -1); LandmineSpawnRate(RoundManager.Instance.currentLevel); } break; case 'B': if (text == "BankRollEvent") { HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[The Company]:</color> " + MainPlugin.BankRollMessages[GeneratingNumbers.GenRandomNumber.Next(0, MainPlugin.BankRollMessages.Count())], -1); if (MainPlugin.currentPlanetName == "85 Rend" || MainPlugin.currentPlanetName == "7 Dine" || MainPlugin.currentPlanetName == "8 Titan") { val.groupCredits += GeneratingNumbers.GenRandomNumber.Next(220, 341); } else { val.groupCredits += GeneratingNumbers.GenRandomNumber.Next(80, 221); } val.SyncGroupCreditsServerRpc(val.groupCredits, val.numberOfItemsInDropship); HUDManager.Instance.AddTextToChatOnServer($"Romanian government gave you a small bonus for your Romanian Vlone. Your new balance is: {val.groupCredits}", -1); } break; } break; case 15: switch (text[0]) { case 'T': if (text == "TimeTravelEvent") { HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[The Company]:</color> " + MainPlugin.TimeTravelMessages[GeneratingNumbers.GenRandomNumber.Next(0, MainPlugin.TimeTravelMessages.Count())] + ".", -1); MainPlugin.timer = new Timer(MoonTimeTimer, null, 0, 10000); } break; case 'N': if (text == "NutBlasterEvent") { HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[The Company]:</color> " + MainPlugin.NutBlasterMessages[GeneratingNumbers.GenRandomNumber.Next(0, MainPlugin.NutBlasterMessages.Count())], -1); ShotgunDeliver(); } break; } break; case 17: switch (text[0]) { case 'F': if (text == "FakeFreeRoamEvent") { HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[The Company]:</color> Enjoy your hard-earned free day.", -1); } break; case 'R': if (text == "RealFreeRoamEvent") { HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[The Company]:</color> Enjoy your hard-earned free day.", -1); } break; } break; case 12: if (text == "BrackenEvent") { HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[The Company]:</color> " + MainPlugin.BrackenMessages[GeneratingNumbers.GenRandomNumber.Next(0, MainPlugin.BrackenMessages.Count())] + ".", -1); } break; case 19: if (text == "CockroachPartyEvent") { HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[The Company]:</color> " + MainPlugin.CockroachPartyMessages[GeneratingNumbers.GenRandomNumber.Next(0, MainPlugin.CockroachPartyMessages.Count())] + ".", -1); } break; case 16: if (text == "ClownFiestaEvent") { HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[The Company]:</color> " + MainPlugin.ClownFiestaMessages[GeneratingNumbers.GenRandomNumber.Next(0, MainPlugin.ClownFiestaMessages.Count())] + ".", -1); } break; case 18: if (text == "ArachnophobiaEvent") { HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[The Company]:</color> " + MainPlugin.ArachnophobiaMessages[GeneratingNumbers.GenRandomNumber.Next(0, MainPlugin.ArachnophobiaMessages.Count())], -1); } break; case 8: if (text == "TaxEvent") { HUDManager.Instance.AddTextToChatOnServer("<color=yellow>[The Company]:</color> " + MainPlugin.TaxMessages[GeneratingNumbers.GenRandomNumber.Next(0, MainPlugin.TaxMessages.Count())], -1); val.groupCredits -= val.groupCredits * 20 / 100; val.SyncGroupCreditsServerRpc(val.groupCredits, val.numberOfItemsInDropship); HUDManager.Instance.AddTextToChatOnServer($"Tax paid to the Polish Government. Your new balance is: {val.groupCredits}", -1); } break; case 9: case 10: case 11: case 14: break; } } catch (Exception ex) { MainPlugin.mls.LogError((object)ex); } } public static Item GetItem(string myItem) { Item[] array = Resources.FindObjectsOfTypeAll<Item>(); foreach (Item val in array) { if (((Object)val).name == myItem) { return val; } } return null; } private static void ShotgunDeliver() { try { Terminal val = Object.FindObjectOfType<Terminal>(); List<Item> list = val.buyableItemsList.ToList(); MainPlugin.MyShotgun = Object.Instantiate<Item>(GetItem("Shotgun")); MainPlugin.ShotgunAmmo = Object.Instantiate<Item>(GetItem("GunAmmo")); list.Add(MainPlugin.MyShotgun); list.Add(MainPlugin.ShotgunAmmo); val.buyableItemsList = list.ToArray(); val.orderedItemsFromTerminal.Add(val.buyableItemsList.Count() - 1); val.orderedItemsFromTerminal.Add(val.buyableItemsList.Count() - 1); val.orderedItemsFromTerminal.Add(val.buyableItemsList.Count() - 1); val.orderedItemsFromTerminal.Add(val.buyableItemsList.Count() - 1); val.orderedItemsFromTerminal.Add(val.buyableItemsList.Count() - 1); val.orderedItemsFromTerminal.Add(val.buyableItemsList.Count() - 1); val.orderedItemsFromTerminal.Add(val.buyableItemsList.Count() - 2); val.orderedItemsFromTerminal.Add(val.buyableItemsList.Count() - 2); } catch (Exception ex) { MainPlugin.mls.LogError((object)ex); } } private static void MoonTimeTimer(object state) { try { if (MainPlugin.EventActive && MainPlugin.currentEventName == "TimeTravelEvent" && StartOfRound.Instance.shipHasLanded) { if (GeneratingNumbers.GenRandomNumber.Next(0, 2) == 0) { TimeOfDay.Instance.globalTimeSpeedMultiplier = 4.5f; } else { TimeOfDay.Instance.globalTimeSpeedMultiplier = -2.2f; } } } catch (Exception ex) { MainPlugin.mls.LogError((object)ex); } } private static void LandmineSpawnRate(SelectableLevel currentPlayingLevel) { //IL_0030: 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_0046: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown try { if (!MainPlugin.EventActive || !(MainPlugin.currentEventName == "LandmineEvent")) { return; } AnimationCurve numberToSpawn = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 150f), new Keyframe(1f, 50f) }); SpawnableMapObject[] spawnableMapObjects = currentPlayingLevel.spawnableMapObjects; foreach (SpawnableMapObject val in spawnableMapObjects) { Landmine componentInChildren = val.prefabToSpawn.GetComponentInChildren<Landmine>(); if ((Object)(object)componentInChildren != (Object)null && ((Object)componentInChildren).name == ((Object)val.prefabToSpawn).name) { val.numberToSpawn = numberToSpawn; } } } catch (Exception ex) { MainPlugin.mls.LogError((object)ex); } } [HarmonyPatch(typeof(ItemDropship), "ShipLeave")] [HarmonyPostfix] private static void ItemDropShipLeave() { try { if (MainPlugin.EventActive && MainPlugin.currentEventName == "NutBlasterEvent") { Terminal obj = Object.FindObjectOfType<Terminal>(); List<Item> list = obj.buyableItemsList.ToList(); list.Remove(MainPlugin.MyShotgun); list.Remove(MainPlugin.ShotgunAmmo); obj.buyableItemsList = list.ToArray(); } } catch (Exception ex) { MainPlugin.mls.LogError((object)ex); } } [HarmonyPatch(typeof(EnemyAI), "KillEnemyServerRpc")] [HarmonyPostfix] private static void EnemyBounty(EnemyAI __instance) { try { if (MainPlugin.EventActive && !__instance.enemyType.isOutsideEnemy) { Terminal val = Object.FindObjectOfType<Terminal>(); val.groupCredits += 30; val.SyncGroupCreditsServerRpc(val.groupCredits, val.numberOfItemsInDropship); } } catch (Exception ex) { MainPlugin.mls.LogError((object)ex); } } [HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")] [HarmonyPostfix] private static void ResetValues(StartOfRound __instance) { try { TimeOfDay.Instance.globalTimeSpeedMultiplier = 1f; SpawnableMapObject[] spawnableMapObjects = RoundManager.Instance.currentLevel.spawnableMapObjects; foreach (SpawnableMapObject val in spawnableMapObjects) { Landmine componentInChildren = val.prefabToSpawn.GetComponentInChildren<Landmine>(); if ((Object)(object)componentInChildren != (Object)null && ((Object)componentInChildren).name == ((Object)val.prefabToSpawn).name) { val.numberToSpawn = MainPlugin.DefaultLandmineSpawnRate; } } MainPlugin.EventActive = false; if (!MainPlugin.ModifiedLootPool) { return; } RoundManager.Instance.currentLevel.spawnableScrap.Clear(); foreach (SpawnableItemWithRarity item in MainPlugin.OriginalLootPool) { RoundManager.Instance.currentLevel.spawnableScrap.Add(item); } MainPlugin.ModifiedLootPool = false; } catch (Exception ex) { MainPlugin.mls.LogError((object)ex.Message); } } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] [HarmonyPrefix] private static void SpawnCustomScrapPool(RoundManager __instance) { try { if (!MainPlugin.ModifiedLootPool) { foreach (SpawnableItemWithRarity item in __instance.currentLevel.spawnableScrap) { MainPlugin.OriginalLootPool.Add(item); } } if (!MainPlugin.EventActive || !(MainPlugin.currentEventName == "ClownFiestaEvent")) { return; } __instance.currentLevel.spawnableScrap.RemoveAll((SpawnableItemWithRarity item) => !MainPlugin.ClownItems.Contains(item.spawnableItem.itemName)); MainPlugin.ModifiedLootPool = true; foreach (SpawnableItemWithRarity item2 in __instance.currentLevel.spawnableScrap.Where((SpawnableItemWithRarity item) => MainPlugin.ClownItems.Contains(item.spawnableItem.itemName))) { item2.rarity = 100; } } catch (Exception ex) { MainPlugin.mls.LogError((object)ex.Message); } } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] [HarmonyPostfix] private static void EventGen(RoundManager __instance) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown try { MainPlugin.currentPlanetName = __instance.currentLevel.PlanetName; if (MainPlugin.currentPlanetName == "71 Gordion") { return; } AnimationCurve enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[1] { new Keyframe(0f, 100f) }); __instance.currentLevel.enemySpawnChanceThroughoutDay = enemySpawnChanceThroughoutDay; MainPlugin.currentEventName = ""; if (!(GeneratingNumbers.EventChanceRoll() <= MainPlugin.currentChance)) { return; } MainPlugin.EventActive = true; MainPlugin.EventIDRolled = GeneratingNumbers.EventChanceRoll(); foreach (KeyValuePair<(float, float), string> item in MainPlugin.MapEvents[MainPlugin.currentPlanetName]) { if (MainPlugin.EventIDRolled >= (double)item.Key.Item1 && MainPlugin.EventIDRolled <= (double)item.Key.Item2) { MainPlugin.currentEventName = item.Value; } } if (MainPlugin.currentEventName == "BrackenEvent" || MainPlugin.currentEventName == "CockroachPartyEvent" || MainPlugin.currentEventName == "FakeFreeRoamEvent") { AnimationCurve enemySpawnChanceThroughoutDay2 = new AnimationCurve((Keyframe[])(object)new Keyframe[1] { new Keyframe(0f, 0f) }); __instance.currentLevel.enemySpawnChanceThroughoutDay = enemySpawnChanceThroughoutDay2; } else { AnimationCurve enemySpawnChanceThroughoutDay3 = new AnimationCurve((Keyframe[])(object)new Keyframe[1] { new Keyframe(0f, 100f) }); __instance.currentLevel.enemySpawnChanceThroughoutDay = enemySpawnChanceThroughoutDay3; } AnnounceEvent(); } catch (Exception ex) { MainPlugin.mls.LogError((object)ex.Message); } } [HarmonyPatch(typeof(RoundManager), "SpawnEnemyOnServer")] [HarmonyPrefix] private static void StopEnemySpawnOnEvent(RoundManager __instance) { try { if (MainPlugin.EventActive && !(MainPlugin.currentEventName == "BrackenEvent") && !(MainPlugin.currentEventName == "CockroachPartyEvent")) { _ = MainPlugin.currentEventName == "FakeFreeRoamEvent"; } } catch (Exception ex) { MainPlugin.mls.LogError((object)ex); } } [HarmonyPatch(typeof(RoundManager), "RefreshEnemyVents")] [HarmonyPostfix] private static void SpawnEventEnemies(RoundManager __instance) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) try { MainPlugin.EnemyVents = Object.FindObjectsOfType<EnemyVent>(); if (!MainPlugin.EventActive) { return; } for (int i = 0; i < __instance.currentLevel.Enemies.Count; i++) { if (__instance.currentLevel.Enemies[i].enemyType.enemyName == "Flowerman") { MainPlugin.BrackenIndex = i; } if (__instance.currentLevel.Enemies[i].enemyType.enemyName == "Hoarding bug") { MainPlugin.HoardingBugIndex = i; } if (__instance.currentLevel.Enemies[i].enemyType.enemyName == "Bunker Spider") { MainPlugin.BunkerSpiderIndex = i; } } EnemyVent[] enemyVents = MainPlugin.EnemyVents; foreach (EnemyVent val in enemyVents) { if (MainPlugin.currentEventName == "BrackenEvent") { __instance.SpawnEnemyGameObject(val.floorNode.position, val.floorNode.eulerAngles.y, MainPlugin.BrackenIndex, (EnemyType)null); } if (MainPlugin.currentEventName == "CockroachPartyEvent") { for (int k = 0; k < 2; k++) { __instance.SpawnEnemyGameObject(val.floorNode.position, val.floorNode.eulerAngles.y, MainPlugin.HoardingBugIndex, (EnemyType)null); } } if (MainPlugin.currentEventName == "ArachnophobiaEvent") { __instance.SpawnEnemyGameObject(val.floorNode.position, val.floorNode.eulerAngles.y, MainPlugin.BunkerSpiderIndex, (EnemyType)null); } if (MainPlugin.currentEventName == "FakeFreeRoamEvent") { __instance.SpawnEnemyGameObject(val.floorNode.position, val.floorNode.eulerAngles.y, MainPlugin.BrackenIndex, (EnemyType)null); break; } } } catch (Exception ex) { MainPlugin.mls.LogError((object)ex); } } } }