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 MoreShopItems Updated v4.3.2
MoreShopItems.dll
Decompiled 6 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using MoreShopItems.Compatability; using MoreShopItems.Config; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MoreShopItems")] [assembly: AssemblyDescription("More Shop Items Mod for R.E.P.O.! Developed by Jettcodey.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Jettcodey")] [assembly: AssemblyProduct("MoreShopItems")] [assembly: AssemblyCopyright("Copyright © Jettcodey 2025")] [assembly: ComVisible(false)] [assembly: Guid("06e696a8-2012-4835-8692-3e535b4feaba")] [assembly: AssemblyFileVersion("4.3.2")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.3.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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; } } [CompilerGenerated] [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 MoreShopItems { [BepInPlugin("Jettcodey.MoreShopItems", "More Shop Items", "4.3.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static GameObject CustomItemShelf; private readonly Harmony _harmony = new Harmony("Jettcodey.MoreShopItems"); internal Dictionary<string, ConfigEntry<int>> intConfigEntries = new Dictionary<string, ConfigEntry<int>>(); internal Dictionary<string, ConfigEntry<bool>> boolConfigEntries = new Dictionary<string, ConfigEntry<bool>>(); internal static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } private void Awake() { Instance = this; ((Component)this).gameObject.AddComponent<MoreShopItemsSplash>(); Logger = ((BaseUnityPlugin)this).Logger; LoadConfig(); AssetBundle bundle = LoadAssetBundle("moreshopitems_assets.file"); GameObject val = LoadAssetFromBundle(bundle, "custom_soda_shelf"); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"Failed to load CustomItemShelf from asset bundle."); return; } CustomItemShelf = val; _harmony.PatchAll(typeof(ShopManagerPatch)); _harmony.PatchAll(typeof(StatsManagerPatch)); _harmony.PatchAll(typeof(PunManagerPatch)); _harmony.PatchAll(typeof(PlayerControllerPatch)); _harmony.PatchAll(typeof(RunManagerPatch)); Logger.LogInfo((object)"Plugin More Shop Items v4.3.2 loaded successfully."); } private AssetBundle? LoadAssetBundle(string filename) { string path = Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location) ?? ""; string text = Path.Combine(path, filename); if (!File.Exists(text)) { Logger.LogError((object)("Asset bundle not found at " + text)); return null; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Logger.LogError((object)("Failed to load asset bundle from " + text)); } return val; } private GameObject? LoadAssetFromBundle(AssetBundle? bundle, string assetName) { if ((Object)(object)bundle == (Object)null) { return null; } GameObject val = bundle.LoadAsset<GameObject>(assetName); if ((Object)(object)val == (Object)null) { Logger.LogError((object)("Asset '" + assetName + "' not found in bundle.")); } return val; } private void LoadConfig() { string[] configDescriptions = ConfigEntries.GetConfigDescriptions(); intConfigEntries.Add("Max Upgrades In Shop", ConfigHelper.CreateConfig("Upgrades", "Max Upgrades In Shop", 5, configDescriptions[0], -1, 50)); intConfigEntries.Add("Max Upgrade Purchase Amount", ConfigHelper.CreateConfig("Upgrades", "Max Upgrade Purchase Amount", 0, configDescriptions[1], 0, 70)); intConfigEntries.Add("Max Melee Weapons In Shop", ConfigHelper.CreateConfig("Weapons", "Max Melee Weapons In Shop", 5, configDescriptions[2], -1, 25)); intConfigEntries.Add("Max Melee Weapon Purchase Amount", ConfigHelper.CreateConfig("Weapons", "Max Melee Weapon Purchase Amount", 0, configDescriptions[3], 0, 20)); intConfigEntries.Add("Max Guns In Shop", ConfigHelper.CreateConfig("Weapons", "Max Guns In Shop", 5, configDescriptions[4], -1, 20)); intConfigEntries.Add("Max Gun Purchase Amount", ConfigHelper.CreateConfig("Weapons", "Max Gun Purchase Amount", 0, configDescriptions[5], 0, 20)); intConfigEntries.Add("Max Grenades In Shop", ConfigHelper.CreateConfig("Weapons", "Max Grenades In Shop", 5, configDescriptions[6], -1, 20)); intConfigEntries.Add("Max Grenade Purchase Amount", ConfigHelper.CreateConfig("Weapons", "Max Grenade Purchase Amount", 0, configDescriptions[7], 0, 20)); intConfigEntries.Add("Max Mines In Shop", ConfigHelper.CreateConfig("Weapons", "Max Mines In Shop", 5, configDescriptions[8], -1, 20)); intConfigEntries.Add("Max Mine Purchase Amount", ConfigHelper.CreateConfig("Weapons", "Max Mine Purchase Amount", 0, configDescriptions[9], 0, 20)); intConfigEntries.Add("Max Health-Packs In Shop", ConfigHelper.CreateConfig("Health-Packs", "Max Health-Packs In Shop", 15, configDescriptions[10], -1, 40)); intConfigEntries.Add("Max Health-Pack Purchase Amount", ConfigHelper.CreateConfig("Health-Packs", "Max Health-Pack Purchase Amount", 0, configDescriptions[11], 0, 20)); intConfigEntries.Add("Max Drones In Shop", ConfigHelper.CreateConfig("Utilities", "Max Drones In Shop", 5, configDescriptions[12], -1, 20)); intConfigEntries.Add("Max Drone Purchase Amount", ConfigHelper.CreateConfig("Utilities", "Max Drone Purchase Amount", 0, configDescriptions[13], 0, 20)); intConfigEntries.Add("Max Orbs In Shop", ConfigHelper.CreateConfig("Utilities", "Max Orbs In Shop", 5, configDescriptions[14], -1, 20)); intConfigEntries.Add("Max Orb Purchase Amount", ConfigHelper.CreateConfig("Utilities", "Max Orb Purchase Amount", 0, configDescriptions[15], 0, 20)); intConfigEntries.Add("Max Crystals In Shop", ConfigHelper.CreateConfig("Utilities", "Max Crystals In Shop", 10, configDescriptions[16], -1, 20)); intConfigEntries.Add("Max Crystal Purchase Amount", ConfigHelper.CreateConfig("Utilities", "Max Crystal Purchase Amount", 0, configDescriptions[17], 0, 20)); intConfigEntries.Add("Max Trackers In Shop", ConfigHelper.CreateConfig("Utilities", "Max Trackers In Shop", 5, configDescriptions[18], -1, 20)); intConfigEntries.Add("Max Tracker Purchase Amount", ConfigHelper.CreateConfig("Utilities", "Max Tracker Purchase Amount", 0, configDescriptions[19], 0, 20)); intConfigEntries.Add("Max Carts In Shop", ConfigHelper.CreateConfig("Carts", "Max Carts In Shop", 2, configDescriptions[24], -1, 4)); intConfigEntries.Add("Max Cart Purchase Amount", ConfigHelper.CreateConfig("Carts", "Max Cart Purchase Amount", 0, configDescriptions[25], 0, 20)); intConfigEntries.Add("Max Pocket Carts In Shop", ConfigHelper.CreateConfig("Carts", "Max Pocket Carts In Shop", 2, configDescriptions[26], -1, 4)); intConfigEntries.Add("Max Pocket Cart Purchase Amount", ConfigHelper.CreateConfig("Carts", "Max Pocket Cart Purchase Amount", 0, configDescriptions[27], 0, 20)); intConfigEntries.Add("Max Tools In Shop", ConfigHelper.CreateConfig("Tools", "Max Tools In Shop", 2, configDescriptions[28], -1, 20)); intConfigEntries.Add("Max Tool Purchase Amount", ConfigHelper.CreateConfig("Tools", "Max Tool Purchase Amount", 0, configDescriptions[29], 0, 20)); intConfigEntries.Add("Max Additional Shelves In Shop", ConfigHelper.CreateConfig("General", "Max Additional Shelves In Shop", 2, configDescriptions[23], 0, 2)); intConfigEntries.Add("Max Launchers in Shop", ConfigHelper.CreateConfig("Launchers", "Max Launchers In Shop", 5, configDescriptions[31], -1, 20)); intConfigEntries.Add("Max Launcher Purchase Amount", ConfigHelper.CreateConfig("Launchers", "Max Launcher Purchase Amount", 0, configDescriptions[32], 0, 20)); intConfigEntries.Add("Max Vehicles in Shop", ConfigHelper.CreateConfig("Vehicles", "Max Vehicles In Shop", 2, configDescriptions[33], -1, 5)); intConfigEntries.Add("Max Vehicle Purchase Amount", ConfigHelper.CreateConfig("Vehicles", "Max Vehicle Purchase Amount", 0, configDescriptions[34], 0, 20)); boolConfigEntries.Add("Override Modded Items", ConfigHelper.CreateConfig("General", "Override Modded Items", value: true, configDescriptions[20])); boolConfigEntries.Add("Override Single-Use Upgrades", ConfigHelper.CreateConfig("General", "Override Single-Use Upgrades", value: false, configDescriptions[21])); boolConfigEntries.Add("Spawn Additional Shelving", ConfigHelper.CreateConfig("General", "Spawn Additional Shelving", value: true, configDescriptions[22])); boolConfigEntries.Add("Item Spawn Logs", ConfigHelper.CreateConfig("Dev General", "Item Spawn Logs", value: false, configDescriptions[30])); } } public class MoreShopItemsSplash : MonoBehaviour { public static bool LockSplash = false; private Harmony? _harmony; private static readonly string[] IncompatibleGuids = new string[14] { "Traktool.SharedUpgrades", "Empress.SharedUpgradesCompat", "Omniscye.SharedUpgradesHelper", "Janson.BaddiesTeamUpgrades", "EvilCheetah.REPO.TeamBoosters", "Rosay.EchoholdAPI", "Rosay.PlasmaGunAPI", "empress.repo.echoholdcompatpatch", "Empress.Plasma_Rifle.WeaponCompatPatch", "DarkSpider90.MoreStandsForShops", "agentf.GlasVitrineRegal", "zichen.shopplus", "ricketywrecked.repo.fixesplus", "nakeem.SharedUpgradesFix" }; private bool hasConflict; private string conflictList = ""; private bool overlayActive; private GameObject? overlay; private float savedTimeScale = 1f; private bool wasCursorVisible; private CursorLockMode savedLockMode = (CursorLockMode)1; private void Awake() { Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private void Start() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown string[] array = IncompatibleGuids.Where((string guid) => Chainloader.PluginInfos.ContainsKey(guid)).ToArray(); hasConflict = array.Length != 0; if (!hasConflict) { Object.Destroy((Object)(object)this); return; } conflictList = string.Join(", ", array); Plugin.Logger.LogInfo((object)("Incompatible plugin(s) detected: " + conflictList + ".")); _harmony = new Harmony("MoreShopItems.SplashBlock"); _harmony.PatchAll(typeof(MoreShopItemsSplash)); LockSplash = true; } private void Update() { if (hasConflict && !overlayActive) { SplashScreenUI instance = SplashScreenUI.instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.warningTransform != (Object)null && ((Component)instance.warningTransform).gameObject.activeInHierarchy) { ShowOverlay(); } } } private void ShowOverlay() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0067: Expected O, but got Unknown //IL_00ae: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Expected O, but got Unknown //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Expected O, but got Unknown LockSplash = true; overlayActive = true; savedTimeScale = Time.timeScale; wasCursorVisible = Cursor.visible; savedLockMode = Cursor.lockState; Time.timeScale = 0f; Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; overlay = new GameObject("MoreShopItems_IncompatibilityOverlay", new Type[1] { typeof(RectTransform) }); Object.DontDestroyOnLoad((Object)(object)overlay); Canvas val = overlay.AddComponent<Canvas>(); val.renderMode = (RenderMode)0; val.sortingOrder = 10000; CanvasScaler val2 = overlay.AddComponent<CanvasScaler>(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.matchWidthOrHeight = 0.5f; overlay.AddComponent<GraphicRaycaster>(); GameObject val3 = NewRect("Background", overlay.transform); ((Graphic)val3.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.85f); SetAnchors(val3, Vector2.zero, Vector2.one); GameObject val4 = NewRect("Panel", overlay.transform); ((Graphic)val4.AddComponent<Image>()).color = new Color(0.51f, 0.1f, 0.1f, 0.95f); SetAnchors(val4, new Vector2(0.1f, 0.1f), new Vector2(0.9f, 0.85f)); GameObject val5 = NewLabel("Title", 38, (FontStyle)1, val4.transform); SetAnchors(val5, new Vector2(0.05f, 0.86f), new Vector2(0.95f, 0.97f)); val5.GetComponent<Text>().text = "MoreShopItems Mod Conflict Detected!\nPLEASE READ CAREFULLY\n"; GameObject val6 = NewLabel("Message", 28, (FontStyle)0, val4.transform); SetAnchors(val6, new Vector2(0.05f, 0.38f), new Vector2(0.95f, 0.86f)); Text component = val6.GetComponent<Text>(); component.alignment = (TextAnchor)1; component.horizontalOverflow = (HorizontalWrapMode)0; component.verticalOverflow = (VerticalWrapMode)1; component.text = "Conflicting mods: " + conflictList + "\n\nUsing these mods alongside MoreShopItems will cause severe issues like:\n- Infinite loading screens\n- Upgrades failing to apply or unexpectedly disappearing\n- Corrupted save files and game crashes\n- General game instability\n\nYou MUST disable / uninstall the conflicting mods listed to use MoreShopItems without issues.\n\nRecommended alternative shared upgrade mods:\n- SharedUpgradesPlus by Vippy\n- BetterTeamUpgrades by MrByteSized\n\nChoose how you want to proceed:"; GameObject val7 = NewRect("Buttons", val4.transform); SetAnchors(val7, new Vector2(0.05f, 0.08f), new Vector2(0.95f, 0.26f)); Button val8 = NewButton("DisableMoreShopItems", "Disable MoreShopItems", val7.transform); Button val9 = NewButton("QuitGame", "Quit Game", val7.transform); SetAnchors(((Component)val8).gameObject, new Vector2(0.02f, 0.1f), new Vector2(0.32f, 0.9f)); SetAnchors(((Component)val9).gameObject, new Vector2(0.68f, 0.1f), new Vector2(0.98f, 0.9f)); ((UnityEvent)val8.onClick).AddListener((UnityAction)delegate { Plugin.Logger.LogWarning((object)"User chose to disable MoreShopItems due to incompatibility."); DisablePlugin(); CloseOverlay(); }); ((UnityEvent)val9.onClick).AddListener((UnityAction)delegate { Plugin.Logger.LogWarning((object)"User chose to quit because of incompatibility."); CloseOverlay(); Application.Quit(); }); } private void DisablePlugin() { Harmony.UnpatchID("Jettcodey.MoreShopItems"); if ((Object)(object)Plugin.Instance != (Object)null) { Object.Destroy((Object)(object)Plugin.Instance); } } private void CloseOverlay() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) LockSplash = false; if ((Object)(object)overlay != (Object)null) { Object.Destroy((Object)(object)overlay); overlay = null; } Time.timeScale = savedTimeScale; Cursor.visible = wasCursorVisible; Cursor.lockState = savedLockMode; Object.Destroy((Object)(object)this); } private static void SetAnchors(GameObject obj, Vector2 min, Vector2 max) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) RectTransform component = obj.GetComponent<RectTransform>(); component.anchorMin = min; component.anchorMax = max; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } private GameObject NewRect(string name, Transform parent) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); return val; } private GameObject NewLabel(string name, int fontSize, FontStyle style, Transform parent) { //IL_0029: 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) GameObject val = NewRect(name, parent); Text val2 = val.AddComponent<Text>(); val2.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); val2.fontSize = fontSize; val2.fontStyle = style; ((Graphic)val2).color = Color.white; val2.alignment = (TextAnchor)4; return val; } private Button NewButton(string name, string label, Transform parent) { //IL_0023: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) GameObject val = NewRect(name, parent); ((Graphic)val.AddComponent<Image>()).color = new Color(0.22f, 0.22f, 0.22f, 0.95f); Button val2 = val.AddComponent<Button>(); ColorBlock colors = ((Selectable)val2).colors; ((ColorBlock)(ref colors)).normalColor = new Color(0.22f, 0.22f, 0.22f, 0.95f); ((ColorBlock)(ref colors)).highlightedColor = new Color(0.12f, 0.12f, 0.12f, 0.95f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.17f, 0.17f, 0.17f, 0.95f); ((ColorBlock)(ref colors)).selectedColor = ((ColorBlock)(ref colors)).highlightedColor; ((Selectable)val2).colors = colors; GameObject val3 = NewLabel("Label", 28, (FontStyle)0, val.transform); SetAnchors(val3, Vector2.zero, Vector2.one); val3.GetComponent<Text>().text = label; return val2; } [HarmonyPrefix] [HarmonyPatch(typeof(SplashScreen), "SkipLogic")] private static bool BlockSplashScreenSkip() { return !LockSplash; } private void LateUpdate() { if (overlayActive && (Object)(object)overlay != (Object)null && Input.GetKeyDown((KeyCode)27)) { Plugin.Logger.LogInfo((object)"Escape pressed (continue anyway), closing MoreShopItems incompatibility overlay."); CloseOverlay(); } } } public static class MultiplayerHandler { public const string ModCheckKey = "Jettcodey_MoreShopItems 4.3.2"; public static bool IsModEnabled() { if (!SemiFunc.IsMultiplayer()) { return true; } if (PhotonNetwork.CurrentRoom == null) { return false; } if (PhotonNetwork.IsMasterClient) { return true; } if (((Dictionary<object, object>)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"Jettcodey_MoreShopItems 4.3.2", out object value)) { return (bool)value; } return false; } public static void SetModActive() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0025: Expected O, but got Unknown if (PhotonNetwork.IsMasterClient && PhotonNetwork.CurrentRoom != null) { Hashtable val = new Hashtable(); ((Dictionary<object, object>)val).Add((object)"Jettcodey_MoreShopItems 4.3.2", (object)true); Hashtable val2 = val; PhotonNetwork.CurrentRoom.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null); Plugin.Logger.LogInfo((object)"Mod version 4.3.2 presence announced to room."); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Jettcodey.MoreShopItems"; public const string PLUGIN_NAME = "More Shop Items"; public const string PLUGIN_VERSION = "4.3.2"; } [HarmonyPatch(typeof(PunManager))] internal static class PunManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPostfix() { if (SemiFunc.IsMultiplayer() && PhotonNetwork.IsMasterClient) { MultiplayerHandler.SetModActive(); } } [HarmonyPrefix] [HarmonyPatch("TruckPopulateItemVolumes", new Type[] { typeof(List<ItemSpawn>) })] private static void RemoveNullValues() { if (!((Object)(object)ItemManager.instance == (Object)null) && (!SemiFunc.IsMultiplayer() || SemiFunc.IsMasterClient())) { ItemManager.instance.itemVolumes.RemoveAll((ItemVolume v) => (Object)(object)v == (Object)null); } } } [HarmonyPatch(typeof(PlayerController))] internal static class PlayerControllerPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePrefix() { if (SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClient()) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(ClientCheckRoutine()); } } public static IEnumerator ClientCheckRoutine() { for (int retries = 5; retries > 0; retries--) { if (MultiplayerHandler.IsModEnabled()) { Plugin.Logger.LogInfo((object)"Host Player has the Mod Enabled, Mod is active!"); yield break; } yield return (object)new WaitForSeconds(1.5f); } Plugin.Logger.LogWarning((object)"Host does NOT have the mod Enabled or is using a different Version, Mod is disabled! Client running on v4.3.2."); } } [HarmonyPatch(typeof(RunManager))] internal static class RunManagerPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePostfix(RunManager __instance) { if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<ShelfEventListener>())) { ((Component)__instance).gameObject.AddComponent<ShelfEventListener>(); Plugin.Logger.LogInfo((object)"ShelfEventListener created!"); } } } internal class ShelfEventListener : MonoBehaviourPunCallbacks, IOnEventCallback { private struct PendingShelf { public string shelfID; public Vector3 pos; public Quaternion rot; public ShelfSpawnConfig config; } private static readonly HashSet<string> spawnedShelves = new HashSet<string>(); private static readonly List<PendingShelf> pendingShelves = new List<PendingShelf>(); public override void OnJoinedRoom() { spawnedShelves.Clear(); pendingShelves.Clear(); Plugin.Logger.LogInfo((object)"OnJoinedRoom: cleared spawned shelf registry"); } public override void OnLeftRoom() { spawnedShelves.Clear(); pendingShelves.Clear(); Plugin.Logger.LogInfo((object)"OnLeftRoom: cleared spawned shelf registry"); } public void OnEvent(EventData photonEvent) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) if (photonEvent.Code != 155 || !(photonEvent.CustomData is object[] array) || array.Length < 4) { return; } string text = array[0] as string; Vector3 pos = (Vector3)array[1]; Quaternion rot = (Quaternion)array[2]; string configName = array[3] as string; if (string.IsNullOrEmpty(text) || spawnedShelves.Contains(text)) { return; } ShelfSpawnConfig shelfSpawnConfig = ShelfSpawnData.SpawnConfigs.Find((ShelfSpawnConfig c) => c.Name == configName); if (shelfSpawnConfig == null) { Plugin.Logger.LogWarning((object)("Unknown shelf '" + configName + "', host is probably on a different version.")); return; } GameObject val = GameObject.Find(shelfSpawnConfig.ModuleName); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)("Module " + shelfSpawnConfig.ModuleName + " not found. Queueing shelf '" + configName + "'.")); pendingShelves.Add(new PendingShelf { shelfID = text, pos = pos, rot = rot, config = shelfSpawnConfig }); } else { SpawnShelfInstance(text, pos, rot, val, shelfSpawnConfig); } } public static void ProcessPendingShelves() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < pendingShelves.Count; i++) { PendingShelf pendingShelf = pendingShelves[i]; GameObject val = GameObject.Find(pendingShelf.config.ModuleName); if ((Object)(object)val != (Object)null) { SpawnShelfInstance(pendingShelf.shelfID, pendingShelf.pos, pendingShelf.rot, val, pendingShelf.config); pendingShelves.RemoveAt(i); i--; } } } private static void SpawnShelfInstance(string shelfID, Vector3 pos, Quaternion rot, GameObject module, ShelfSpawnConfig config) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Transform val = (string.IsNullOrEmpty(config.ParentPath) ? module.transform : module.transform.Find(config.ParentPath)); GameObject val2 = Object.Instantiate<GameObject>(Plugin.CustomItemShelf, pos, rot, val); ((Object)val2).name = "MoreShopShelf_" + shelfID; spawnedShelves.Add(shelfID); Plugin.Logger.LogInfo((object)("Spawned shelf '" + config.Name + "' for client via event")); Transform val3 = ((config.FindAnchor != null) ? config.FindAnchor(module, val) : (string.IsNullOrEmpty(config.AnchorPath) ? val : val.Find(config.AnchorPath))); ShopManagerPatch.HidePlaceholder(config, val3); ShopManagerPatch.ProcessShelfProps(module, config); config.AfterSpawn?.Invoke(module, val, val3, val2); } } internal static class ShelfEvents { public const byte EV_SPAWN_SHELF = 155; public static void RaiseSpawnShelf(string shelfID, Vector3 pos, Quaternion rot, string configName) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0059: 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_0070: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsConnected || !PhotonNetwork.InRoom) { Plugin.Logger.LogWarning((object)("Not in room - cannot raise event for shelf '" + configName + "'")); return; } object[] array = new object[4] { shelfID, pos, rot, configName }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; SendOptions val2 = default(SendOptions); ((SendOptions)(ref val2)).Reliability = true; SendOptions val3 = val2; PhotonNetwork.RaiseEvent((byte)155, (object)array, val, val3); Plugin.Logger.LogInfo((object)("Master raised EV_SPAWN_SHELF for '" + configName + "'")); } } internal class ShelfSpawnConfig { public string Name; public string ModuleName; public string ParentPath; public string AnchorPath; public string NetworkPlaceholderOverride; public Vector3 TargetLocalPos; public Vector3 TargetRotEuler; public bool OffsetRelativeToParent = true; public bool RotateRelativeToParent = true; public string[] PropsToDisable; public string[] PartialPropsToDisable; public Dictionary<string, Vector3> PropsToMove; public Func<GameObject, bool> CanSpawn; public Func<GameObject, Transform, Transform> FindAnchor; public Func<Transform, Transform, Vector3> GetSpawnPos; public Action<GameObject, Transform, Transform, GameObject> AfterSpawn; } internal static class ShelfSpawnData { public static readonly List<ShelfSpawnConfig> SpawnConfigs = new List<ShelfSpawnConfig> { new ShelfSpawnConfig { Name = "Corner Stands Fridge", ModuleName = "Module - Shop - N - Corner Stands (Clone)", ParentPath = "WALLS/RIGHT/Not Connected", AnchorPath = "Shop prop fridge", TargetLocalPos = new Vector3(-1.0964f, 0f, 1.9264f), TargetRotEuler = Vector3.zero, PropsToDisable = new string[18] { "Shop prop fridge", "Paper3", "Broken Pile 2", "Shop Magazine Holder", "Museum café bottle 2", "Museum café bottle 5", "Museum café bottle 5 (1)", "Museum café bottle 6", "Shop Owner", "Shop Radio", "Candy Shelf", "Candy Shelf 2", "Shop prop tissues", "Shop prop coffee machine", "Shop prop cashiers shelf", "Shop Chair", "Trashcan Trash", "Trashcan Trash (1)" } }, new ShelfSpawnConfig { Name = "Middle Stands Fridge", ModuleName = "Module - Shop - N - Middle Stands (Clone)", ParentPath = "WALLS/RIGHT/Not Connected", AnchorPath = "Shop prop fridge", TargetLocalPos = new Vector3(-1.0964f, 0f, 1.9264f), TargetRotEuler = Vector3.zero, PropsToDisable = new string[22] { "Shop prop fridge", "Paper3", "Broken Pile 2", "Shop Magazine Holder", "Museum café bottle 2", "Museum café bottle 5", "Museum café bottle 5 (1)", "Museum café bottle 6", "Shop Owner", "Shop Radio", "Candy Shelf", "Candy Shelf 2", "Shop prop tissues", "Shop prop coffee machine", "Shop prop cashiers shelf", "Shop Chair", "Shop prop slush", "Shop prop ketchup", "Shop prop mustard", "Shop prop hotdog machine", "Trashcan Trash", "Trashcan Trash (1)" } }, new ShelfSpawnConfig { Name = "Attic Freezers", ModuleName = "Module - Shop - DE - Attic above diner (Clone)", ParentPath = "", FindAnchor = delegate(GameObject mod, Transform parent) { Transform obj = parent.Find("Shop Ice Cream Freezer (1)"); return (obj == null || !((Component)obj).gameObject.activeSelf) ? parent.Find("Shop Ice Cream Freezer") : parent.Find("Shop Ice Cream Freezer (1)"); }, TargetLocalPos = new Vector3(-0.2f, 0f, -1.2f), TargetRotEuler = new Vector3(0f, 180f, 0f), OffsetRelativeToParent = false, RotateRelativeToParent = false, PropsToDisable = new string[2] { "Shop Ice Cream Freezer", "Shop Ice Cream Freezer (1)" } }, new ShelfSpawnConfig { Name = "Dead End Valuable Shelf", ModuleName = "Module - Shop - N - Dead End (Clone)", ParentPath = "PROPS/ITEM STANDS", AnchorPath = "valuable shelf", TargetLocalPos = new Vector3(-1.4745f, 0f, -0.6385f), TargetRotEuler = Vector3.zero, OffsetRelativeToParent = false, RotateRelativeToParent = false, NetworkPlaceholderOverride = string.Empty }, new ShelfSpawnConfig { Name = "Corner Extract Cashier", ModuleName = "Module - Shop - N - Corner Extract (Clone)", ParentPath = "WALLS/LEFT/Not Connected", AnchorPath = "Shop prop cashiers shelf (1)", TargetLocalPos = new Vector3(-1.3f, 0f, -0.4f), TargetRotEuler = new Vector3(0f, 180f, 0f), OffsetRelativeToParent = false, RotateRelativeToParent = false, PropsToDisable = new string[6] { "Shop prop cashiers shelf (1)", "Shop cash register (2)", "Shop chair (1)", "Shop owner (1)", "Shop Magazine Holder - Empty (2)", "Cashiers desk (1)" } }, new ShelfSpawnConfig { Name = "Middle Stands Mag Top", ModuleName = "Module - Shop - N - Middle Stands (Clone)", ParentPath = "WALLS/TOP/Not Connected", AnchorPath = "Shop Magazine Stand (1)", TargetLocalPos = new Vector3(-3.5511f, 0f, -1.0483f), TargetRotEuler = new Vector3(0f, 270f, 0f), PropsToDisable = new string[1] { "Shop Magazine Stand (1)" } }, new ShelfSpawnConfig { Name = "Middle Stands Mag Right", ModuleName = "Module - Shop - N - Middle Stands (Clone)", ParentPath = "WALLS/RIGHT/Not Connected", AnchorPath = "Shop Magazine Stand (1)", TargetLocalPos = Vector3.zero, TargetRotEuler = Vector3.zero, OffsetRelativeToParent = false, RotateRelativeToParent = false, PropsToDisable = new string[1] { "Shop Magazine Stand (1)" } }, new ShelfSpawnConfig { Name = "Center Extract Cashier", ModuleName = "Module - Shop - N - Center Extract (Clone)", ParentPath = "WALLS/LEFT/Not Connected", AnchorPath = "Shop prop cashiers shelf (1)", TargetLocalPos = new Vector3(-1.3f, 0f, -0.4f), TargetRotEuler = Vector3.zero, OffsetRelativeToParent = false, RotateRelativeToParent = false, PropsToDisable = new string[6] { "Shop prop cashiers shelf (1)", "Shop cash register (2)", "Shop chair (1)", "Shop owner (1)", "Shop Magazine Holder - Empty (2)", "Cashiers desk (1)" } }, new ShelfSpawnConfig { Name = "Corner Stands Freezer Candy", ModuleName = "Module - Shop - N - Corner Stands (Clone)", ParentPath = "WALLS/BOT/Not Connected", AnchorPath = "Shop Ice Cream Freezer", TargetLocalPos = new Vector3(0f, 0f, -1f), TargetRotEuler = new Vector3(0f, 90f, 0f), OffsetRelativeToParent = false, RotateRelativeToParent = false, PropsToDisable = new string[3] { "Shop Ice Cream Freezer", "Candy Shelf 2", "Trashcan Trash" } }, new ShelfSpawnConfig { Name = "Middle Stands Candy CCTV", ModuleName = "Module - Shop - N - Middle Stands (Clone)", ParentPath = "PROPS", CanSpawn = delegate(GameObject mod) { Transform obj = mod.transform.Find("WALLS/LEFT/Not Connected"); return obj != null && ((Component)obj).gameObject.activeInHierarchy; }, FindAnchor = delegate(GameObject mod, Transform parent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) foreach (Transform item in parent) { Transform val = item; if (((Object)val).name == "Candy Shelf" && Vector3.Distance(val.localPosition, new Vector3(-6.954f, 0f, -4.356f)) < 0.1f) { return val; } } return (Transform)null; }, TargetLocalPos = new Vector3(-6.854f, 0f, -2.456f), TargetRotEuler = new Vector3(0f, 180f, 0f), RotateRelativeToParent = false, AfterSpawn = delegate(GameObject mod, Transform parent, Transform anchor, GameObject spawned) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0081: Unknown result type (might be due to invalid IL or missing references) ((Component)anchor).gameObject.SetActive(false); foreach (Transform item2 in parent) { Transform val = item2; if (((Object)val).name == "cctv" && Vector3.Distance(anchor.position, val.position) < 5f) { ((Component)val).gameObject.SetActive(false); } if (((Object)val).name == "Trashcan Trash" && Vector3.Distance(val.localPosition, new Vector3(-7.02f, 1.059f, -4.91f)) < 0.1f) { ((Component)val).gameObject.SetActive(false); } } } }, new ShelfSpawnConfig { Name = "Corner Stands Lamp Stand", ModuleName = "Module - Shop - N - Corner Stands (Clone)", ParentPath = "WALLS/TOP/Not Connected", FindAnchor = (GameObject mod, Transform parent) => mod.transform.Find("LIGHTS/shop prop lamp2"), CanSpawn = delegate(GameObject mod) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Transform val = mod.transform.Find("ITEM STANDS/valuable shelf"); return (Object)(object)val != (Object)null && Vector3.Distance(val.localPosition, new Vector3(-4.453f, 0f, 7.317f)) < 0.1f; }, TargetLocalPos = new Vector3(0.906f, 0f, -1.166f), TargetRotEuler = new Vector3(0f, 270f, 0f), AfterSpawn = delegate(GameObject mod, Transform parent, Transform anchor, GameObject spawned) { //IL_002a: 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_0067: Expected O, but got Unknown //IL_007a: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) Transform val = mod.transform.Find("Shop Shopkeeper WIP/buttontest"); if ((Object)(object)val != (Object)null) { val.localPosition = new Vector3(2.6378f, -4.759f, -1.2556f); } Transform val2 = mod.transform.Find("PROPS"); if ((Object)(object)val2 == (Object)null) { return; } foreach (Transform item3 in val2) { Transform val3 = item3; if (((Object)val3).name == "Cardboard box (1)" && Vector3.Distance(val3.localPosition, new Vector3(4.398f, 0.736f, 6.909f)) < 0.1f) { ((Component)val3).gameObject.SetActive(false); } else if (((Object)val3).name == "Magazine Single" && Vector3.Distance(val3.localPosition, new Vector3(3.9729f, 1.466f, 2.3937f)) < 0.1f) { ((Component)val3).gameObject.SetActive(false); } else if (((Object)val3).name == "shop sign megaball" && Vector3.Distance(val3.localPosition, new Vector3(4.294f, 0.862f, 2.186f)) < 0.1f) { ((Component)val3).gameObject.SetActive(false); } else if (((Object)val3).name == "Cardboard box" && Vector3.Distance(val3.localPosition, new Vector3(4.398f, 0.274f, 6.909f)) < 0.1f) { ((Component)val3).gameObject.SetActive(false); } else if (((Object)val3).name == "shop sign app" && Vector3.Distance(val3.localPosition, new Vector3(3.938f, 0.864f, 5.259f)) < 0.1f) { ((Component)val3).gameObject.SetActive(false); } else if (((Object)val3).name == "Shop Cash register") { val3.localPosition = new Vector3(4.697f, 1.465f, 5.174f); } else if (((Object)val3).name == "cashiers desk") { val3.localPosition = new Vector3(5.0666f, 0f, 4.79f); } } } }, new ShelfSpawnConfig { Name = "Center Extract Soda Shelf", ModuleName = "Module - Shop - N - Center Extract (Clone)", ParentPath = "WALLS/BOT/Not Connected", AnchorPath = "Soda Shelf", TargetLocalPos = new Vector3(-3.882f, 0.045f, -6.7374f), TargetRotEuler = Vector3.zero, RotateRelativeToParent = false, PropsToDisable = new string[1] { "Soda Shelf" }, AfterSpawn = delegate(GameObject mod, Transform parent, Transform anchor, GameObject spawned) { Transform obj = mod.transform.Find("Shop Magazine Stand"); if (obj != null) { ((Component)obj).gameObject.SetActive(false); } } }, new ShelfSpawnConfig { Name = "Center Extract Valuable Upgrade", ModuleName = "Module - Shop - N - Center Extract (Clone)", ParentPath = "ITEM STANDS", AnchorPath = "valuable shelf", CanSpawn = delegate(GameObject mod) { //IL_006b: 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) if ((Object)(object)GameObject.Find("Module - Shop - DE - Bunker (Clone)") != (Object)null) { return false; } Transform val = mod.transform.Find("WALLS/TOP/Not Connected"); if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy || (Object)(object)val.Find("Window Shop (1)") == (Object)null) { return false; } Transform val2 = mod.transform.Find("ITEM STANDS/Upgrade Stand"); return (Object)(object)val2 == (Object)null || Vector3.Distance(val2.localPosition, new Vector3(-3.386f, 0.026f, 6.199f)) >= 0.01f; }, TargetLocalPos = Vector3.zero, TargetRotEuler = Vector3.zero, OffsetRelativeToParent = false, RotateRelativeToParent = false, PropsToDisable = new string[1] { "valuable shelf" }, AfterSpawn = delegate(GameObject mod, Transform parent, Transform anchor, GameObject spawned) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Transform obj = mod.transform.Find("PROPS/cashiers desk"); if (obj != null) { ((Component)obj).gameObject.SetActive(false); } Transform val = parent.Find("Upgrade Stand"); if ((Object)(object)val != (Object)null) { val.localPosition = new Vector3(-3.386f, 0.026f, 6.199f); val.localRotation = Quaternion.Euler(0f, 135f, 0f); } } }, new ShelfSpawnConfig { Name = "Center Extract Item Volume Cleanup", ModuleName = "Module - Shop - N - Center Extract (Clone)", ParentPath = "ITEM STANDS", AnchorPath = "valuable shelf (1)", CanSpawn = delegate(GameObject mod) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) Transform val = mod.transform.Find("WALLS/LEFT/Not Connected"); if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy || (Object)(object)val.Find("Window Shop (2)") == (Object)null) { return false; } Transform val2 = mod.transform.Find("ITEM STANDS/Upgrade Stand"); return (Object)(object)val2 == (Object)null || Vector3.Distance(val2.localPosition, new Vector3(-3.386f, 0.026f, 6.199f)) >= 0.01f; }, TargetLocalPos = new Vector3(-4.677f, 0f, -4.766f), TargetRotEuler = new Vector3(0f, 135f, 0f), PropsToDisable = new string[2] { "valuable shelf (1)", "valuable shelf short (1)" }, AfterSpawn = delegate(GameObject mod, Transform parent, Transform anchor, GameObject spawned) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0099: 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_00a9: 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_00be: 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_00e7: Unknown result type (might be due to invalid IL or missing references) Transform val = parent.Find("valuable shelf short (1)"); Transform[] componentsInChildren = ((Component)parent).GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren) { if (((Object)val2).name.Contains("Item Volume")) { bool flag = (Object)(object)anchor != (Object)null && Vector2.Distance(new Vector2(val2.position.x, val2.position.z), new Vector2(anchor.position.x, anchor.position.z)) < 0.5f; bool flag2 = (Object)(object)val != (Object)null && Vector2.Distance(new Vector2(val2.position.x, val2.position.z), new Vector2(val.position.x, val.position.z)) < 0.5f; if ((flag || flag2) && val2.position.y >= parent.position.y) { Object.DestroyImmediate((Object)(object)((Component)val2).gameObject); } } } } }, new ShelfSpawnConfig { Name = "Car Service Fuel", ModuleName = "Module - Shop - DE - Car Service (Clone)", ParentPath = "", FindAnchor = delegate(GameObject mod, Transform parent) { Transform[] componentsInChildren = mod.GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name.Contains("shop product fuel can (1)")) { return val; } } return (Transform)null; }, GetSpawnPos = (Transform parent, Transform anchor) => parent.TransformPoint(new Vector3(anchor.localPosition.x, 0f, anchor.localPosition.z)), TargetRotEuler = new Vector3(0f, 270f, 0f), PartialPropsToDisable = new string[8] { "Museum Storage Shelf", "Museum Storage Wall Machine", "Barrel (", "Gas Container", "shop product C red", "shop product car fluid", "shop product fuel can", "shop product wiper fluid" } }, new ShelfSpawnConfig { Name = "Corner Stands Freezer 1", ModuleName = "Module - Shop - N - Corner Stands (Clone)", ParentPath = "WALLS/LEFT/Not Connected", AnchorPath = "Shop Ice Cream Freezer (1)", TargetLocalPos = new Vector3(-0.3f, 0f, 0.1f), TargetRotEuler = new Vector3(0f, 180f, 0f), OffsetRelativeToParent = false, RotateRelativeToParent = false, PropsToDisable = new string[1] { "Shop Ice Cream Freezer (1)" }, AfterSpawn = delegate(GameObject mod, Transform parent, Transform anchor, GameObject spawned) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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) Transform val = mod.transform.Find("LIGHTS"); if ((Object)(object)val != (Object)null) { foreach (Transform item4 in val) { Transform val2 = item4; if (((Object)val2).name == "shop prop lamp2 (1)" && Vector3.Distance(val2.localPosition, new Vector3(-5.111f, 4f, 1.475f)) < 0.1f) { ((Component)val2).gameObject.SetActive(false); } } } Transform val3 = mod.transform.Find("PROPS"); if ((Object)(object)val3 != (Object)null) { foreach (Transform item5 in val3) { Transform val4 = item5; if (((Object)val4).name == "shop prop cable thin" && Vector3.Distance(val4.localPosition, new Vector3(-5.318f, 3.99f, -0.044f)) < 0.1f) { ((Component)val4).gameObject.SetActive(false); } } } } }, new ShelfSpawnConfig { Name = "Diner Counter", ModuleName = "Module - Shop - DE - Diner (Clone)", ParentPath = "", AnchorPath = "", NetworkPlaceholderOverride = "Diner Counter Shelf", TargetLocalPos = new Vector3(-1.86f, 0f, 2.435f), TargetRotEuler = new Vector3(0f, 180f, 0f), PropsToMove = new Dictionary<string, Vector3> { { "cashiers desk (2)", new Vector3(-0.82f, 0f, -3.764f) }, { "Shop Chair (3)", new Vector3(0.537f, 0f, -5.176f) }, { "Shop Chair (2)", new Vector3(0.546f, 0f, -3.802f) }, { "Shop Chair (1)", new Vector3(0.623f, 0f, -2.446f) } }, PartialPropsToDisable = new string[10] { "Plate", "Ceramic Cup", "Cardboard box", "Shop prop hotdog machine", "Coffee Maker", "Shop prop coffee machine", "Beer Bottle", "Short Metal Cup", "Tall Metal Cup", "cashiers desk (1)" } }, new ShelfSpawnConfig { Name = "Bunker Soda", ModuleName = "Module - Shop - DE - Bunker (Clone)", ParentPath = "", AnchorPath = "Soda Shelf", TargetLocalPos = new Vector3(0.11f, 0f, 1.421f), TargetRotEuler = Vector3.zero, OffsetRelativeToParent = false, RotateRelativeToParent = false, PropsToDisable = new string[1] { "Soda Shelf" } }, new ShelfSpawnConfig { Name = "Corner Extract Fridge", ModuleName = "Module - Shop - N - Corner Extract (Clone)", ParentPath = "WALLS/BOT/Not Connected", AnchorPath = "Shop prop fridge", TargetLocalPos = Vector3.zero, TargetRotEuler = new Vector3(0f, 180f, 0f), OffsetRelativeToParent = false, RotateRelativeToParent = false, PropsToDisable = new string[1] { "Shop prop fridge" } }, new ShelfSpawnConfig { Name = "Middle Stands Soda", ModuleName = "Module - Shop - N - Middle Stands (Clone)", ParentPath = "WALLS/BOT/Not Connected", AnchorPath = "", NetworkPlaceholderOverride = string.Empty, TargetLocalPos = new Vector3(-3.882f, 0.045f, -6.7374f), TargetRotEuler = new Vector3(0f, 90f, 0f), RotateRelativeToParent = false, PropsToDisable = new string[1] { "Soda Shelf" }, AfterSpawn = delegate(GameObject mod, Transform parent, Transform anchor, GameObject spawned) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) Transform val = mod.transform.Find("PROPS"); if ((Object)(object)val == (Object)null) { return; } foreach (Transform item6 in val) { Transform val2 = item6; if (((Object)val2).name == "Candy Shelf" && Vector3.Distance(val2.localPosition, new Vector3(-6.954f, 0f, -4.356f)) < 0.05f) { ((Component)val2).gameObject.SetActive(false); } else if (((Object)val2).name == "Trashcan Trash" && Vector3.Distance(val2.localPosition, new Vector3(-7.02f, 1.059f, -4.91f)) < 0.05f) { ((Component)val2).gameObject.SetActive(false); } } } }, new ShelfSpawnConfig { Name = "Center Extract Plant", ModuleName = "Module - Shop - N - Center Extract (Clone)", ParentPath = "WALLS/RIGHT/Not Connected", FindAnchor = (GameObject mod, Transform parent) => mod.transform.Find("WALLS/BOT/Connected/Plant 01"), TargetLocalPos = new Vector3(-1.0064f, 0f, -0.66f), TargetRotEuler = Vector3.zero, PropsToDisable = new string[8] { "Shop prop mustard", "Shop prop ketchup", "Shop prop slush", "Shop prop tissues", "Paper3", "Broken Pile 2", "Shop prop hotdog machine", "Museum café bottle 2" }, AfterSpawn = delegate(GameObject mod, Transform parent, Transform anchor, GameObject spawned) { Transform obj = parent.Find("Shop prop cashiers shelf (1)"); if (obj != null) { ((Component)obj).gameObject.SetActive(false); } Transform obj2 = parent.Find("cashiers desk (1)"); if (obj2 != null) { ((Component)obj2).gameObject.SetActive(false); } Transform obj3 = parent.Find("Shop Magazine Holder"); if (obj3 != null) { ((Component)obj3).gameObject.SetActive(false); } } } }; } [HarmonyPatch(typeof(ShopManager))] internal static class ShopManagerPatch { internal static class ShelfSpawner { public static GameObject Spawn(Vector3 pos, Quaternion rot, Transform parentTransform, string configName) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) string text = Guid.NewGuid().ToString("N"); GameObject val = Object.Instantiate<GameObject>(Plugin.CustomItemShelf, pos, rot, parentTransform); ((Object)val).name = "MoreShopShelf_" + text; ShelfEvents.RaiseSpawnShelf(text, pos, rot, configName); return val; } } private static int originalCurrency; private static void SetItemValues(Item item, int maxInShop, int maxPurchaseAmount) { item.maxAmountInShop = maxInShop; item.maxAmount = maxInShop; item.maxPurchase = maxPurchaseAmount > 0; item.maxPurchaseAmount = maxPurchaseAmount; if (Plugin.Instance.boolConfigEntries["Item Spawn Logs"].Value) { Plugin.Logger.LogInfo((object)$"Set values for {((Object)item).name}: maxInShop={maxInShop}, maxPurchase={item.maxPurchase}, maxPurchaseAmount={maxPurchaseAmount}"); } } [HarmonyPrefix] [HarmonyPatch("ShopInitialize", new Type[] { typeof(List<ItemSpawn>) })] private static void AdjustItems() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Invalid comparison between Unknown and I4 if (!SemiFunc.RunIsShop() || (Object)(object)StatsManager.instance == (Object)null || (!SemiFunc.IsMasterClient() && SemiFunc.IsMultiplayer())) { return; } Dictionary<string, ConfigEntry<int>> intConfigEntries = Plugin.Instance.intConfigEntries; Dictionary<string, ConfigEntry<bool>> boolConfigEntries = Plugin.Instance.boolConfigEntries; Plugin.Logger.LogInfo((object)("Override modded items = " + boolConfigEntries["Override Modded Items"].Value)); foreach (Item value4 in StatsManager.instance.itemDictionary.Values) { if (!ItemConfigMapper.Map.TryGetValue(value4.itemType, out (string, string, int) value)) { continue; } int value2 = intConfigEntries[value.Item1].Value; int value3 = intConfigEntries[value.Item2].Value; if (value2 == -1) { continue; } value2 += value.Item3; bool flag = (int)value4.itemType == 3; if (boolConfigEntries["Override Modded Items"].Value) { if (!flag || boolConfigEntries["Override Single-Use Upgrades"].Value || !value4.maxPurchase) { SetItemValues(value4, value2, value3); } } else if (((!ModCompat.IsMoreUpgradesLoaded() && !ModCompat.IsNikkisUpgradesLoaded()) || !((Object)value4).name.Contains("Modded")) && !(ModCompat.IsVanillaUpgradesLoaded() && flag) && (!flag || boolConfigEntries["Override Single-Use Upgrades"].Value || !value4.maxPurchase)) { SetItemValues(value4, value2, value3); } } } [HarmonyPrefix] [HarmonyPatch("GetAllItemsFromStatsManager")] private static void SpoofCurrency(ShopManager __instance) { originalCurrency = __instance.totalCurrency; __instance.totalCurrency = 999999; } [HarmonyPostfix] [HarmonyPatch("GetAllItemsFromStatsManager")] private static void FixSpawnCounts(ShopManager __instance) { __instance.totalCurrency = originalCurrency; CleanList(__instance.potentialItems); CleanList(__instance.potentialItemConsumables); CleanList(__instance.potentialItemUpgrades); CleanList(__instance.potentialItemHealthPacks); if (__instance.potentialSecretItems != null) { foreach (List<Item> value in __instance.potentialSecretItems.Values) { CleanList(value); } } __instance.itemConsumablesAmount = __instance.potentialItemConsumables.Count; __instance.itemUpgradesAmount = __instance.potentialItemUpgrades.Count; __instance.itemHealthPacksAmount = __instance.potentialItemHealthPacks.Count; __instance.itemSpawnTargetAmount = __instance.potentialItems.Count; if (Plugin.Instance.boolConfigEntries["Item Spawn Logs"].Value) { Plugin.Logger.LogInfo((object)$"Pool Generation Complete. Price-check bypassed. Targets: Consumables({__instance.itemConsumablesAmount}) Health({__instance.itemHealthPacksAmount})"); } static void CleanList(List<Item> list) { list?.RemoveAll((Item item) => (Object)(object)item != (Object)null && item.disabled); } } [HarmonyPrefix] [HarmonyPatch("ShopInitialize", new Type[] { typeof(List<ItemSpawn>) })] private static void SpawnShelf() { //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.RunIsShop() || !Plugin.Instance.boolConfigEntries["Spawn Additional Shelving"].Value) { return; } if (SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClient()) { ShelfEventListener.ProcessPendingShelves(); return; } int value = Plugin.Instance.intConfigEntries["Max Additional Shelves In Shop"].Value; if (value <= 0) { return; } int num = 0; foreach (ShelfSpawnConfig spawnConfig in ShelfSpawnData.SpawnConfigs) { if (num >= value) { break; } GameObject val = GameObject.Find(spawnConfig.ModuleName); if ((Object)(object)val == (Object)null || (spawnConfig.CanSpawn != null && !spawnConfig.CanSpawn(val))) { continue; } Transform val2 = (string.IsNullOrEmpty(spawnConfig.ParentPath) ? val.transform : val.transform.Find(spawnConfig.ParentPath)); if ((Object)(object)val2 == (Object)null || (!string.IsNullOrEmpty(spawnConfig.ParentPath) && !((Component)val2).gameObject.activeInHierarchy)) { continue; } Transform val3 = ((spawnConfig.FindAnchor != null) ? spawnConfig.FindAnchor(val, val2) : (string.IsNullOrEmpty(spawnConfig.AnchorPath) ? val2 : val2.Find(spawnConfig.AnchorPath))); if ((Object)(object)val3 == (Object)null) { continue; } bool flag = !string.IsNullOrEmpty(spawnConfig.AnchorPath) || spawnConfig.FindAnchor != null; if (flag && !((Component)val3).gameObject.activeInHierarchy) { continue; } if (!flag && (spawnConfig.PropsToDisable != null || spawnConfig.PartialPropsToDisable != null)) { bool flag2 = false; Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform child in array) { if (((Component)child).gameObject.activeInHierarchy) { if (spawnConfig.PropsToDisable != null && Array.Exists(spawnConfig.PropsToDisable, (string n) => n == ((Object)child).name)) { flag2 = true; } if (spawnConfig.PartialPropsToDisable != null && Array.Exists(spawnConfig.PartialPropsToDisable, (string n) => ((Object)child).name.Contains(n))) { flag2 = true; } } } if (!flag2) { continue; } } Vector3 val4 = ((spawnConfig.GetSpawnPos != null) ? spawnConfig.GetSpawnPos(val2, val3) : (spawnConfig.OffsetRelativeToParent ? val2 : val3).TransformPoint(spawnConfig.TargetLocalPos)); Quaternion val5 = (spawnConfig.RotateRelativeToParent ? val2.rotation : val3.rotation) * Quaternion.Euler(spawnConfig.TargetRotEuler); GameObject val6 = null; if (SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClient()) { val6 = ShelfSpawner.Spawn(val4, val5, val2, spawnConfig.Name); } else if (!SemiFunc.IsMultiplayer()) { val6 = Object.Instantiate<GameObject>(Plugin.CustomItemShelf, val4, val5, val2); } if ((Object)(object)val6 != (Object)null) { HidePlaceholder(spawnConfig, val3); ProcessShelfProps(val, spawnConfig); spawnConfig.AfterSpawn?.Invoke(val, val2, val3, val6); num++; } } if (num > 0) { Plugin.Logger.LogInfo((object)$"Successfully spawned {num} custom shelf/shelves!"); } } internal static void HidePlaceholder(ShelfSpawnConfig config, Transform anchorNode) { if (config.NetworkPlaceholderOverride == null) { ((Component)anchorNode).gameObject.SetActive(false); } else if (config.NetworkPlaceholderOverride != string.Empty) { GameObject obj = GameObject.Find(config.NetworkPlaceholderOverride); if (obj != null) { obj.SetActive(false); } } } internal static void ProcessShelfProps(GameObject module, ShelfSpawnConfig config) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (config.PropsToDisable == null && config.PartialPropsToDisable == null && config.PropsToMove == null) { return; } Transform[] componentsInChildren = module.GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform child in array) { if ((config.PropsToDisable != null && Array.Exists(config.PropsToDisable, (string n) => n == ((Object)child).name)) || (config.PartialPropsToDisable != null && Array.Exists(config.PartialPropsToDisable, (string n) => ((Object)child).name.Contains(n)))) { ((Component)child).gameObject.SetActive(false); } if (config.PropsToMove != null && config.PropsToMove.TryGetValue(((Object)child).name, out var value)) { child.localPosition = value; } } } [HarmonyPostfix] [HarmonyPatch("GetAllItemVolumesInScene")] private static void LogPotentialItems(ShopManager __instance) { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.Instance.boolConfigEntries["Item Spawn Logs"].Value || (Object)(object)__instance == (Object)null) { return; } Plugin.Logger.LogInfo((object)"Shop Initialization"); LogItemCollection(__instance.potentialItems, "Standard Items"); LogItemCollection(__instance.potentialItemUpgrades, "Upgrade Items"); LogItemCollection(__instance.potentialItemConsumables, "Consumables"); LogItemCollection(__instance.potentialItemHealthPacks, "Health Packs"); if (__instance.potentialSecretItems.Count > 0) { Plugin.Logger.LogInfo((object)$"Found {__instance.potentialSecretItems.Count} potential Secret Items (grouped):"); { foreach (KeyValuePair<itemSecretShopType, List<Item>> potentialSecretItem in __instance.potentialSecretItems) { Plugin.Logger.LogInfo((object)$" Category: {potentialSecretItem.Key}"); LogItemCollection(potentialSecretItem.Value, "", nested: true); } return; } } Plugin.Logger.LogInfo((object)"No potential Secret Items found."); } private static void LogItemCollection(List<Item> items, string collectionName, bool nested = false) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (items != null && items.Count > 0) { if (!string.IsNullOrEmpty(collectionName)) { Plugin.Logger.LogInfo((object)$"Found {items.Count} potential {collectionName}:"); } int num = 0; foreach (Item item in items) { if (item.itemName != null && item.itemName.Length > num) { num = item.itemName.Length; } } num += 3; { foreach (Item item2 in items) { string arg = (nested ? " - " : " - "); Plugin.Logger.LogInfo((object)$"{arg}Name: {item2.itemName.PadRight(num)}Type: {item2.itemType}"); } return; } } if (!string.IsNullOrEmpty(collectionName)) { Plugin.Logger.LogInfo((object)("No potential " + collectionName + " found.")); } } } internal class StatsManagerPatch { private static readonly Dictionary<int, int> instancePrices = new Dictionary<int, int>(); private static readonly Dictionary<string, Queue<int>> itemInstanceIds = new Dictionary<string, Queue<int>>(); [HarmonyPrefix] [HarmonyPatch(typeof(StatsManager), "ItemPurchase")] private static bool RefundExtraItem(string itemName) { if (!StatsManager.instance.itemDictionary.TryGetValue(itemName, out var value)) { return true; } if (!value.maxPurchase || value.maxPurchaseAmount <= 0) { return true; } StatsManager.instance.itemsPurchasedTotal.TryGetValue(itemName, out var value2); if (value2 < value.maxPurchaseAmount) { return true; } int value3 = 0; if (itemInstanceIds.TryGetValue(itemName, out Queue<int> value4) && value4.Count > 0) { int key = value4.Dequeue(); if (value4.Count == 0) { itemInstanceIds.Remove(itemName); } if (instancePrices.TryGetValue(key, out value3)) { instancePrices.Remove(key); } } if (value3 <= 0) { Plugin.Logger.LogError((object)("NO PRICE FOUND for " + itemName + "! Tracking failed.")); return false; } if (StatsManager.instance.runStats.TryGetValue("currency", out var value5)) { int num = value5 + value3; StatsManager.instance.runStats["currency"] = num; Plugin.Logger.LogInfo((object)$"Refunded: {itemName} limit reached. Refunded {value3} currency ({value5} -> {num})"); if (GameManager.Multiplayer() && PhotonNetwork.IsMasterClient) { PunManager.instance.SetRunStatSet("currency", num); } } return false; } [HarmonyPostfix] [HarmonyPatch(typeof(ShopManager), "ShoppingListItemAdd")] private static void AdItemToShopList(ItemAttributes item) { if (!((Object)(object)item == (Object)null) && !((Object)(object)item.item == (Object)null)) { string name = ((Object)item.item).name; int instanceID = ((Object)item).GetInstanceID(); instancePrices[instanceID] = item.value; if (!itemInstanceIds.TryGetValue(name, out Queue<int> value)) { value = new Queue<int>(); itemInstanceIds[name] = value; } value.Enqueue(instanceID); Plugin.Logger.LogInfo((object)$"Added to cart: {name} instance {instanceID} for {item.value} (total instances: {value.Count})"); } } [HarmonyPostfix] [HarmonyPatch(typeof(ShopManager), "ShoppingListItemRemove")] private static void RemoveItemFromShopList(ItemAttributes item) { if ((Object)(object)item == (Object)null || (Object)(object)item.item == (Object)null) { return; } string name = ((Object)item.item).name; int instanceID = ((Object)item).GetInstanceID(); if (instancePrices.Remove(instanceID)) { Plugin.Logger.LogInfo((object)$"Removed instance {instanceID} from price tracking"); } if (!itemInstanceIds.TryGetValue(name, out Queue<int> value)) { return; } Queue<int> queue = new Queue<int>(value); itemInstanceIds[name] = new Queue<int>(); foreach (int item2 in queue) { if (item2 != instanceID) { itemInstanceIds[name].Enqueue(item2); } } if (itemInstanceIds[name].Count == 0) { itemInstanceIds.Remove(name); } Plugin.Logger.LogInfo((object)$"Removed from cart: {name} instance {instanceID}"); } [HarmonyPostfix] [HarmonyPatch(typeof(StatsManager), "ItemPurchase")] private static void DetetItemPurchased(string itemName, bool __runOriginal) { if (!__runOriginal) { return; } if (itemInstanceIds.TryGetValue(itemName, out Queue<int> value) && value.Count > 0) { int num = value.Dequeue(); if (instancePrices.TryGetValue(num, out var value2)) { instancePrices.Remove(num); Plugin.Logger.LogInfo((object)$"Successful purchase: {itemName} instance {num} for {value2}."); } if (value.Count == 0) { itemInstanceIds.Remove(itemName); } } if (StatsManager.instance.itemDictionary.TryGetValue(itemName, out var value3)) { StatsManager.instance.itemsPurchasedTotal.TryGetValue(itemName, out var value4); Plugin.Logger.LogInfo((object)$"{itemName}: {value4}/{value3.maxPurchaseAmount}"); } } } } namespace MoreShopItems.Editor { public class NoLightSourcesVolume : MonoBehaviour { public Vector3 boxSize = new Vector3(1f, 1f, 1f); public Vector3 centerOffset = Vector3.zero; public LayerMask itemLayer = LayerMask.op_Implicit(-1); public float checkInterval = 0.25f; private readonly Dictionary<GameObject, List<GameObject>> disabledLights = new Dictionary<GameObject, List<GameObject>>(); private float timer; private void Update() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) timer += Time.deltaTime; if (timer < checkInterval) { return; } timer = 0f; Vector3 val = ((Component)this).transform.position + ((Component)this).transform.rotation * centerOffset; HashSet<GameObject> inside = new HashSet<GameObject>(); Collider[] array = Physics.OverlapBox(val, boxSize / 2f, ((Component)this).transform.rotation, LayerMask.op_Implicit(itemLayer)); foreach (Collider val2 in array) { ItemAttributes componentInParent = ((Component)val2).GetComponentInParent<ItemAttributes>(); if ((Object)(object)componentInParent == (Object)null || !inside.Add(((Component)componentInParent).gameObject)) { continue; } if (!disabledLights.TryGetValue(((Component)componentInParent).gameObject, out List<GameObject> value)) { value = FindLights(((Component)componentInParent).transform); disabledLights[((Component)componentInParent).gameObject] = value; } foreach (GameObject item in value) { item.SetActive(false); } } foreach (GameObject item2 in disabledLights.Keys.Where((GameObject key) => (Object)(object)key == (Object)null || !inside.Contains(key)).ToList()) { foreach (GameObject item3 in disabledLights[item2]) { if ((Object)(object)item3 != (Object)null) { item3.SetActive(true); } } disabledLights.Remove(item2); } } private static List<GameObject> FindLights(Transform root) { List<GameObject> list = new List<GameObject>(); Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "Item Light" || ((Object)val).name == "Light - Small Lamp" || ((Object)val).name == "Light") { list.Add(((Component)val).gameObject); } } return list; } private void OnDrawGizmos() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //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_0021: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_004a: 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) Gizmos.matrix = Matrix4x4.TRS(((Component)this).transform.position + ((Component)this).transform.rotation * centerOffset, ((Component)this).transform.rotation, Vector3.one); Gizmos.color = Color.cyan; Gizmos.DrawWireCube(Vector3.zero, boxSize); } } } namespace MoreShopItems.Config { public static class ConfigEntries { private static readonly string[] DESCRIPTIONS = new string[36] { "How many of each upgrade to spawn in the shop.", "How many upgrades you can purchase total. Set 0 to disable", "How many of each melee weapon to spawn in the shop.", "How many melee weapons you can purchase total. Set 0 to disable", "How many of each gun to spawn in the shop.", "How many guns you can purchase total. Set 0 to disable", "How many of each grenade to spawn in the shop.", "How many grenades you can purchase total. Set 0 to disable", "How many of each mine to spawn in the shop.", "How many mines you can purchase total. Set 0 to disable", "How many of each health-pack to spawn in the shop.", "How many health-packs you can purchase total. Set 0 to disable", "How many of each drone to spawn in the shop.", "How many drones you can purchase total. Set 0 to disable", "How many of each orb to spawn in the shop.", "How many orbs you can purchase total. Set 0 to disable", "How many of each crystal to spawn in the shop.", "How many crystals you can purchase total. Set 0 to disable", "How many trackers to spawn in the shop.", "How many trackers you can purchase total. Set 0 to disable", "Overrides the values (MaxAmountInShop, MaxPurchaseAmount) set by other item/upgrade mods.", "Overrides the values (MaxAmountInShop, MaxPurchaseAmount) of single-use upgrades.", "Spawns the additional shelving into the shop (set false to disable the shelf spawning).", "How many additional shelving units to spawn in the shop. Set 0 to disable.", "How many Carts to spawn in the shop.", "How many Carts you can purchase total. Set 0 to disable", "How many Pocket Carts to spawn in the shop.", "How many Pocket Carts you can purchase total. Set 0 to disable", "How many Tools to spawn in the shop.", "How many Tools you can purchase total. Set 0 to disable", "Enable logging of the potential items Spawning in the shop.", "How many Launchers to spawn in the shop.", "How many Launchers you can purchase total. Set 0 to disable", "How many Vehicles to spawn in the shop.", "How many Vehicles you can purchase total. Set 0 to disable", "The accidental feature™. No description because it's an accident." }; public static string[] GetConfigDescriptions() { return DESCRIPTIONS; } } public static class ConfigHelper { public static ConfigEntry<bool> CreateConfig(string section, string name, bool value, string description) { return ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>(section, name, value, description); } public static ConfigEntry<int> CreateConfig(string section, string name, int value, string description, int min, int max) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown return ((BaseUnityPlugin)Plugin.Instance).Config.Bind<int>(section, name, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>(min, max), Array.Empty<object>())); } } public static class ItemConfigMapper { public static readonly Dictionary<itemType, (string shopKey, string purchaseKey, int offset)> Map = new Dictionary<itemType, (string, string, int)> { { (itemType)0, ("Max Drones In Shop", "Max Drone Purchase Amount", 0) }, { (itemType)1, ("Max Orbs In Shop", "Max Orb Purchase Amount", 0) }, { (itemType)3, ("Max Upgrades In Shop", "Max Upgrade Purchase Amount", 0) }, { (itemType)5, ("Max Crystals In Shop", "Max Crystal Purchase Amount", 1) }, { (itemType)6, ("Max Grenades In Shop", "Max Grenade Purchase Amount", 0) }, { (itemType)7, ("Max Melee Weapons In Shop", "Max Melee Weapon Purchase Amount", 0) }, { (itemType)8, ("Max Health-Packs In Shop", "Max Health-Pack Purchase Amount", 0) }, { (itemType)9, ("Max Guns In Shop", "Max Gun Purchase Amount", 0) }, { (itemType)10, ("Max Trackers In Shop", "Max Tracker Purchase Amount", 0) }, { (itemType)11, ("Max Mines In Shop", "Max Mine Purchase Amount", 0) }, { (itemType)2, ("Max Carts In Shop", "Max Cart Purchase Amount", 0) }, { (itemType)12, ("Max Pocket Carts In Shop", "Max Pocket Cart Purchase Amount", 0) }, { (itemType)13, ("Max Tools In Shop", "Max Tool Purchase Amount", 0) }, { (itemType)15, ("Max Launchers in Shop", "Max Launcher Purchase Amount", 0) }, { (itemType)14, ("Max Vehicles in Shop", "Max Vehicle Purchase Amount", 0) } }; } } namespace MoreShopItems.Compatability { internal static class ModCompat { public static bool IsMoreUpgradesLoaded() { return Chainloader.PluginInfos.ContainsKey("bulletbot.moreupgrades"); } public static bool IsNikkisUpgradesLoaded() { return Chainloader.PluginInfos.ContainsKey("NikkiUpgrades"); } public static bool IsVanillaUpgradesLoaded() { return Chainloader.PluginInfos.ContainsKey("bulletbot.vanillaupgrades"); } } }