Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of CartDump v0.1.4
RepoCartDump.dll
Decompiled 4 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using RepoCartDump.Patches; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [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.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RepoCartDump")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RepoCartDump")] [assembly: AssemblyTitle("RepoCartDump")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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 RepoCartDump { public class CartManager : MonoBehaviour { [CompilerGenerated] private sealed class <Wait10Seconds>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ItemEquippable tempCart; public CartManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Wait10Seconds>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>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 WaitForSecondsRealtime(5f); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)tempCart != (Object)null) { tempCart.RequestUnequip(); } <>4__this.waiting = false; 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(); } } private Rigidbody rb; private ItemEquippable cart = null; private bool waiting = false; private void Start() { rb = ((Component)this).GetComponent<Rigidbody>(); } private void Update() { cart = ((Component)this).GetComponent<ItemEquippable>(); if (IsInExtractionArea()) { if ((Object)(object)cart == (Object)null) { cart = ((Component)this).gameObject.AddComponent<ItemEquippable>(); } else if (!((Behaviour)cart).enabled) { ((Behaviour)cart).enabled = true; } } else if ((Object)(object)cart != (Object)null && cart.IsEquipped() && !waiting) { waiting = true; ((MonoBehaviour)this).StartCoroutine(Wait10Seconds(cart)); } else if ((Object)(object)cart != (Object)null) { ((Behaviour)cart).enabled = false; } } [IteratorStateMachine(typeof(<Wait10Seconds>d__5))] private IEnumerator Wait10Seconds(ItemEquippable tempCart) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Wait10Seconds>d__5(0) { <>4__this = this, tempCart = tempCart }; } private bool IsInExtractionArea() { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0090: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ExtractionPointPatch.position; if (position == Vector3.zero) { return false; } Vector3 position2 = ((Component)this).transform.position; bool flag = position2.x >= position.x - 1f && position2.x <= position.x + 1f; bool flag2 = position2.z >= position.z - 1f && position2.z <= position.z + 1f; bool flag3 = position2.y >= position.y; return flag && flag2; } } [BepInPlugin("RepoCartDump", "Repo Cart Dump", "0.1.0")] public class RepoCartDump : BaseUnityPlugin { private const string modGUID = "RepoCartDump"; private const string modName = "Repo Cart Dump"; private const string modVersion = "0.1.0"; private readonly Harmony harmony = new Harmony("RepoCartDump"); private static RepoCartDump instance; public static ManualLogSource mls; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } mls = Logger.CreateLogSource("RepoCartDump"); ConfigManager.Initialize(((BaseUnityPlugin)this).Config); mls.LogInfo((object)"RepoCartDump is now awake!"); harmony.PatchAll(typeof(RepoCartDump)); harmony.PatchAll(typeof(PlayerControllerPatch)); harmony.PatchAll(typeof(ChatManagerPatch)); harmony.PatchAll(typeof(PhysGrabCartPatch)); harmony.PatchAll(typeof(EnemyParentPatch)); harmony.PatchAll(typeof(ExtractionPointPatch)); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "RepoCartDump"; public const string PLUGIN_NAME = "RepoCartDump"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace RepoCartDump.Patches { [HarmonyPatch(typeof(ChatManager))] internal class ChatManagerPatch { public static ChatState chatState; [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch(ref ChatState ___chatState) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) chatState = ___chatState; } } internal class ConfigManager { public static ConfigEntry<string> rotateKey; public static void Initialize(ConfigFile cfg) { rotateKey = cfg.Bind<string>("Controls", "DebugKey", "x", "The key used to debug."); } } [HarmonyPatch(typeof(EnemyParent))] internal class EnemyParentPatch { private static readonly Dictionary<string, string> enemyNames = new Dictionary<string, string> { { "Gnome", "Lego Stei" }, { "Hidden", "Flavio" }, { "Loom", "Noah" }, { "Mentalist", "Megamind" }, { "Apex Predator", "Halt die Schnauze" } }; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void SetEnemyNames(EnemyParent __instance) { if (enemyNames.TryGetValue(__instance.enemyName, out string value)) { __instance.enemyName = value; } } } [HarmonyPatch(typeof(ExtractionPoint))] internal class ExtractionPointPatch { public static Vector3 position = Vector3.zero; private static Vector3 minArea; private static Vector3 maxArea; [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ExtractionPoint __instance) { //IL_0017: 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_004b: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (((Behaviour)__instance).isActiveAndEnabled) { position = __instance.extractionArea.transform.position; minArea = new Vector3(position.x - 1f, position.y, position.z - 1f); maxArea = new Vector3(position.x + 1f, position.y, position.z + 1f); } } } [HarmonyPatch(typeof(PhysGrabCart))] internal class PhysGrabCartPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(PhysGrabCart __instance) { if (!((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelShop) && !__instance.isSmallCart && (Object)(object)((Component)__instance).GetComponent<CartManager>() == (Object)null && !__instance.isSmallCart) { ((Component)__instance).gameObject.AddComponent<CartManager>(); } } } public static class PlayerGrabbingTracker { public static Dictionary<int, GameObject> playerGrabbingMap = new Dictionary<int, GameObject>(); public static void SetLocalPlayerGrabbing(GameObject obj) { int actorNumber = PhotonNetwork.LocalPlayer.ActorNumber; if ((Object)(object)obj != (Object)null) { playerGrabbingMap[actorNumber] = obj; } else if (playerGrabbingMap.ContainsKey(actorNumber)) { playerGrabbingMap.Remove(actorNumber); } } } [HarmonyPatch(typeof(PlayerController))] internal class PlayerControllerPatch { private static Inventory inventory; private static CartManager cart; private static List<string> mouseBtns = new List<string> { "leftButton", "rightButton", "middleButton", "forwardButton", "backButton" }; [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch(PlayerController __instance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 if ((Object)(object)__instance.physGrabObject != (Object)null) { PlayerGrabbingTracker.SetLocalPlayerGrabbing(__instance.physGrabObject.gameObject); if ((int)ChatManagerPatch.chatState != 1 && WasButtonPressedThisFrame(ConfigManager.rotateKey.Value) && (Object)(object)__instance.physGrabObject.GetComponent<CartManager>() != (Object)null) { cart = __instance.physGrabObject.GetComponent<CartManager>(); inventory = ((Component)__instance).GetComponent<Inventory>(); Debug.Log((object)"Joel Du lappi"); } } else { PlayerGrabbingTracker.SetLocalPlayerGrabbing(null); } } private static bool WasButtonPressedThisFrame(string btn) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) InputControl val = ((!mouseBtns.Contains(btn)) ? ((InputControl)Keyboard.current)[btn] : ((InputControl)Mouse.current)[btn]); return ((ButtonControl)val).wasPressedThisFrame; } } }