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 WizardryPatch v1.0.1
WizardryPatch.dll
Decompiled 2 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using PieceManager; using UnityEngine; using WarfareWizardry; [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: IgnoresAccessChecksTo("assembly_valheim")] [assembly: IgnoresAccessChecksTo("Wizardry")] [assembly: AssemblyCompany("WizardryPatch")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WizardryPatch")] [assembly: AssemblyTitle("WizardryPatch")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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; } } } namespace WizardryPatch { [BepInPlugin("_0.pseudopulse.WizardryPatch", "WizardryPatch", "1.0.0")] public class _0WizardryPatchPlugin : BaseUnityPlugin { public static BindingFlags FLAGS = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private void Awake() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown Hook val = new Hook((MethodBase)typeof(PiecePrefabManager).GetMethod("RepositionCategories", FLAGS), (Delegate)(Action<Action<PieceTable>, PieceTable>)delegate { }); Hook val2 = new Hook((MethodBase)typeof(PiecePrefabManager).GetMethod("RepositionCatsIfNeeded", FLAGS), (Delegate)(Action<Action>)delegate { }); Hook val3 = new Hook((MethodBase)typeof(BuildPiece).GetMethod("Patch_FejdStartup", FLAGS), (Delegate)(Action<Action<FejdStartup>, FejdStartup>)delegate(Action<FejdStartup> orig, FejdStartup self) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) orig(self); foreach (GameObject piecePrefab in PiecePrefabManager.piecePrefabs) { piecePrefab.GetComponent<Piece>().m_category = (PieceCategory)1; } }); Hook val4 = new Hook((MethodBase)typeof(WizardryPlugin).GetMethod("EnvManReplacement", FLAGS), (Delegate)(Func<Func<EnvMan, Biome>, EnvMan, Biome>)((Func<EnvMan, Biome> orig, EnvMan self) => self.GetBiome().Biome)); } public static Biome EnvManReplacement(EnvMan instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return instance.GetBiome().Biome; } } public static class PluginInfo { public const string PLUGIN_GUID = "WizardryPatch"; public const string PLUGIN_NAME = "WizardryPatch"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/patchers/WizardryPatch/WizardryPatch.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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 Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoMod.Cil; using MonoMod.Utils; 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: IgnoresAccessChecksTo("assembly_valheim")] [assembly: IgnoresAccessChecksTo("Wizardry")] [assembly: AssemblyCompany("WizardryPatch")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WizardryPatch")] [assembly: AssemblyTitle("WizardryPatch")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] 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; } } } namespace WizardryPatch { public static class WizardryPatcher { internal static class Logger { private static readonly ManualLogSource logSource = Logger.CreateLogSource("WizardryPatcher"); public static void Info(object data) { logSource.LogInfo(data); } public static void Error(object data) { logSource.LogError(data); } public static void Warn(object data) { logSource.LogWarning(data); } public static void Fatal(object data) { logSource.LogFatal(data); } public static void Message(object data) { logSource.LogMessage(data); } public static void Debug(object data) { logSource.LogDebug(data); } } private static ModuleDefinition WZ; public static BindingFlags FLAGS = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static IEnumerable<string> TargetDLLs { get; } = new string[0]; public static void Patch(AssemblyDefinition assemblyDef) { } public static void Finish() { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00df: 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_012d: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) string text = Directory.EnumerateFiles(Paths.PluginPath, "Wizardry.dll.bak", SearchOption.AllDirectories).FirstOrDefault(); string text2 = Directory.EnumerateFiles(Paths.PluginPath, "Wizardry.dll", SearchOption.AllDirectories).FirstOrDefault(); if (text2 != null) { if (text == null) { text = text2 + ".bak"; if (File.Exists(text)) { File.Delete(text); } File.Move(text2, text); } } else { text2 = text; } AssemblyDefinition val = AssemblyDefinition.ReadAssembly(text); WZ = val.MainModule; TypeDefinition type = WZ.GetType("PieceManager.PiecePrefabManager"); MethodDefinition val2 = ((IEnumerable<MethodDefinition>)type.Methods).First((MethodDefinition x) => ((MemberReference)x).Name == "UpdateAvailable_Prefix"); val2.Body = new MethodBody(val2); val2.Body.GetILProcessor().Emit(OpCodes.Ret); Extensions.RecalculateILOffsets(val2); MethodDefinition val3 = ((IEnumerable<MethodDefinition>)type.Methods).First((MethodDefinition x) => ((MemberReference)x).Name == "UpdateAvailable_Postfix"); val3.Body = new MethodBody(val3); val3.Body.GetILProcessor().Emit(OpCodes.Ret); Extensions.RecalculateILOffsets(val3); TypeReference val4 = WZ.ImportReference(typeof(Biome)); MethodReference refItemDrop = WZ.ImportReference((MethodBase)typeof(ItemDrop).GetMethod("OnCreateNew", FLAGS, null, new Type[2] { typeof(GameObject), typeof(bool) }, null)); TypeDefinition type2 = WZ.GetType("WarfareWizardry.WizardryPlugin"); MethodDefinition EnvManReplacement = new MethodDefinition("EnvManReplacement", (MethodAttributes)22, val4); ((MethodReference)EnvManReplacement).Parameters.Add(new ParameterDefinition(WZ.ImportReference(typeof(EnvMan)))); EnvManReplacement.Body.GetILProcessor().Emit(OpCodes.Ldc_I4_0); EnvManReplacement.Body.GetILProcessor().Emit(OpCodes.Ret); type2.Methods.Add(EnvManReplacement); PatchTreeDrop("PineTreeLog_Destroy_Patch"); PatchTreeDrop("AncientTreeLog_Destroy_Patch"); PatchTreeDrop("FirTreeLog_Destroy_Patch"); PatchTreeDrop("BirchTreeLog_Destroy_Patch"); PatchTreeDrop("YggdrasilTreeLog_Destroy_Patch"); PatchTreeDrop("YggdrasilTreeShoot_Destroy_Patch"); val.Write(Path.Combine(Path.GetDirectoryName(text2), "Wizardry.dll")); val.Dispose(); void PatchTreeDrop(string text3) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) TypeDefinition type3 = WZ.GetType("WarfareWizardry.WizardryPlugin/" + text3); MethodDefinition val5 = ((IEnumerable<MethodDefinition>)type3.Methods).First((MethodDefinition x) => ((MemberReference)x).Name == "Postfix"); ILProcessor iLProcessor = val5.Body.GetILProcessor(); int index = val5.Body.Instructions.IndexOf(Match(iLProcessor, (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0))) - 1; ReplaceIndex(iLProcessor, index, Instruction.Create(OpCodes.Call, (MethodReference)(object)EnvManReplacement)); MethodReference val6 = default(MethodReference); int num = default(int); index = val5.Body.Instructions.IndexOf(Match(iLProcessor, (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val6), (Instruction x) => ILPatternMatchingExt.MatchNop(x), (Instruction x) => ILPatternMatchingExt.MatchNop(x), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num))); index++; ReplaceIndex(iLProcessor, index, Instruction.Create(OpCodes.Callvirt, refItemDrop)); index--; EmitIndex(iLProcessor, index, Instruction.Create(OpCodes.Ldc_I4, 1)); } } private static void ReplaceIndex(ILProcessor proc, int index, Instruction instruction) { Instruction val = ((IEnumerable<Instruction>)proc.Body.Instructions).ElementAt(index); proc.Replace(val, instruction); } private static void EmitIndex(ILProcessor proc, int index, Instruction instruction) { Instruction val = ((IEnumerable<Instruction>)proc.Body.Instructions).ElementAt(index); proc.InsertAfter(val, instruction); } private static void NopRange(ILProcessor proc, int start, int amount) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < amount; i++) { Instruction val = ((IEnumerable<Instruction>)proc.Body.Instructions).ElementAt(start); Instruction val2 = Instruction.Create(OpCodes.Nop); proc.Replace(val, val2); start++; } } private static void Print(ILProcessor proc) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) Enumerator<Instruction> enumerator = proc.Body.Instructions.GetEnumerator(); try { while (enumerator.MoveNext()) { Instruction current = enumerator.Current; Logger.Error(((object)current).ToString()); } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } private static Instruction Match(ILProcessor proc, params Func<Instruction, bool>[] matches) { return ((IEnumerable<Instruction>)proc.Body.Instructions).First(delegate(Instruction x) { int num = proc.Body.Instructions.IndexOf(x); for (int i = 0; i < matches.Length; i++) { Instruction arg = ((IEnumerable<Instruction>)proc.Body.Instructions).ElementAt(num); if (!matches[i](arg)) { return false; } num++; } return true; }); } } public static class PluginInfo { public const string PLUGIN_GUID = "WizardryPatch"; public const string PLUGIN_NAME = "WizardryPatch"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }