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 BackpackMod v1.0.4
Plugin/BackpackMod.dll
Decompiled 6 months agousing System; 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.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BackpackMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BackpackMod")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7ad4216f-36aa-47ca-8593-088115c7694b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace BackpackModNamespace; [BepInPlugin("com.Nyoh.backpack", "Backpack Mod", "1.0.1")] public class BackpackMod : BaseUnityPlugin { [HarmonyPatch(typeof(PlayerAvatar), "Update")] private class Patch_PlayerAvatar_Update { private static void Postfix(PlayerAvatar __instance) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } bool flag = false; if (FI_isLocal != null) { flag = (bool)FI_isLocal.GetValue(__instance); } else if ((Object)(object)__instance.photonView != (Object)null) { flag = __instance.photonView.IsMine; } if (!flag) { return; } PhysGrabber physGrabber = __instance.physGrabber; if (!((Object)(object)physGrabber == (Object)null)) { if (Input.GetKeyDown(KeyStore.Value)) { TryStore(physGrabber); } if (Input.GetKeyDown(KeyDrop.Value)) { TryDrop(__instance); } } } private static void TryStore(PhysGrabber grabber) { PhysGrabObject val = null; if (FI_grabbedPhys != null) { object? value = FI_grabbedPhys.GetValue(grabber); val = (PhysGrabObject)((value is PhysGrabObject) ? value : null); } if ((Object)(object)val == (Object)null && (Object)(object)grabber.physGrabPoint != (Object)null && grabber.physGrabPoint.childCount > 0) { Transform child = grabber.physGrabPoint.GetChild(0); val = ((Component)child).GetComponent<PhysGrabObject>(); } if ((Object)(object)val == (Object)null) { Log.LogWarning((object)"Nenhum item segurado para guardar!"); } else if (Stored.Count >= MaxItems.Value) { Log.LogWarning((object)("Mochila cheia! (" + Stored.Count + "/" + MaxItems.Value + ")")); } else { Stored.Insert(0, val); ((Component)val).gameObject.SetActive(false); grabber.ReleaseObject(0, 0.1f); Log.LogInfo((object)("Guardado: " + ((Object)val).name + " → Total: " + Stored.Count)); } } private static void TryDrop(PlayerAvatar avatar) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) if (Stored.Count == 0) { Log.LogWarning((object)"Mochila vazia!"); return; } PhysGrabObject val = Stored[0]; Stored.RemoveAt(0); if ((Object)(object)val == (Object)null) { Log.LogWarning((object)"Item null removido da mochila!"); return; } Camera val2 = Camera.main; if ((Object)(object)val2 == (Object)null) { val2 = ((Component)avatar).GetComponentInChildren<Camera>(); } Vector3 val3 = (((Object)(object)val2 != (Object)null) ? ((Component)val2).transform.forward : ((Component)avatar).transform.forward); Vector3 val4 = ((Component)avatar).transform.position + val3 * 1.6f + Vector3.up * 1f; RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(val4 + Vector3.up * 0.5f, Vector3.down, ref val5, 10f)) { val4 = ((RaycastHit)(ref val5)).point + Vector3.up * 0.2f; } ((Component)val).transform.position = val4; ((Component)val).transform.rotation = Quaternion.LookRotation(val3, Vector3.up); ((Component)val).gameObject.SetActive(true); Rigidbody val6 = default(Rigidbody); if (((Component)val).TryGetComponent<Rigidbody>(ref val6)) { val6.velocity = Vector3.zero; val6.angularVelocity = Vector3.zero; } Log.LogInfo((object)("Soltou: " + ((Object)val).name + " → Restam: " + Stored.Count)); } } public static ManualLogSource Log; public static ConfigEntry<KeyCode> KeyStore; public static ConfigEntry<KeyCode> KeyDrop; public static ConfigEntry<int> MaxItems; private static readonly List<PhysGrabObject> Stored = new List<PhysGrabObject>(); private static FieldInfo FI_grabbedPhys; private static FieldInfo FI_isLocal; private void Awake() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; KeyStore = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "Store Key", (KeyCode)102, "Store item"); KeyDrop = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "Drop Key", (KeyCode)122, "Drop last item"); MaxItems = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Max Items", 30, new ConfigDescription("Maximum items", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 60), Array.Empty<object>())); FI_grabbedPhys = AccessTools.Field(typeof(PhysGrabber), "grabbedPhysGrabObject"); FI_isLocal = AccessTools.Field(typeof(PlayerAvatar), "isLocal"); Harmony val = new Harmony("com.Nyoh.backpack"); val.PatchAll(); Log.LogInfo((object)"BackpackMod v1.0.1 loaded! F = guardar | Z = soltar"); } }