Please disclose if any significant portion of your mod was created 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 BrutalCompanyMinusExtraRebornCurrentEventsCommand v1.0.1
Bknibb.BrutalCompanyMinusExtraRebornCurrentEventsCommand.dll
Decompiled 19 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using BrutalCompanyMinus.Minus; using HarmonyLib; using LobbyCompatibility.Attributes; using Microsoft.CodeAnalysis; using StaticNetcodeLib; using TerminalApi; using TerminalApi.Classes; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Bknibb.BrutalCompanyMinusExtraRebornCurrentEventsCommand")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("BrutalCompanyMinusExtraRebornCurrentEventsCommand")] [assembly: AssemblyTitle("Bknibb.BrutalCompanyMinusExtraRebornCurrentEventsCommand")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 BrutalCompanyMinusExtraRebornCurrentEventsCommand { [BepInPlugin("Bknibb.BrutalCompanyMinusExtraRebornCurrentEventsCommand", "BrutalCompanyMinusExtraRebornCurrentEventsCommand", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [LobbyCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [HarmonyPatch] public class BrutalCompanyMinusExtraRebornCurrentEventsCommand : BaseUnityPlugin { public static BrutalCompanyMinusExtraRebornCurrentEventsCommand Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Instance = this; EventDescriptions.ValidateEvents(); Patch(); CommandInfo val = new CommandInfo(); val.DisplayTextSupplier = EventsCommand; val.Description = "Displays details about current events."; TerminalApi.AddCommand("events", val, (string)null, true); Logger.LogInfo((object)"Bknibb.BrutalCompanyMinusExtraRebornCurrentEventsCommand v1.0.1 has loaded!"); } internal static void Patch() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("Bknibb.BrutalCompanyMinusExtraRebornCurrentEventsCommand"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } private static string EventsCommand() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); List<MEvent> list2 = Net.eventNames.Select((string name) => MEvent.GetEvent(name)).ToList(); if (list2.Count == 0) { return "No Events To Display"; } foreach (MEvent item in list2) { string text = "=============== " + item.Name() + " ===============\n\n"; if (EventDescriptions.descriptions.ContainsKey(item.Name())) { text = text + EventDescriptions.descriptions[item.Name()] + "\n\n"; } text += string.Format("[ColorHex] [Weight] [Type]\n", item.ColorHex, item.Weight, item.Type); int num = 11; int length = item.Weight.ToString().Length; num -= (int)Mathf.Ceil((float)length / 2f); string text2 = new string(' ', num); int num2 = 12 - (int)Mathf.Floor((float)length / 2f); int length2 = ((object)Unsafe.As<EventType, EventType>(ref item.Type)/*cast due to .constrained prefix*/).ToString().Length; num2 -= (int)Mathf.Ceil((float)length2 / 2f); string text3 = new string(' ', num2); text += $" {item.ColorHex}{text2}{item.Weight}{text3}{item.Type}\n"; text = text + "[Descriptions]:\n" + string.Join("\n", item.Descriptions) + "\n"; text = text + "[EventsToSpawnWith]:\n" + string.Join("\n", item.EventsToSpawnWith) + "\n"; list.Add(text); } return string.Join("\n", list); } [HarmonyPostfix] [HarmonyPatch(typeof(EventManager), "ChooseEvents")] private static void ChooseEvents(List<MEvent> ___currentEvents) { if (NetworkManager.Singleton.IsServer) { Net.SyncEvents(___currentEvents); } } [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "ShipLeave")] private static void OnGameEnd() { if (NetworkManager.Singleton.IsServer) { Net.SyncEvents(new List<MEvent>()); } } } public static class EventDescriptions { public static Dictionary<string, string> descriptions = new Dictionary<string, string> { { "BigBonus", "Large sum of credis" }, { "ScrapGalore", "Increased scrap value and amount" }, { "GoldenBars", "Only golden bars will spawn on the map" }, { "BigDelivery", "Spawns a shipment with a bunch of items" }, { "PlentyOutsideScrap", "Spawns scrap outside" }, { "BlackFriday", "Everything will go on sale" }, { "SafeOutside", "Will prevents enemies from spawning outside and certain events" }, { "VeryEarlyShip", "Ship is as early as it can be" }, { "Bounty", "Killing enemies will now reward credits" }, { "Bonus", "Sum of credits" }, { "SmallerMap", "Reduces factory size" }, { "MoreScrap", "Increased scrap amount" }, { "HigherScrapValue", "Increased scrap value" }, { "GoldenFacility", "Only spawns Goldencup, Ring, Goldbar, Fancylamp, Perfumebottle, Painting and Cashregister on the map" }, { "Dentures", "Only spawns teeth on the map" }, { "Pickles", "Only spawns pickles on the map" }, { "Honk", "Only spawns horns on the map" }, { "TransmuteScrapSmall", "Takes any one-handed scrap in map scrap pool and only spawns that" }, { "SmallDelivery", "Spawns a shipment with some items" }, { "ScarceOutsideScrap", "Spawns scrap outside" }, { "FragileEnemies", "Decreases enemy hp" }, { "FullAccess", "All Doors are unlocked and open and big doors are all unlocked, prevents facility ghost." }, { "EarlyShip", "Time will start earlier" }, { "MoreExits", "Spawns entrances and exits" }, { "NoBaboons", "Removes Baboon Hawk" }, { "NoBracken", "Removes Bracken" }, { "NoCoilhead", "Removes Coil Head" }, { "NoDogs", "Removes Eyeless Dog" }, { "NoGiants", "Removes Forest Keeper" }, { "NoHoardingBugs", "Removes Hoarding Bug" }, { "NoJester", "Removes Jester" }, { "NoGhosts", "Removes Ghost Girl and Facility Ghost" }, { "NoLizards", "Removes Spore Lizard" }, { "NoSpiders", "Removes Bunker Spider" }, { "NoThumpers", "Removes Thumper" }, { "NoSnareFleas", "Removes Snare Flea" }, { "NoWorm", "Removes Earth Leviathan" }, { "NoSlimes", "Removes Hygrodere" }, { "NoTurrets", "Removes Turret" }, { "NoLandmines", "Removes Landmine" }, { "NoButlers", "Removes butlers" }, { "NoSpikeTraps", "Removes spiketraps" }, { "Nothing", "Nothing" }, { "Locusts", "Spawns Roaming Locusts" }, { "Birds", "Spawns Manticoils" }, { "Trees", "Spawns Trees" }, { "LeaflessBrownTrees", "Spawns trees without leaves" }, { "LeaflessTrees", "Spawns spooky trees" }, { "Gloomy", "Makes the atmosphere foggy" }, { "HeavyRain", "Makes the atmosphere rainy, flooded and stormy. Triple rain." }, { "HoardingBugs", "Spawns Hoarding bugs outside and inside, comes with Scarce Outside Scrap" }, { "Bees", "Spawns Bees outside" }, { "Landmines", "Increased rates of landmines inside" }, { "Lizard", "Spawns Spore Lizard inside" }, { "Slimes", "Spawns Hygrodere outside and inside" }, { "Thumpers", "Spawns Thumpers inside" }, { "Turrets", "Increased rates of turrets inside" }, { "Spiders", "Spawns Bunker Spiders outside and inside, comes with Leafless Brown Trees" }, { "SnareFleas", "Spawns Snare Fleas inside" }, { "FacilityGhost", "The ghost can open/close bigdoors and doors, mess with lights, mess with the breaker and can lock/unlock doors(Rare)" }, { "OutsideTurrets", "Spawns turrets outside, comes with Trees" }, { "OutsideLandmines", "Spawns Landmines outside" }, { "Dustpans", "Makes the game spawn lot of dustpans" }, { "GrabbableTurrets", "Turns some of the turrets on the map into scrap" }, { "ShipmentFees", "Any shipment's on given moon will deduct credits as a fee" }, { "StrongEnemies", "Increases enemy hp" }, { "KamikazieBugs", "Hoarding bugs will now blow up when angered" }, { "Masked", "Spawned masked enemies" }, { "Butlers", "Will Spawn butlers" }, { "SpikeTraps", "Will spawn spike traps inside" }, { "FlowerSnake", "Will spawn flower snakes inside and outside" }, { "LateShip", "Time will start a little later" }, { "HolidaySeason", "Turns scrap into mystery boxes and eggs and spawns nutcrackers and hoarding bugs inside" }, { "WelcomeToTheFactory", "Makes the game spawn metallic objects only" }, { "ShipLightsFailure", "Breaks the light switch and kills the ship lights" }, { "Nutcracker", "Spawns Nutcrackers outside and inside, comes with Turrets" }, { "Arachnophobia", "Spawns alot of Bunker Spiders outside and inside, comes with Leafless Trees" }, { "Bracken", "Spawns Brackens Inside" }, { "Coilhead", "Spawns Coilheads Inside" }, { "BaboonHorde", "Spawns alot of Baboon Hawks outside" }, { "Dogs", "Spawns Eyeless Dogs outside and inside" }, { "Jester", "Spawns Jesters inside" }, { "LittleGirl", "Spawns Ghost Girls inside" }, { "AntiCoilhead", "Changes Coilhead AI and spawns them inside, comes with Leafless Trees and Gloomy" }, { "BadProduce", "Decreased Scrap Value but Increased Scrap Amount" }, { "TransmuteScrapBig", "Takes any two-handed scrap in map scrap pool and only spawns that" }, { "Warzone", "Acts as Quad event including Turrets, Landmines, Outside Turrets and Outside Landmines and will also come with artillery fire!!" }, { "BugHorde", "Spawns a load of Hoarding Bugs outside and inside, comes with Scarce Outside Scrap" }, { "ForestGiant", "Spawns a Forest Keeper inside" }, { "InsideBees", "Spawns Bees outside and inside" }, { "NutSlayer", "Spawns the Nutslayer inside the facility, kills everything... comes with gloomy, thumpers, spiders and masked." }, { "Hell", "Great reward, but at what cost..." }, { "AllWeather", "Acts as Eclipsed, Stormy, Flooded and Raining all in one day" }, { "Worms", "Will spawn worms inside and outside and snare fleas inside and outside" }, { "OldBirds", "Will spawn old birds and comes with Landmines and Outside Landmines" }, { "VeryLateShip", "The ship arrives at a very late hour!" }, { "GiantsOutside", "Spawns a whole bunch of Giants Outside. Alternative to GiantShowdown" } }; private static readonly FieldInfo EventManagervanillaEvents = AccessTools.Field(typeof(EventManager), "vanillaEvents"); private static readonly FieldInfo EventManagermoddedEvents = AccessTools.Field(typeof(EventManager), "moddedEvents"); public static void ValidateEvents() { List<MEvent> source = ((List<MEvent>)EventManagervanillaEvents.GetValue(null)).Concat((List<MEvent>)EventManagermoddedEvents.GetValue(null)).ToList(); List<string> list = source.Select((MEvent e) => e.Name()).ToList(); foreach (string key in descriptions.Keys) { if (!list.Contains(key)) { BrutalCompanyMinusExtraRebornCurrentEventsCommand.Logger.LogWarning((object)("Descriptions Has Non-Existing Event \"" + key + "\"")); } } foreach (string item in list) { if (!Enumerable.Contains(descriptions.Keys, item)) { BrutalCompanyMinusExtraRebornCurrentEventsCommand.Logger.LogWarning((object)("Descriptions Missing Event \"" + item + "\"")); } } } } [StaticNetcode] public static class Net { public static List<string> eventNames = new List<string>(); [ClientRpc] public static void SyncEventsClientRpc(List<string> eventNames) { Net.eventNames = eventNames; } public static void SyncEvents(List<MEvent> events) { SyncEventsClientRpc(events.Select((MEvent e) => e.Name()).ToList()); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Bknibb.BrutalCompanyMinusExtraRebornCurrentEventsCommand"; public const string PLUGIN_NAME = "BrutalCompanyMinusExtraRebornCurrentEventsCommand"; public const string PLUGIN_VERSION = "1.0.1"; } }