using 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 BepInEx.Logging; using HarmonyLib; [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.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("MorticianRebalancer")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MorticianRebalancer")] [assembly: AssemblyTitle("MorticianRebalancer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace MorticianRebalancer { [BepInPlugin("Moonz.MorticianRebalancer", "MorticianRebalancer", "0.0.9")] public class MorticianRebalancer : BaseUnityPlugin { public const string PluginGUID = "Moonz.MorticianRebalancer"; public const string PluginName = "MorticianRebalancer"; public const string PluginVersion = "0.0.9"; public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown Harmony val = new Harmony("Moonz.MorticianRebalancer"); Type type = Type.GetType("SkillStates.Morris.SwingShovel, morris"); if (type != null) { type.GetField("damageCoefficient", BindingFlags.Static | BindingFlags.Public)?.SetValue(null, 5f); } Type type2 = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (!(assembly.GetName().Name == "morris")) { continue; } Type[] types = assembly.GetTypes(); foreach (Type type3 in types) { if (type3.Name == "Tokens" || type3.Name == "LanguageTokens" || type3.Name == "Token") { type2 = type3; break; } } if (type2 != null) { break; } } if (type2 != null) { MethodInfo methodInfo = AccessTools.Method(type2, "AddTokens", (Type[])null, (Type[])null); if (methodInfo != null) { val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(TokensPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } } public static class TokensPatch { public static void Postfix() { string text = "BOG"; string text2 = text + "_MORRIS_BODY_PRIMARY_SHOVEL_DESCRIPTION"; string text3 = "Swing your shovel for 500% damage. Hit ghouls and tombstones to launch them for 350% damage."; Type type = Type.GetType("R2API.LanguageAPI, R2API.Language"); if (type != null) { AccessTools.Method(type, "Add", new Type[2] { typeof(string), typeof(string) }, (Type[])null)?.Invoke(null, new object[2] { text2, text3 }); } } } } namespace ExamplePlugin { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } }