using System; using System.Collections.Generic; using System.Diagnostics; 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.Configuration; using ComputerysModdingUtilities; using HarmonyLib; using HarmonyLib.Tools; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: StraftatMod(true)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ComputerysModdingUtilities")] [assembly: IgnoresAccessChecksTo("FishNet.Runtime")] [assembly: AssemblyCompany("Koki")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6baf723e29bc9b3bb3d61509fd2e101bfb160ed9")] [assembly: AssemblyProduct("TauntBinds")] [assembly: AssemblyTitle("TauntBinds")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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 TauntBinds { [BepInPlugin("TauntBinds", "Taunt Binds", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class TauntBindPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(FirstPersonController), "HandleTaunt")] public static class TauntBindPatch { public static IEnumerable Transpiler(IEnumerable instructions) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected I4, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected I4, but got Unknown //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown FieldInfo fieldInfo = AccessTools.Field(typeof(FirstPersonController), "tauntTimer"); CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); if (_infTaunt) { val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[5] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ble_Un, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ret, (object)null, (string)null) }).RemoveInstructions(5); } for (int i = 0; i < 2; i++) { for (int j = 1; j < 10; j++) { val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)null, (string)null) }); val.SetOperandAndAdvance((object)(int)_tauntKeys[j].Value); } val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)null, (string)null) }); val.SetOperandAndAdvance((object)(int)_tauntKeys[0].Value); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)null, (string)null) }).Advance(1); } return val.InstructionEnumeration(); } } private static Harmony _harmony; private static ConfigEntry[] _tauntKeys = new ConfigEntry[10]; private static readonly KeyCode[] _defaultKeys; private static bool _infTaunt; private static bool _limitTaunts; private void Awake() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown for (int i = 0; i < 10; i++) { _tauntKeys[i] = ((BaseUnityPlugin)this).Config.Bind("Bindings", "Key for taunt #" + i, _defaultKeys[i], (ConfigDescription)null); } _infTaunt = ((BaseUnityPlugin)this).Config.Bind("Infinite Taunt", "Remove cooldown on taunts", false, "Having the InfTaunt mod enabled will automatically set this to true.").Value; _limitTaunts = ((BaseUnityPlugin)this).Config.Bind("Infinite Taunt", "Limit Received Taunts", true, "Vanilla limits the max taunts/second you can receive. This removes that limit for your client.").Value; if (Chainloader.PluginInfos.ContainsKey("dimolade.dimolade.InfTaunt")) { _infTaunt = true; Harmony.UnpatchID("dimolade.harmony.InfTaunt"); } HarmonyFileLog.Enabled = true; _harmony = new Harmony("TauntBinds"); _harmony.PatchAll(typeof(TauntBindPatch)); if (!_limitTaunts) { _harmony.PatchAll(typeof(RemoveTauntLimiter)); } } private void OnDestroy() { _harmony.UnpatchSelf(); } static TauntBindPlugin() { KeyCode[] array = new KeyCode[10]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); _defaultKeys = (KeyCode[])(object)array; } } [HarmonyPatch(typeof(FirstPersonController), "RpcLogic___AboubiPlayObservers_3316948804")] public static class RemoveTauntLimiter { public static IEnumerable Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return new CodeMatcher(instructions, (ILGenerator)null).Start().RemoveInstructions(10).InstructionEnumeration(); } } public static class PluginInfo { public const string PLUGIN_GUID = "TauntBinds"; public const string PLUGIN_NAME = "TauntBinds"; public const string PLUGIN_VERSION = "1.0.0"; } }