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 ItemSpawner Fixed v1.1.1
ItemSpawner.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; 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("ItemSpawner")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2025 Spoopylocal")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("ItemSpawner")] [assembly: AssemblyTitle("ItemSpawner")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 ItemSpawner { [BepInPlugin("ItemSpawner", "ItemSpawner", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("ItemSpawner"); internal static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } private void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown Instance = this; Logger = Logger.CreateLogSource("ItemSpawner"); Logger.LogInfo((object)"ItemSpawner has awoken!"); Harmony val = new Harmony("ItemSpawner"); val.PatchAll(); Logger.LogInfo((object)"ShopManagerPatchPlugin loaded and custom prefab pool applied."); ((MonoBehaviour)this).StartCoroutine(WaitForStatsManager()); } private IEnumerator WaitForStatsManager() { while ((Object)(object)StatsManager.instance == (Object)null) { Debug.LogWarning((object)"[ShopManagerPatchPlugin] Waiting for StatsManager to initialize..."); yield return (object)new WaitForSeconds(0.5f); } Logger.LogInfo((object)"[ShopManagerPatchPlugin] StatsManager is now available!"); } private GameObject FindExistingItemPrefab(string itemKey) { if (StatsManager.instance.itemDictionary.TryGetValue(itemKey, out var value)) { if ((Object)(object)value.prefab != (Object)null) { Logger.LogInfo((object)("[FindExistingItemPrefab] Found prefab for key: " + itemKey)); return value.prefab; } Logger.LogInfo((object)("[FindExistingItemPrefab] Found item for key '" + itemKey + "' but item.prefab is null!")); } else { Logger.LogInfo((object)("[FindExistingItemPrefab] No item found in itemDictionary for key: " + itemKey)); } return null; } } public class ShopManagerSpawnGUI : MonoBehaviour { private string spawnItemName = ""; public bool showSpawnGUI = false; private bool isTextFieldFocused = false; private void Update() { if (!isTextFieldFocused) { if (((ButtonControl)Keyboard.current.f1Key).wasPressedThisFrame) { showSpawnGUI = !showSpawnGUI; Debug.Log((object)("Spawn GUI toggled: " + (showSpawnGUI ? "Shown" : "Hidden"))); } if (((ButtonControl)Keyboard.current.enterKey).wasPressedThisFrame) { SpawnItem(spawnItemName); spawnItemName = ""; GUI.FocusControl((string)null); } } } private void OnGUI() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (showSpawnGUI) { GUILayout.BeginArea(new Rect(10f, 10f, 300f, 120f), "Spawn Item UI", GUI.skin.window); GUILayout.Label("Enter Item Name:", Array.Empty<GUILayoutOption>()); GUI.SetNextControlName("SpawnItemTextField"); spawnItemName = GUILayout.TextField(spawnItemName, 100, Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Spawn Item", Array.Empty<GUILayoutOption>())) { SpawnItem(spawnItemName); } GUILayout.EndArea(); isTextFieldFocused = GUI.GetNameOfFocusedControl() == "SpawnItemTextField"; } } private void SpawnItem(string searchName) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(searchName)) { Debug.LogWarning((object)"Item name is empty!"); return; } searchName = searchName.Trim(); Transform transform = ((Component)Camera.main).transform; Vector3 val = transform.position + transform.forward * 2f; Quaternion identity = Quaternion.identity; IReadOnlyList<Item> registeredItems = Items.RegisteredItems; IReadOnlyList<GameObject> registeredValuables = Valuables.RegisteredValuables; Item val2 = ((IEnumerable<Item>)registeredItems).FirstOrDefault((Func<Item, bool>)((Item go) => string.Equals(((Object)go).name, searchName, StringComparison.OrdinalIgnoreCase))); Vector3 val3; if ((Object)(object)val2 != (Object)null) { if (SemiFunc.IsMultiplayer()) { PhotonNetwork.InstantiateRoomObject("Items/" + ((Object)val2).name, val, identity, (byte)0, (object[])null); } else { Object.Instantiate<GameObject>(val2.prefab, val, identity); } string name = ((Object)val2).name; val3 = val; Debug.Log((object)("Spawned registered valuable: " + name + " at " + ((object)(Vector3)(ref val3)).ToString())); return; } GameObject val4 = ((IEnumerable<GameObject>)registeredValuables).FirstOrDefault((Func<GameObject, bool>)((GameObject go) => string.Equals(((Object)go).name, searchName, StringComparison.OrdinalIgnoreCase))); if ((Object)(object)val4 != (Object)null) { string valuablePrefabPath = ResourcesHelper.GetValuablePrefabPath(val4); if (SemiFunc.IsMultiplayer()) { PhotonNetwork.InstantiateRoomObject(valuablePrefabPath, val, identity, (byte)0, (object[])null); } else { Object.Instantiate<GameObject>(val4, val, identity); } string name2 = ((Object)val4).name; val3 = val; Debug.Log((object)("Spawned registered valuable: " + name2 + " at " + ((object)(Vector3)(ref val3)).ToString())); return; } Debug.Log((object)("Registered valuable not found; searching entire Resources folder for: " + searchName)); string foundPath; GameObject val5 = TryLoadValuablePrefab(searchName, out foundPath); if ((Object)(object)val5 != (Object)null) { if (SemiFunc.IsMultiplayer()) { PhotonNetwork.InstantiateRoomObject(foundPath, val, identity, (byte)0, (object[])null); } else { Object.Instantiate<GameObject>(val5, val, identity); } string name3 = ((Object)val5).name; val3 = val; Debug.Log((object)("Spawned prefab from Resources: " + name3 + " at " + ((object)(Vector3)(ref val3)).ToString())); } else { Debug.LogWarning((object)("No item or valuable found with name: " + searchName)); } } private GameObject TryLoadValuablePrefab(string searchName, out string foundPath) { foundPath = ""; string[] array = new string[7] { "01 Tiny", "02 Small", "03 Medium", "04 Big", "05 Wide", "06 Tall", "07 Very Tall" }; string[] array2 = array; foreach (string text in array2) { string text2 = "Valuables/" + text + "/" + searchName; GameObject val = Resources.Load<GameObject>(text2); if ((Object)(object)val != (Object)null) { foundPath = text2; return val; } } string text3 = "Items/Removed Items/" + searchName; GameObject val2 = Resources.Load<GameObject>(text3); if ((Object)(object)val2 != (Object)null) { foundPath = text3; return val2; } string text4 = "Items/" + searchName; GameObject val3 = Resources.Load<GameObject>(text4); if ((Object)(object)val3 != (Object)null) { foundPath = text4; return val3; } return null; } } [HarmonyPatch(typeof(ShopManager), "Awake")] public static class ShopManager_Awake_Patch { private static void Postfix(ShopManager __instance) { if ((Object)(object)((Component)__instance).gameObject.GetComponent<ShopManagerSpawnGUI>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<ShopManagerSpawnGUI>(); Debug.Log((object)"ShopManagerSpawnGUI added via Harmony patch."); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ItemSpawner"; public const string PLUGIN_NAME = "ItemSpawner"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }