using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MertonSpeedMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MertonSpeedMod")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("21ff3020-3fc4-4ebf-8bd2-6aef0854e645")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("tunombre.outward.mertonspeed", "MertonSpeedMod", "1.0.0")] public class MertonSpeedMod : BaseUnityPlugin { [CompilerGenerated] private sealed class d__9 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public MertonSpeedMod <>4__this; private Character 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: { <>1__state = -1; CharacterManager instance = CharacterManager.Instance; 5__1 = ((instance != null) ? instance.GetFirstLocalCharacter() : null); if ((Object)(object)5__1 == (Object)null) { Log.LogInfo((object)"ERROR: character es null."); return false; } SpeedHelper.Refresh(5__1); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static ManualLogSource Log; private Harmony _harmony; public const int MERTON_RIBCAGE_ID = 3200030; public const int MERTON_SHINBONES_ID = 3200032; public const string STACK_ID = "MertonSetBonus"; public const float SPEED_BONUS = 1.5f; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("tunombre.outward.mertonspeed"); _harmony.PatchAll(); Log.LogInfo((object)"MertonSpeedMod cargado."); } private void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown NetworkLevelLoader instance = NetworkLevelLoader.Instance; instance.onGameplayLoadingDone = (UnityAction)Delegate.Combine((Delegate?)(object)instance.onGameplayLoadingDone, (Delegate?)new UnityAction(OnGameplayLoadingDone)); Log.LogInfo((object)"Suscrito a onGameplayLoadingDone."); } private void OnGameplayLoadingDone() { Log.LogInfo((object)"onGameplayLoadingDone fired."); ((MonoBehaviour)this).StartCoroutine(DelayedRefresh()); } [IteratorStateMachine(typeof(d__9))] private IEnumerator DelayedRefresh() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__9(0) { <>4__this = this }; } } [HarmonyPatch(typeof(CharacterEquipment), "EquipItem", new Type[] { typeof(Equipment), typeof(bool) })] public class Patch_Equip { private static void Postfix(CharacterEquipment __instance) { Character componentInParent = ((Component)__instance).GetComponentInParent(); SpeedHelper.Refresh(componentInParent); } } [HarmonyPatch(typeof(CharacterEquipment), "UnequipItem", new Type[] { typeof(Equipment), typeof(bool), typeof(ItemContainer) })] public class Patch_Unequip { private static void Postfix(CharacterEquipment __instance) { Character componentInParent = ((Component)__instance).GetComponentInParent(); SpeedHelper.Refresh(componentInParent); } } public static class SpeedHelper { private static bool _bonusActive; public static void Refresh(Character character) { if (!((Object)(object)character == (Object)null) && character.IsLocalPlayer) { bool flag = IsEquipped(character, 3200030); bool flag2 = IsEquipped(character, 3200032); bool flag3 = flag && flag2; MertonSpeedMod.Log.LogInfo((object)$"Refresh — Ribcage: {flag}, Shinbones: {flag2}, BonusActivo: {_bonusActive}"); if (flag3 && !_bonusActive) { ApplyBonus(character); _bonusActive = true; MertonSpeedMod.Log.LogInfo((object)"Set Merton: +150% velocidad ACTIVADO."); } else if (!flag3 && _bonusActive) { RemoveBonus(character); _bonusActive = false; MertonSpeedMod.Log.LogInfo((object)"Set Merton: bonus RETIRADO."); } } } private static bool IsEquipped(Character character, int itemID) { EquipmentSlot[] equipmentSlots = character.Inventory.Equipment.EquipmentSlots; foreach (EquipmentSlot val in equipmentSlots) { if ((Object)(object)((val != null) ? val.EquippedItem : null) != (Object)null && ((Item)val.EquippedItem).ItemID == itemID) { return true; } } return false; } private static Tag GetMovementSpeedTag() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) foreach (Tag dbTag in TagSourceManager.Instance.DbTags) { if (dbTag.TagName == "MovementSpeed") { return dbTag; } } MertonSpeedMod.Log.LogInfo((object)"ERROR: Tag MovementSpeed no encontrado."); return Tag.None; } private static void ApplyBonus(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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) //IL_0018: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) Tag movementSpeedTag = GetMovementSpeedTag(); StatStack val = new StatStack("MertonSetBonus", 1.5f, (Tag[])null); character.Stats.AddStatStack(movementSpeedTag, val, false); } private static void RemoveBonus(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) Tag movementSpeedTag = GetMovementSpeedTag(); character.Stats.RemoveStatStack(movementSpeedTag, "MertonSetBonus", false); } }