using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; 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: AssemblyVersion("0.0.0.0")] [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 StealthTrainingBuff { [BepInPlugin("johbenji.stealthtrainingbuff", "Stealth Training Buff", "1.0.0")] public class StealthTrainingBuffPlugin : BaseUnityPlugin { internal static ManualLogSource Log; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; new Harmony("johbenji.stealthtrainingbuff").PatchAll(); Log.LogInfo((object)"StealthTrainingBuff loaded."); } } [HarmonyPatch(typeof(LocalCharacterControl), "DetectMovementInputs")] public static class SneakSpeedPatch { private const int StealthTrainingItemID = 8205190; private const float VanillaSneakMultWithSkill = 3f; private static readonly FieldRef CharacterRef = AccessTools.FieldRefAccess("m_character"); private static readonly FieldRef ModifMoveInputRef = AccessTools.FieldRefAccess("m_modifMoveInput"); private static void Postfix(LocalCharacterControl __instance) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) Character val = CharacterRef.Invoke((CharacterControl)(object)__instance); if (!((Object)(object)val == (Object)null) && val.Sneaking && (Object)(object)val.Inventory != (Object)null && (Object)(object)val.Inventory.SkillKnowledge != (Object)null && ((CharacterKnowledge)val.Inventory.SkillKnowledge).IsItemLearned(8205190)) { float num = (val.Sheathed ? val.Speed : (val.Speed * 0.875f)) / 3f; ref Vector3 reference = ref ModifMoveInputRef.Invoke(__instance); reference *= num; } } } }