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 ScavengerOfPharloom v2.1.0
ScavengerOfPharloom.dll
Decompiled 7 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using DanielSteginkUtils.Utilities; using HarmonyLib; using Microsoft.CodeAnalysis; using ScavengerOfPharloom.Settings; using TeamCherry.Localization; using TeamCherry.SharedUtils; 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("ScavengerOfPharloom")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("This is a library of custom helpers and logic for Hollow Knight: Silksong mods.")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0+ac54326dc27e4e0e94638d133a25b09884cf8f91")] [assembly: AssemblyProduct("ScavengerOfPharloom")] [assembly: AssemblyTitle("ScavengerOfPharloom")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/danielstegink/Silksong.DanielSteginkUtils")] [assembly: NeutralResourcesLanguage("EN")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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] [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Microsoft.CodeAnalysis.Embedded] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Microsoft.CodeAnalysis.Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace ScavengerOfPharloom { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("io.github.danielstegink.scavengerofpharloom", "ScavengerOfPharloom", "2.1.0")] public class ScavengerOfPharloom : BaseUnityPlugin { public const string Id = "io.github.danielstegink.scavengerofpharloom"; internal static ScavengerOfPharloom Instance { get; private set; } public static string Name => "ScavengerOfPharloom"; public static string Version => "2.1.0"; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) Instance = this; new Harmony("io.github.danielstegink.scavengerofpharloom").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (io.github.danielstegink.scavengerofpharloom) has loaded!")); } private void Start() { ConfigSettings.Initialize(((BaseUnityPlugin)this).Config); } internal void Log(string message) { ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } } } namespace ScavengerOfPharloom.Settings { public static class ConfigSettings { public static ConfigEntry<bool> setShardDrop; public static ConfigEntry<bool> setRosaryDrop; public static ConfigEntry<bool> setSilkDrop; public static ConfigEntry<bool> setLifebloodDrop; public static void Initialize(ConfigFile config) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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) LocalisedString val = default(LocalisedString); ((LocalisedString)(ref val))..ctor("Mods.io.github.danielstegink.scavengerofpharloom", "SHARD_NAME"); LocalisedString val2 = default(LocalisedString); ((LocalisedString)(ref val2))..ctor("Mods.io.github.danielstegink.scavengerofpharloom", "SHARD_DESC"); if (((LocalisedString)(ref val)).Exists && ((LocalisedString)(ref val2)).Exists) { setShardDrop = config.Bind<bool>("Modifier", LocalisedString.op_Implicit(val), true, LocalisedString.op_Implicit(val2)); } else { setShardDrop = config.Bind<bool>("Modifier", "Shell Pots", true, "Allows pots, statues and more to drop shell shards"); } LocalisedString val3 = default(LocalisedString); ((LocalisedString)(ref val3))..ctor("Mods.io.github.danielstegink.scavengerofpharloom", "ROSARY_NAME"); LocalisedString val4 = default(LocalisedString); ((LocalisedString)(ref val4))..ctor("Mods.io.github.danielstegink.scavengerofpharloom", "ROSARY_DESC"); if (((LocalisedString)(ref val3)).Exists && ((LocalisedString)(ref val4)).Exists) { setRosaryDrop = config.Bind<bool>("Modifier", LocalisedString.op_Implicit(val3), true, LocalisedString.op_Implicit(val4)); } else { setRosaryDrop = config.Bind<bool>("Modifier", "Wealth of the Citadel", true, "Allows pots in the Citadel to drop rosaries"); } LocalisedString val5 = default(LocalisedString); ((LocalisedString)(ref val5))..ctor("Mods.io.github.danielstegink.scavengerofpharloom", "SILK_NAME"); LocalisedString val6 = default(LocalisedString); ((LocalisedString)(ref val6))..ctor("Mods.io.github.danielstegink.scavengerofpharloom", "SILK_DESC"); if (((LocalisedString)(ref val5)).Exists && ((LocalisedString)(ref val6)).Exists) { setSilkDrop = config.Bind<bool>("Modifier", LocalisedString.op_Implicit(val5), true, LocalisedString.op_Implicit(val6)); } else { setSilkDrop = config.Bind<bool>("Modifier", "Gratitude of the Silk Flies", true, "Allows Silk Flies to replenish Silk when freed"); } LocalisedString val7 = default(LocalisedString); ((LocalisedString)(ref val7))..ctor("Mods.io.github.danielstegink.scavengerofpharloom", "LIFEBLOOD_NAME"); LocalisedString val8 = default(LocalisedString); ((LocalisedString)(ref val8))..ctor("Mods.io.github.danielstegink.scavengerofpharloom", "LIFEBLOOD_DESC"); if (((LocalisedString)(ref val7)).Exists && ((LocalisedString)(ref val8)).Exists) { setLifebloodDrop = config.Bind<bool>("Modifier", LocalisedString.op_Implicit(val7), true, LocalisedString.op_Implicit(val8)); } else { setLifebloodDrop = config.Bind<bool>("Modifier", "Lifeblood Bounty", true, "Allows plasmium bulbs to give lifeblood"); } } } } namespace ScavengerOfPharloom.Helpers { [HarmonyPatch(typeof(Breakable), "Break")] public static class BreakPatch { [HarmonyPrefix] public static void Prefix(Breakable __instance, float flingAngleMin, float flingAngleMax, float impactMultiplier) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) Breakable __instance2 = __instance; if (ConfigSettings.setShardDrop.Value && new List<string> { "loom_room_jar", "generic_break_pot_", "bone_goomba_skull_break", "Bone_house_breakable_point", "Bone_house_breakable_mid", "Bone_house_pieces_squat", "brk_barrel_", "Dock_Table", "ant_brk_barrel_", "pilgrim_fossil_break", "fossil_judge_break_leanRight", "Hornet_Coral_Chunk_Break", "slab_pot_basic" }.Any((string x) => ((Object)((Component)__instance2).gameObject).name.Contains(x))) { ClassIntegrations.SetField<Breakable>(__instance2, "shellShardDrops", (object)new MinMaxInt(0, 1), BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } if (ConfigSettings.setRosaryDrop.Value && new List<string> { "rosary_shrine_break", "Hornet_way_pole_harp", "sc_break_pot_", "sc_break_extras_detail_clutter_spike", "sc_break_extras_detail_small_spike_ball", "break_abacus", "slab_pot_gold" }.Any((string x) => ((Object)((Component)__instance2).gameObject).name.Contains(x))) { ClassIntegrations.SetField<Breakable>(__instance2, "smallGeoDrops", (object)new MinMaxInt(0, 1), BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } } [HarmonyPostfix] public static void Postfix(Breakable __instance, float flingAngleMin, float flingAngleMax, float impactMultiplier) { Breakable __instance2 = __instance; if (!ConfigSettings.setSilkDrop.Value) { return; } if (((Object)((Component)__instance2).gameObject).name.Equals("lamp_pivot")) { HeroController.instance.AddSilk(3, false); } else if (((Object)((Component)__instance2).gameObject).name.Equals("Active")) { if (!((Object)(object)((Component)__instance2).transform.parent != (Object)null)) { return; } GameObject gameObject = ((Component)((Component)__instance2).transform.parent).gameObject; if (((Object)gameObject).name.Equals("lamp") && (Object)(object)gameObject.transform.parent != (Object)null) { GameObject gameObject2 = ((Component)gameObject.transform.parent).gameObject; bool num = ((Object)gameObject2).name.Contains("city_lamp_") && ((Object)gameObject2).name.Contains("_breakable"); List<string> source = new List<string> { "dock_chain_lamp", "Lamp 0", "ant_lamp_up_breakable", "grey_halfway_lamp_", "break_grey_lamp_", "swamp_lamp_simple_hang", "Slab Chain Lamp" }; if ((num || source.Any((string x) => ((Object)((Component)__instance2).gameObject).name.Contains(x))) && Random.Range(1, 101) <= 50) { HeroController.instance.SilkGain(); } } else if (((Object)gameObject).name.Equals("cap") && (Object)(object)gameObject.transform.parent != (Object)null) { _ = ((Component)gameObject.transform.parent).gameObject; if (((Object)gameObject).name.Contains("shell_hang_rope") && Random.Range(1, 101) <= 50) { HeroController.instance.SilkGain(); } } } else if (new List<string> { "Bone_house_pieces_post", "lamp_roof_break_always_on", "break_grey_lamp_", "break_aspid_lamp", "break_lamp_slab_bridge", "sc_mid_roof_lamp", "sc_mid_room_lamp_small_breakable", "break_silk_fly_jar", "library_lamp_wall", "Lamp_Full", "library_lamp_stand", "organ lamp", "organ lamp_mounted", "caravan_signpost" }.Any((string x) => ((Object)((Component)__instance2).gameObject).name.Contains(x)) && Random.Range(1, 101) <= 50) { HeroController.instance.SilkGain(); } } } [HarmonyPatch(typeof(HealthManager), "TakeDamage")] public static class EnemyTakeDamagePatch { [HarmonyPostfix] public static void Postfix(HealthManager __instance, HitInstance hitInstance) { if (ConfigSettings.setSilkDrop.Value && __instance.isDead && ((Object)((Component)__instance).gameObject).name.ToLower().Contains("automaton") && !((Object)((Component)__instance).gameObject).name.ToLower().Contains("breakable") && Random.Range(1, 101) <= 50) { HeroController.instance.SilkGain(); } } } [HarmonyPatch(typeof(LifebloodPustule), "Break")] public static class LifebloodBreakPatch { [HarmonyPostfix] public static void Postfix() { if (ConfigSettings.setLifebloodDrop.Value && Random.Range(1, 101) <= 50) { EventRegister.SendEvent(EventRegisterEvents.AddBlueHealth, (GameObject)null); } } } }