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 PapersTweaks v1.1.0
PapersTweaks.dll
Decompiled 2 months 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.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using PapersTweaks; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PapersTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Paperbark's opinionated tweaks for Lethal Company")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+6fe78a3b5c3570ec83e981e41c988098b7bb985a")] [assembly: AssemblyProduct("PapersTweaks")] [assembly: AssemblyTitle("PapersTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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; } } } internal class PluginUtils { public static EnemyType GetEnemyType(string name) { try { return Resources.FindObjectsOfTypeAll<EnemyType>().Single((EnemyType enemyType) => ((Object)enemyType).name == name); } catch { Plugin.logger.LogError((object)("Failed to find enemy type with name \"" + name + "\", please report this as a bug.")); } return null; } public static SelectableLevel GetSelectableLevel(string name) { try { return Resources.FindObjectsOfTypeAll<SelectableLevel>().Single((SelectableLevel level) => ((Object)level).name == name); } catch { Plugin.logger.LogError((object)("Failed to find SelectableLevel with name \"" + name + "\", please report this as a bug.")); } return null; } public static Item GetItem(string name) { try { return Resources.FindObjectsOfTypeAll<Item>().Single((Item item) => ((Object)item).name == name); } catch { Plugin.logger.LogError((object)("Failed to find item with name \"" + name + "\", please report this as a bug.")); } return null; } public static void AddScrapSpawn(List<SpawnableItemWithRarity> spawnableScrap, string name, int rarity) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown Item item = GetItem(name); if ((Object)(object)item != (Object)null && rarity > 0) { spawnableScrap.Add(new SpawnableItemWithRarity(GetItem(name), rarity)); } } } namespace PapersTweaks { [BepInPlugin("horse.paperbark.PapersTweaks", "PapersTweaks", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string modGUID = "horse.paperbark.PapersTweaks"; public const string modName = "PapersTweaks"; public const string modVersion = "1.1.0"; private static Harmony harmony = new Harmony("horse.paperbark.PapersTweaks"); internal static ManualLogSource logger = Logger.CreateLogSource("PapersTweaks"); internal static PluginConfig BoundConfig { get; private set; } = null; private void Awake() { BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config); ApplyPatches(); logger.LogInfo((object)"Paper's Tweaks 1.1.0 is loaded! /)"); } private static void ApplyPatches() { harmony.PatchAll(); } } internal class PluginConfig { public readonly ConfigEntry<bool> VainInfestationEnabled; public readonly ConfigEntry<int> VainInfestationChance; public readonly ConfigEntry<int> VainInfestationSizeMin; public readonly ConfigEntry<int> VainInfestationSizeMax; public readonly ConfigEntry<int> BushWolfHealth; public readonly ConfigEntry<int> ButlerHealth; public readonly ConfigEntry<int> ButlerMaxCount; public readonly ConfigEntry<bool> RemoveButlerBees; public readonly ConfigEntry<bool> ImprovedDineLoot; public readonly ConfigEntry<bool> ImprovedEmbrionLoot; public readonly ConfigEntry<int> ScrapGunAmmoRarity; public readonly ConfigEntry<int> ScrapShovelRarity; public readonly ConfigEntry<int> ScrapSprayPaintRarity; public readonly ConfigEntry<int> ScrapFlashlightRarity; public readonly ConfigEntry<int> ScrapProFlashlightRarity; public readonly ConfigEntry<int> ScrapTZPInhalantRarity; public readonly ConfigEntry<int> ScrapExtensionLadderRarity; public PluginConfig(ConfigFile config) { //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_0282: Expected O, but got Unknown //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Expected O, but got Unknown //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Expected O, but got Unknown //IL_02cd: Expected O, but got Unknown //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Expected O, but got Unknown //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: 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_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Expected O, but got Unknown //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Expected O, but got Unknown //IL_0318: Expected O, but got Unknown //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Expected O, but got Unknown //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Expected O, but got Unknown //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Expected O, but got Unknown //IL_0362: Expected O, but got Unknown //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Expected O, but got Unknown //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Expected O, but got Unknown //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Expected O, but got Unknown //IL_03ac: Expected O, but got Unknown //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Expected O, but got Unknown //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Expected O, but got Unknown //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Expected O, but got Unknown //IL_03f6: Expected O, but got Unknown //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Expected O, but got Unknown //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Expected O, but got Unknown //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Expected O, but got Unknown //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Expected O, but got Unknown //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Expected O, but got Unknown //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Expected O, but got Unknown //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Expected O, but got Unknown //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Expected O, but got Unknown //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Expected O, but got Unknown //IL_04f2: Expected O, but got Unknown //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Expected O, but got Unknown //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Expected O, but got Unknown //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Expected O, but got Unknown //IL_0540: Expected O, but got Unknown //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Expected O, but got Unknown //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Expected O, but got Unknown //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Expected O, but got Unknown //IL_058e: Expected O, but got Unknown //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Expected O, but got Unknown //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Expected O, but got Unknown //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Expected O, but got Unknown //IL_05dc: Expected O, but got Unknown //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Expected O, but got Unknown //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_05ed: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Expected O, but got Unknown //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Expected O, but got Unknown //IL_062a: Expected O, but got Unknown //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Expected O, but got Unknown //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0647: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Expected O, but got Unknown //IL_0667: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Expected O, but got Unknown //IL_0678: Expected O, but got Unknown //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Expected O, but got Unknown //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_06b4: Expected O, but got Unknown //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Expected O, but got Unknown //IL_06c6: Expected O, but got Unknown //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Expected O, but got Unknown config.SaveOnConfigSet = false; VainInfestationEnabled = config.Bind<bool>("Tweaks.VainInfestation", "Enabled", true, "Whether random Vain Shroud infestations should replace the vanilla spreading mechanics"); VainInfestationChance = config.Bind<int>("Tweaks.VainInfestation", "Chance", 5, "The chance a moon is infested each day (0 - 100)"); VainInfestationSizeMin = config.Bind<int>("Tweaks.VainInfestation", "MinSize", 5, "Minimum size of vain shroud patches"); VainInfestationSizeMax = config.Bind<int>("Tweaks.VainInfestation", "MaxSize", 15, "Maximum size of vain shroud patches"); BushWolfHealth = config.Bind<int>("Tweaks.BushWolf", "Health", 3, "The amount of health Kidnapper Foxes have. Set to 0 to disable this tweak."); ButlerHealth = config.Bind<int>("Tweaks.Butler", "Health", 4, "The amount of health Butlers have in multiplayer. Set to 0 to disable this tweak."); ButlerMaxCount = config.Bind<int>("Tweaks.Butler", "MaxCount", 2, "The maximum number of Butlers which can spawn. Set to 0 to disable this tweak."); RemoveButlerBees = config.Bind<bool>("Tweaks.Butler", "Remove Butler Bees", true, "Prevents Butler Bees from spawning when a butler Dies."); ImprovedDineLoot = config.Bind<bool>("Tweaks.Dine", "Improved Loot Pool", true, "Changes the scrap that spawns on Dine to be balanced similar to other moons, making it more feasible to visit."); ImprovedEmbrionLoot = config.Bind<bool>("Tweaks.Embrion", "Improved Loot Pool", true, "Changes the scrap that spawns on Embrion to be balanced similar to other moons, making it more feasible to visit."); ScrapGunAmmoRarity = config.Bind<int>("Tweaks.Tool Scraps", "Shotgun Shell Rarity", 4, "Weighted chance for a Shotgun Shell to spawn as scrap. Set to 0 to disable."); ScrapShovelRarity = config.Bind<int>("Tweaks.Tool Scraps", "Shovel Rarity", 3, "Weighted chance for a Shovel to spawn as scrap. Set to 0 to disable."); ScrapSprayPaintRarity = config.Bind<int>("Tweaks.Tool Scraps", "Spray Paint Rarity", 3, "Weighted chance for Spray Paint to spawn as scrap. Set to 0 to disable."); ScrapFlashlightRarity = config.Bind<int>("Tweaks.Tool Scraps", "Flashlight Rarity", 6, "Weighted chance for a Flashlight to spawn as scrap. Set to 0 to disable."); ScrapProFlashlightRarity = config.Bind<int>("Tweaks.Tool Scraps", "Pro Flashlight Rarity", 1, "Weighted chance for a Pro Flashlight to spawn as scrap. Set to 0 to disable."); ScrapTZPInhalantRarity = config.Bind<int>("Tweaks.Tool Scraps", "TZP Inhalant Rarity", 3, "Weighted chance for a TZP Inhalant to spawn as scrap. Set to 0 to disable."); ScrapExtensionLadderRarity = config.Bind<int>("Tweaks.Tool Scraps", "Extension Ladder Rarity", 1, "Weighted chance for an Extension Ladder to spawn as scrap. Set to 0 to disable."); ClearOrphanedEntries(config); config.Save(); config.SaveOnConfigSet = true; LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(VainInfestationEnabled, new BoolCheckBoxOptions { Section = "Vain Shroud Infestations", Name = "Enabled", Description = "When enabled, Vain Shrouds have a random chance of occuring each round instead of vanilla's spawning where they stay between days." })); ConfigEntry<int> vainInfestationChance = VainInfestationChance; IntSliderOptions val = new IntSliderOptions { Section = "Vain Shroud Infestations", Name = "Chance", Description = "The chance (as a percentage) for a moon to have Vain Shrouds. Enable infestations and set to 0 to completely disable Vain Shroud spawning." }; ((BaseRangeOptions<int>)val).Min = 0; ((BaseRangeOptions<int>)val).Max = 100; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(vainInfestationChance, val)); ConfigEntry<int> vainInfestationSizeMin = VainInfestationSizeMin; IntSliderOptions val2 = new IntSliderOptions { Section = "Vain Shroud Infestations", Name = "Min Size", Description = "The smallest amount of Vain Shrouds that can spawn, as the number of spawning iterations." }; ((BaseRangeOptions<int>)val2).Min = 0; ((BaseRangeOptions<int>)val2).Max = 20; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(vainInfestationSizeMin, val2)); ConfigEntry<int> vainInfestationSizeMax = VainInfestationSizeMax; IntSliderOptions val3 = new IntSliderOptions { Section = "Vain Shroud Infestations", Name = "Max Size", Description = "The largest amount of Vain Shrouds that can spawn, as the number of spawning iterations." }; ((BaseRangeOptions<int>)val3).Min = 0; ((BaseRangeOptions<int>)val3).Max = 20; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(vainInfestationSizeMax, val3)); ConfigEntry<int> bushWolfHealth = BushWolfHealth; IntSliderOptions val4 = new IntSliderOptions { Section = "Kidnapper Fox", Name = "Health", Description = "The amount of health Kidnapper Foxes should spawn with. Set to 0 to disable this tweak and use vanilla's default." }; ((BaseRangeOptions<int>)val4).Min = 0; ((BaseRangeOptions<int>)val4).Max = 7; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(bushWolfHealth, val4)); ConfigEntry<int> butlerHealth = ButlerHealth; IntSliderOptions val5 = new IntSliderOptions { Section = "Butler", Name = "Health", Description = "The amount of health Butlers should spawn with. Set to 0 to disable this tweak and use vanilla's default." }; ((BaseRangeOptions<int>)val5).Min = 0; ((BaseRangeOptions<int>)val5).Max = 8; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(butlerHealth, val5)); ConfigEntry<int> butlerMaxCount = ButlerMaxCount; IntSliderOptions val6 = new IntSliderOptions { Section = "Butler", Name = "Max Spawns", Description = "The maximum number of Butlers which can spawn. Set to 0 to disable this tweak and use vanilla's default." }; ((BaseRangeOptions<int>)val6).Min = 0; ((BaseRangeOptions<int>)val6).Max = 7; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(butlerMaxCount, val6)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(RemoveButlerBees, new BoolCheckBoxOptions { Section = "Butler", Name = "No Butler Bees", Description = "When enabled, Butlers will not spawn bees when they die." })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(ImprovedDineLoot, new BoolCheckBoxOptions { Section = "Dine", Name = "Improved Loot Pool", Description = "Changes the scrap that spawns on Dine to be balanced similar to other moons, making it more feasible to visit." })); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(ImprovedEmbrionLoot, new BoolCheckBoxOptions { Section = "Embrion", Name = "Improved Loot Pool", Description = "Changes the scrap that spawns on Embrion to be balanced similar to other moons, making it more feasible to visit." })); ConfigEntry<int> scrapGunAmmoRarity = ScrapGunAmmoRarity; IntInputFieldOptions val7 = new IntInputFieldOptions { Section = "Tool Scraps", Name = "Shotgun Shell Rarity", Description = "Weighted chance for a Shotgun Shell to spawn as scrap. Set to 0 to disable." }; ((BaseRangeOptions<int>)val7).Min = 0; ((BaseRangeOptions<int>)val7).Max = 10000; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(scrapGunAmmoRarity, val7)); ConfigEntry<int> scrapShovelRarity = ScrapShovelRarity; IntInputFieldOptions val8 = new IntInputFieldOptions { Section = "Tool Scraps", Name = "Shovel Rarity", Description = "Weighted chance for a Shovel to spawn as scrap. Set to 0 to disable." }; ((BaseRangeOptions<int>)val8).Min = 0; ((BaseRangeOptions<int>)val8).Max = 10000; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(scrapShovelRarity, val8)); ConfigEntry<int> scrapSprayPaintRarity = ScrapSprayPaintRarity; IntInputFieldOptions val9 = new IntInputFieldOptions { Section = "Tool Scraps", Name = "Spray Paint Rarity", Description = "Weighted chance for Spray Paint to spawn as scrap. Set to 0 to disable." }; ((BaseRangeOptions<int>)val9).Min = 0; ((BaseRangeOptions<int>)val9).Max = 10000; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(scrapSprayPaintRarity, val9)); ConfigEntry<int> scrapFlashlightRarity = ScrapFlashlightRarity; IntInputFieldOptions val10 = new IntInputFieldOptions { Section = "Tool Scraps", Name = "Flashlight Rarity", Description = "Weighted chance for a Flashlight to spawn as scrap. Set to 0 to disable." }; ((BaseRangeOptions<int>)val10).Min = 0; ((BaseRangeOptions<int>)val10).Max = 10000; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(scrapFlashlightRarity, val10)); ConfigEntry<int> scrapProFlashlightRarity = ScrapProFlashlightRarity; IntInputFieldOptions val11 = new IntInputFieldOptions { Section = "Tool Scraps", Name = "Pro Flashlight Rarity", Description = "Weighted chance for a Pro Flashlight to spawn as scrap. Set to 0 to disable." }; ((BaseRangeOptions<int>)val11).Min = 0; ((BaseRangeOptions<int>)val11).Max = 10000; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(scrapProFlashlightRarity, val11)); ConfigEntry<int> scrapTZPInhalantRarity = ScrapTZPInhalantRarity; IntInputFieldOptions val12 = new IntInputFieldOptions { Section = "Tool Scraps", Name = "TZP Inhalant Rarity", Description = "Weighted chance for TZP Inhalant to spawn as scrap. Set to 0 to disable." }; ((BaseRangeOptions<int>)val12).Min = 0; ((BaseRangeOptions<int>)val12).Max = 10000; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(scrapTZPInhalantRarity, val12)); ConfigEntry<int> scrapExtensionLadderRarity = ScrapExtensionLadderRarity; IntInputFieldOptions val13 = new IntInputFieldOptions { Section = "Tool Scraps", Name = "Extension Ladder Rarity", Description = "Weighted chance for an Extension Ladder to spawn as scrap. Set to 0 to disable." }; ((BaseRangeOptions<int>)val13).Min = 0; ((BaseRangeOptions<int>)val13).Max = 10000; LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(scrapExtensionLadderRarity, val13)); } private static void ClearOrphanedEntries(ConfigFile cfg) { PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg); dictionary.Clear(); } } public static class PluginInfo { public const string PLUGIN_GUID = "PapersTweaks"; public const string PLUGIN_NAME = "PapersTweaks"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace PapersTweaks.Patches { [HarmonyPatch(typeof(BushWolfEnemy))] internal class BushWolfEnemyPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(BushWolfEnemy __instance) { if (Plugin.BoundConfig.BushWolfHealth.Value > 0) { Plugin.logger.LogInfo((object)("Set Kidnapper Fox HP to " + Plugin.BoundConfig.BushWolfHealth.Value + ", was " + ((EnemyAI)__instance).enemyHP)); ((EnemyAI)__instance).enemyHP = Plugin.BoundConfig.BushWolfHealth.Value; } } } [HarmonyPatch(typeof(ButlerBeesEnemyAI))] internal class ButlerBeesEnemyAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ButlerBeesEnemyAI __instance) { if (((NetworkBehaviour)__instance).IsServer && Plugin.BoundConfig.RemoveButlerBees.Value) { if (((EnemyAI)__instance).thisNetworkObject.IsSpawned) { Plugin.logger.LogInfo((object)"ButlerBees forcefully despawned"); ((EnemyAI)__instance).thisNetworkObject.Despawn(true); } else { Plugin.logger.LogInfo((object)"ButlerBees not despawned, they haven't spawned yet"); } } } } [HarmonyPatch(typeof(ButlerEnemyAI))] internal class ButlerEnemyAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ButlerEnemyAI __instance) { Plugin.logger.LogInfo((object)"Butler start patch"); if (Plugin.BoundConfig.RemoveButlerBees.Value) { __instance.buzzingAmbience.playOnAwake = false; __instance.buzzingAmbience.mute = true; __instance.buzzingAmbience.Stop(); } if (Plugin.BoundConfig.ButlerHealth.Value > 0) { int enemyHP = Math.Min(Plugin.BoundConfig.ButlerHealth.Value, ((EnemyAI)__instance).enemyHP); Plugin.logger.LogInfo((object)("Set Butler HP to " + enemyHP + ", was " + ((EnemyAI)__instance).enemyHP)); ((EnemyAI)__instance).enemyHP = enemyHP; } } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartDineLootPatch() { if (!Plugin.BoundConfig.ImprovedDineLoot.Value) { return; } Plugin.logger.LogInfo((object)"Updating scrap spawns on Dine"); string[] scrapToRemove = new string[10] { "WhoopieCushion", "EasterEgg", "SeveredHand", "SeveredBone", "SeveredBoneRib", "SeveredEar", "SeveredFoot", "SeveredThigh", "SeveredHeart", "SeveredTongue" }; SelectableLevel selectableLevel = PluginUtils.GetSelectableLevel("DineLevel"); if (!((Object)(object)selectableLevel == (Object)null)) { selectableLevel.spawnableScrap.RemoveAll((SpawnableItemWithRarity scrap) => scrapToRemove.Contains(((Object)scrap.spawnableItem).name)); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "SeveredBone", 200); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "SeveredEar", 50); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "SeveredFoot", 70); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "SeveredHand", 70); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "SeveredHeart", 50); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "SeveredThigh", 50); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "SeveredTongue", 50); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "7Ball", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Airhorn", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Bell", 5); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "BottleBin", 50); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Brush", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Candy", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "ChemicalJug", 10); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Clock", 20); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "ClownHorn", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Dentures", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "DustPan", 20); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "EasterEgg", 5); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "EggBeater", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "FancyCup", 10); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "FancyLamp", 5); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "FancyPainting", 5); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "FishTestProp", 50); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "FlashLaserPointer", 15); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Flask", 5); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "GiftBox", 80); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "GoldBar", 1); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Hairdryer", 5); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "MagnifyingGlass", 20); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "MoldPan", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Mug", 20); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "PerfumeBottle", 25); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Phone", 15); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "PickleJar", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "PillBottle", 40); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "PlasticCup", 100); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Remote", 10); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Ring", 20); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "RobotToy", 10); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "RubberDuck", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "SoccerBall", 5); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "SodaCanRed", 100); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "ToiletPaperRolls", 10); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Toothpaste", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "ToyCube", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "ToyTrain", 10); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "WhoopieCushion", 30); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Zeddog", 1); selectableLevel.minScrap = 35; selectableLevel.maxScrap = 48; selectableLevel.minTotalScrapValue = 600; selectableLevel.maxTotalScrapValue = 700; } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartEmbrionLootPatch() { if (!Plugin.BoundConfig.ImprovedEmbrionLoot.Value) { return; } Plugin.logger.LogInfo((object)"Updating scrap spawns on Embrion"); string[] scrapToRemove = Array.Empty<string>(); SelectableLevel selectableLevel = PluginUtils.GetSelectableLevel("EmbrionLevel"); if (!((Object)(object)selectableLevel == (Object)null)) { selectableLevel.spawnableScrap.RemoveAll((SpawnableItemWithRarity scrap) => scrapToRemove.Contains(((Object)scrap.spawnableItem).name)); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "ChemicalJug", 20); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "GoldBar", 5); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "FancyCup", 10); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Ring", 10); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "WhoopieCushion", 10); PluginUtils.AddScrapSpawn(selectableLevel.spawnableScrap, "Zeddog", 1); selectableLevel.minScrap = 30; selectableLevel.maxScrap = 40; selectableLevel.minTotalScrapValue = 600; selectableLevel.maxTotalScrapValue = 800; } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartGlobalLootLootPatch() { Plugin.logger.LogInfo((object)"Adding global loot"); SelectableLevel[] array = Resources.FindObjectsOfTypeAll<SelectableLevel>(); foreach (SelectableLevel val in array) { if (Plugin.BoundConfig.ScrapGunAmmoRarity.Value > 0) { PluginUtils.AddScrapSpawn(val.spawnableScrap, "GunAmmo", Plugin.BoundConfig.ScrapGunAmmoRarity.Value); } if (Plugin.BoundConfig.ScrapShovelRarity.Value > 0) { PluginUtils.AddScrapSpawn(val.spawnableScrap, "Shovel", Plugin.BoundConfig.ScrapShovelRarity.Value); } if (Plugin.BoundConfig.ScrapSprayPaintRarity.Value > 0) { PluginUtils.AddScrapSpawn(val.spawnableScrap, "SprayPaint", Plugin.BoundConfig.ScrapSprayPaintRarity.Value); } if (Plugin.BoundConfig.ScrapFlashlightRarity.Value > 0) { PluginUtils.AddScrapSpawn(val.spawnableScrap, "Flashlight", Plugin.BoundConfig.ScrapFlashlightRarity.Value); } if (Plugin.BoundConfig.ScrapProFlashlightRarity.Value > 0) { PluginUtils.AddScrapSpawn(val.spawnableScrap, "ProFlashlight", Plugin.BoundConfig.ScrapProFlashlightRarity.Value); } if (Plugin.BoundConfig.ScrapTZPInhalantRarity.Value > 0) { PluginUtils.AddScrapSpawn(val.spawnableScrap, "TZPInhalant", Plugin.BoundConfig.ScrapTZPInhalantRarity.Value); } if (Plugin.BoundConfig.ScrapExtensionLadderRarity.Value > 0) { PluginUtils.AddScrapSpawn(val.spawnableScrap, "ExtensionLadder", Plugin.BoundConfig.ScrapExtensionLadderRarity.Value); } } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartButlerSpawningPatch() { if (Plugin.BoundConfig.ButlerMaxCount.Value > 0) { EnemyType enemyType = PluginUtils.GetEnemyType("Butler"); if (!((Object)(object)enemyType == (Object)null)) { Plugin.logger.LogInfo((object)("Set Butler max count to " + Plugin.BoundConfig.ButlerMaxCount.Value)); enemyType.MaxCount = Plugin.BoundConfig.ButlerMaxCount.Value; } } } [HarmonyPatch("SetPlanetsMold")] [HarmonyPostfix] private static void SetPlanetsMoldPatch(StartOfRound __instance, ref SelectableLevel[] ___levels, ref int ___randomMapSeed) { if (Plugin.BoundConfig.VainInfestationEnabled.Value && ((NetworkBehaviour)__instance).IsServer) { RandomiseInfestationMoldSpread(___levels, ___randomMapSeed); } } [HarmonyPatch("LoadPlanetsMoldSpreadData")] [HarmonyPostfix] private static void LoadPlanetsMoldSpreadDataPatch(StartOfRound __instance, ref SelectableLevel[] ___levels, ref int ___randomMapSeed) { if (Plugin.BoundConfig.VainInfestationEnabled.Value && ((NetworkBehaviour)__instance).IsServer) { RandomiseInfestationMoldSpread(___levels, ___randomMapSeed); } } private static void RandomiseInfestationMoldSpread(SelectableLevel[] levels, int randomMapSeed) { Plugin.logger.LogInfo((object)"Randomising vain shroud infestations for all levels"); Random random = new Random(randomMapSeed + 32); foreach (SelectableLevel val in levels) { val.moldStartPosition = -1; if (val.canSpawnMold && random.Next(0, 100) < Plugin.BoundConfig.VainInfestationChance.Value) { val.moldSpreadIterations = random.Next(Plugin.BoundConfig.VainInfestationSizeMin.Value, Plugin.BoundConfig.VainInfestationSizeMax.Value); Plugin.logger.LogInfo((object)(" - " + val.PlanetName + " is infested with vain shrouds")); } else { val.moldSpreadIterations = 0; } } } } }