using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Microsoft.CodeAnalysis; using Player; using SNetwork; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("gtdffoCarryFast")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("gtdffoCarryFast")] [assembly: AssemblyTitle("gtdffoCarryFast")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace Hikaria.InLevelCarryOnBack { [BepInPlugin("Hikaria.InLevelCarryOnBack", "InLevelCarryOnBack", "1.0.2")] internal class EntryPoint : BasePlugin { public static EntryPoint Instance; private Harmony m_Harmony; public override void Load() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown Instance = this; ConfigManager.Initialize(((BasePlugin)this).Config); m_Harmony = new Harmony("Hikaria.InLevelCarryOnBack"); m_Harmony.PatchAll(); Logs.LogMessage("OK"); } } internal static class ConfigManager { public static ConfigFile configFile; private static ConfigEntry speedMultiplier; public static float SpeedMultiplier { get { return speedMultiplier.Value; } set { speedMultiplier.Value = value; } } public static void Initialize(ConfigFile file) { configFile = file; speedMultiplier = configFile.Bind("Speed", "CarryOnBackSpeedMultiplier", 1.3f, "Multiplier applied to horizontal movement velocity while carrying a big item on the back. Set to 1.0 for vanilla speed, 1.3 for 4.5m/s speed (6m/s usual run speed with Shift)"); } } internal static class Logs { public static void LogDebug(object data) { ((BasePlugin)EntryPoint.Instance).Log.LogDebug(data); } public static void LogError(object data) { ((BasePlugin)EntryPoint.Instance).Log.LogError(data); } public static void LogFatal(object data) { ((BasePlugin)EntryPoint.Instance).Log.LogFatal(data); } public static void LogInfo(object data) { ((BasePlugin)EntryPoint.Instance).Log.LogInfo(data); } public static void LogMessage(object data) { ((BasePlugin)EntryPoint.Instance).Log.LogMessage(data); } public static void LogWarning(object data) { ((BasePlugin)EntryPoint.Instance).Log.LogWarning(data); } } public static class PluginInfo { public const string GUID = "Hikaria.InLevelCarryOnBack"; public const string NAME = "InLevelCarryOnBack"; public const string VERSION = "1.0.2"; } } namespace Hikaria.InLevelCarryOnBack.Patches { [HarmonyPatch] internal class Patch_FirstPersonItemHolder { [HarmonyPatch(typeof(FirstPersonItemHolder), "ItemCanMoveQuick")] [HarmonyPrefix] [HarmonyPriority(0)] private static bool FirstPersonItemHolder__ItemCanMoveQuick__Prefix(ref bool __result) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 if (PlayerBackpackManager.LocalBackpack.HasBackpackItem((InventorySlot)8) && (int)PlayerManager.GetLocalPlayerAgent().Inventory.WieldedSlot != 8) { __result = false; return false; } return true; } } [HarmonyPatch] internal class Patch_PlayerBackpackManager { [HarmonyPatch(typeof(PlayerBackpackManager), "HasItem_Local")] [HarmonyPrefix] [HarmonyPriority(0)] private static bool PlayerBackpackManager__HasItem_Local__Prefix(InventorySlot slot, ref bool __result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)slot != 8) { return true; } __result = false; return false; } } [HarmonyPatch] internal class Patch_PlayerInventoryLocal { [HarmonyPatch(typeof(PlayerInventoryLocal), "CheckInput")] [HarmonyPostfix] private static void PlayerInventoryLocal__CheckInput__Postfix(PlayerInventoryLocal __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (((PlayerInventoryBase)__instance).Owner.FPItemHolder.ItemHiddenTrigger || (int)((PlayerInventoryBase)__instance).WieldedSlot != 8 || (int)FocusStateManager.CurrentState == 6 || __instance.CheckWieldingKeys() || ((PlayerInventoryBase)__instance).m_wieldedItem == null) { return; } float axisKeyMouseGamepad = InputMapper.GetAxisKeyMouseGamepad((InputAction)30, ((PlayerInventoryBase)__instance).Owner.InputFilter); if ((Mathf.Abs(axisKeyMouseGamepad) > 0f && Clock.Time > __instance.m_itemScrollTimer) || InputMapper.GetButtonDownKeyMouseGamepad((InputAction)31, ((PlayerInventoryBase)__instance).Owner.InputFilter)) { int num = ((!(axisKeyMouseGamepad > 0f)) ? __instance.GetNextSlot(((PlayerInventoryBase)__instance).WieldedSlot, 1) : __instance.GetNextSlot(((PlayerInventoryBase)__instance).WieldedSlot, -1)); if (num > -1) { ((PlayerInventoryBase)__instance).Owner.Sync.WantsToWieldSlot((InventorySlot)(byte)num, false); pInventoryStatus syncedInventoryStatus = ((PlayerInventoryBase)__instance).Owner.Sync.m_syncedInventoryStatus; syncedInventoryStatus.wieldedSlot = (InventorySlot)(byte)num; ((PlayerInventoryBase)__instance).Owner.Sync.m_syncedInventoryStatus = syncedInventoryStatus; ((PlayerInventoryBase)__instance).Owner.Sync.LastWantedSlot = syncedInventoryStatus.wieldedSlot; ((PlayerInventoryBase)__instance).Owner.Sync.m_inventoryStatusPacket.Send(syncedInventoryStatus, (SNet_ChannelType)4); ((PlayerInventoryBase)__instance).Owner.Sync.DoInventoryWield(syncedInventoryStatus); __instance.m_itemScrollTimer = Clock.Time + 0.1f; } } } [HarmonyPatch(typeof(PlayerInventoryLocal), "Awake")] [HarmonyPostfix] private static void PlayerInventoryLocal__Awake__Postfix(PlayerInventoryLocal __instance) { if (!__instance.m_allowedScrollSlots.Contains((InventorySlot)8)) { __instance.m_allowedScrollSlots.Add((InventorySlot)8); } } [HarmonyPatch(typeof(PlayerInventoryLocal), "CheckAndWield")] [HarmonyPostfix] private static void PlayerInventoryLocal__CheckAndWield__Postfix(PlayerInventoryLocal __instance, InputAction action, InventorySlot slot, ref bool __result) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (!PlayerBackpackManager.LocalBackpack.HasBackpackItem((InventorySlot)8) || (int)((PlayerInventoryBase)__instance).WieldedSlot != 8) { return; } BackpackItem val = null; if (InputMapper.GetButtonDownKeyMouseGamepad(action, ((PlayerInventoryBase)__instance).Owner.InputFilter) && ((PlayerInventoryBase)__instance).WieldedSlot != slot && PlayerBackpackManager.LocalBackpack.HasBackpackItem(slot) && PlayerBackpackManager.TryGetItem(SNet.LocalPlayer, slot, ref val) && (int)val.Status == 0) { ItemEquippable val2 = ((Il2CppObjectBase)val.Instance).TryCast(); if (val2 != null && val2.CanWield) { pInventoryStatus syncedInventoryStatus = ((PlayerInventoryBase)__instance).Owner.Sync.m_syncedInventoryStatus; syncedInventoryStatus.wieldedSlot = slot; ((PlayerInventoryBase)__instance).Owner.Sync.m_syncedInventoryStatus = syncedInventoryStatus; ((PlayerInventoryBase)__instance).Owner.Sync.LastWantedSlot = syncedInventoryStatus.wieldedSlot; ((PlayerInventoryBase)__instance).Owner.Sync.m_inventoryStatusPacket.Send(syncedInventoryStatus, (SNet_ChannelType)4); ((PlayerInventoryBase)__instance).Owner.Sync.DoInventoryWield(syncedInventoryStatus); } __result = true; } else { __result = false; } } } [HarmonyPatch] internal class Patch_PLOC_State { [HarmonyPatch(typeof(PLOC_Base), "GetHorizontalVelocityFromInput")] [HarmonyPostfix] [HarmonyPriority(0)] private static void PLOC_Base__GetHorizontalVelocityFromInput__Postfix(PLOC_Base __instance, ref Vector3 __result) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (__instance.m_owner.Owner.IsLocal && PlayerBackpackManager.LocalBackpack.HasBackpackItem((InventorySlot)8) && (int)__instance.m_owner.Inventory.WieldedSlot != 8) { float speedMultiplier = ConfigManager.SpeedMultiplier; if (speedMultiplier != 1f) { __result *= speedMultiplier; } } } } }