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 WeedKillerFixes v1.2.0
WeedKillerFixes.dll
Decompiled 3 weeks agousing System; 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.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; 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: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("WeedKillerFixes")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Fixes some major issues with weed killer")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+b5b31523b25d9f8e19c8545cd1ad87f05fe382c3")] [assembly: AssemblyProduct("WeedKillerFixes")] [assembly: AssemblyTitle("WeedKillerFixes")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 WeedKillerFixes { internal static class LobbyCompatibility { internal static void Init() { PluginHelper.RegisterPlugin("butterystancakes.lethalcompany.weedkillerfixes", Version.Parse("1.2.0"), (CompatibilityLevel)0, (VersionStrictness)0); } } [BepInPlugin("butterystancakes.lethalcompany.weedkillerfixes", "Weed Killer Fixes", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal const string PLUGIN_GUID = "butterystancakes.lethalcompany.weedkillerfixes"; internal const string PLUGIN_NAME = "Weed Killer Fixes"; internal const string PLUGIN_VERSION = "1.2.0"; internal static ManualLogSource Logger; private const string GUID_LOBBY_COMPATIBILITY = "BMX.LobbyCompatibility"; private void Awake() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) Logger = ((BaseUnityPlugin)this).Logger; if (Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility")) { Logger.LogInfo((object)"CROSS-COMPATIBILITY - Lobby Compatibility detected"); LobbyCompatibility.Init(); } new Harmony("butterystancakes.lethalcompany.weedkillerfixes").PatchAll(); Logger.LogInfo((object)"Weed Killer Fixes v1.2.0 loaded"); } } [HarmonyPatch] internal static class WeedKillerFixesPatches { private static MoldSpreadManager moldSpreadManager; private static VehicleController vehicleController; private static CadaverGrowthAI cadaverGrowthAI; private static readonly MethodInfo MOLD_SPREAD_MANAGER_INSTANCE = AccessTools.DeclaredPropertyGetter(typeof(WeedKillerFixesPatches), "MoldSpreadManager"); private static readonly FieldInfo VEHICLE_CONTROLLER_INSTANCE = AccessTools.Field(typeof(WeedKillerFixesPatches), "vehicleController"); private static readonly FieldInfo CADAVER_GROWTH_AI_INSTANCE = AccessTools.Field(typeof(WeedKillerFixesPatches), "cadaverGrowthAI"); private static MoldSpreadManager MoldSpreadManager { get { if ((Object)(object)moldSpreadManager == (Object)null) { moldSpreadManager = Object.FindAnyObjectByType<MoldSpreadManager>(); } return moldSpreadManager; } } [HarmonyPatch(typeof(SprayPaintItem), "TrySprayingWeedKillerBottle")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> SprayPaintItem_Trans_TrySprayingWeedKillerBottle(IEnumerable<CodeInstruction> instructions) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); MethodInfo methodInfo = AccessTools.DeclaredPropertyGetter(typeof(Time), "deltaTime"); for (int i = 2; i < list.Count - 3; i++) { if (!(list[i].opcode == OpCodes.Call)) { continue; } if ((MethodInfo)list[i].operand == methodInfo) { list[i].opcode = OpCodes.Ldfld; list[i].operand = AccessTools.Field(typeof(SprayPaintItem), "sprayIntervalSpeed"); list.Insert(i, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); Plugin.Logger.LogDebug((object)"Transpiler (SprayPaintItem.TrySprayingWeedKillerBottle): Fix addVehicleHPInterval time"); continue; } string text = list[i].operand.ToString(); if (text.Contains("FindObjectOfType") && text.Contains("VehicleController")) { list[i].opcode = OpCodes.Ldsfld; list[i].operand = VEHICLE_CONTROLLER_INSTANCE; Plugin.Logger.LogDebug((object)"Transpiler (SprayPaintItem.TrySprayingWeedKillerBottle): Cache Cruiser script"); } } return list; } [HarmonyPatch(typeof(SprayPaintItem), "Start")] [HarmonyPatch(typeof(SprayPaintItem), "CheckForWeedsInSprayPath")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> CacheMoldSpreadManager(IEnumerable<CodeInstruction> instructions, MethodBase __originalMethod) { List<CodeInstruction> list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Call) { string text = list[i].operand.ToString(); if (text.Contains("FindObjectOfType") && text.Contains("MoldSpreadManager")) { list[i].operand = MOLD_SPREAD_MANAGER_INSTANCE; Plugin.Logger.LogDebug((object)$"Transpiler ({__originalMethod.DeclaringType}.{__originalMethod.Name}): Cache weed script"); } } } return list; } [HarmonyPatch(typeof(SprayPaintItem), "LateUpdate")] [HarmonyPatch(typeof(SprayPaintItem), "TrySprayingWeedKillerOnLocalPlayer")] [HarmonyPatch(typeof(SprayPaintItem), "CheckForCadaverPlantsInSprayPath")] [HarmonyPatch(typeof(SprayPaintItem), "KillCadaverPlantRpc")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> CacheCadaverGrowthAI(IEnumerable<CodeInstruction> instructions, MethodBase __originalMethod) { List<CodeInstruction> list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Call) { string text = list[i].operand.ToString(); if (text.Contains("FindObjectOfType") && text.Contains("CadaverGrowthAI")) { list[i].opcode = OpCodes.Ldsfld; list[i].operand = CADAVER_GROWTH_AI_INSTANCE; Plugin.Logger.LogDebug((object)$"Transpiler ({__originalMethod.DeclaringType}.{__originalMethod.Name}): Cache Cadaver script"); } } } return list; } [HarmonyPatch(typeof(VehicleController), "Awake")] [HarmonyPostfix] private static void VehicleController_Post_Awake(VehicleController __instance) { if ((Object)(object)vehicleController == (Object)null) { vehicleController = __instance; } } [HarmonyPatch(typeof(CadaverGrowthAI), "Start")] [HarmonyPostfix] private static void CadaverGrowthAI_Post_Start(CadaverGrowthAI __instance) { if ((Object)(object)cadaverGrowthAI == (Object)null) { cadaverGrowthAI = __instance; } } } public static class PluginInfo { public const string PLUGIN_GUID = "WeedKillerFixes"; public const string PLUGIN_NAME = "WeedKillerFixes"; public const string PLUGIN_VERSION = "1.2.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }