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.2.2
MoreShopItems.dll
Decompiled a week 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 System.Threading.Tasks; 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.SceneManagement; 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.2.2")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.2.2.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 MoreShopItems { [BepInPlugin("Jettcodey.MoreShopItems", "More Shop Items", "4.2.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(); SceneManager.sceneLoaded += OnFirstScene; AssetBundle bundle = LoadAssetBundle("moreshopitems_assets.file"); CustomItemShelf = LoadAssetFromBundle(bundle, "custom_soda_shelf"); if ((Object)(object)CustomItemShelf == (Object)null) { Logger.LogError((object)"Failed to load CustomItemShelf from asset bundle."); return; } _harmony.PatchAll(typeof(ShopManagerPatch)); _harmony.PatchAll(typeof(StatsManagerPatch)); _harmony.PatchAll(typeof(PunManagerPatch)); _harmony.PatchAll(typeof(PlayerControllerPatch)); Logger.LogInfo((object)"Plugin More Shop Items v4.2.2 loaded successfully."); } private void OnFirstScene(Scene scene, LoadSceneMode mode) { ShelfEventListener.Ensure(); SceneManager.sceneLoaded -= OnFirstScene; } private AssetBundle LoadAssetBundle(string filename) { Plugin? instance = Instance; string path = Path.GetDirectoryName((instance != null) ? ((BaseUnityPlugin)instance).Info.Location : null) ?? ""; 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], -1, -1)); boolConfigEntries.Add("Override Single-Use Upgrades", ConfigHelper.CreateConfig("General", "Override Single-Use Upgrades", value: false, configDescriptions[21], -1, -1)); boolConfigEntries.Add("Spawn Additional Shelving", ConfigHelper.CreateConfig("General", "Spawn Additional Shelving", value: true, configDescriptions[22], -1, -1)); boolConfigEntries.Add("Item Spawn Logs", ConfigHelper.CreateConfig("Dev General", "Item Spawn Logs", value: false, configDescriptions[30], -1, -1)); } } public class MoreShopItemsSplash : MonoBehaviour { public static bool LockSplash = false; private Harmony _harmony; private static readonly string[] IncompatibleGuids = new string[11] { "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" }; private bool hasConflict; 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown hasConflict = IncompatibleGuids.Any((string guid) => Chainloader.PluginInfos.ContainsKey(guid)); if (!hasConflict) { Object.Destroy((Object)(object)this); return; } Plugin.Logger.LogInfo((object)("Incompatible plugin(s) detected: " + string.Join(", ", IncompatibleGuids.Where((string guid) => Chainloader.PluginInfos.ContainsKey(guid))) + ".")); _harmony = new Harmony("MoreShopItems.SplashBlock"); _harmony.PatchAll(typeof(SplashScreen)); LockSplash = true; } private void Update() { if (!hasConflict || overlayActive) { return; } try { SplashScreenUI instance = SplashScreenUI.instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.warningTransform != (Object)null && ((Component)instance.warningTransform).gameObject.activeInHierarchy) { ShowOverlay(); } } catch (Exception ex) { Plugin.Logger.LogError((object)("MoreShopItemsSplash Update error: " + ex)); Object.Destroy((Object)(object)this); } } 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: 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_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Expected O, but got Unknown //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: 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); RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; GameObject val4 = NewRect("Panel", overlay.transform); ((Graphic)val4.AddComponent<Image>()).color = new Color(0.51f, 0.1f, 0.1f, 0.95f); RectTransform component2 = val4.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0.1f, 0.1f); component2.anchorMax = new Vector2(0.9f, 0.85f); component2.pivot = new Vector2(0.5f, 0.5f); component2.anchoredPosition = Vector2.zero; component2.sizeDelta = Vector2.zero; ((Transform)component2).localScale = Vector3.one; GameObject val5 = NewLabel("Title", 38, (FontStyle)1, val4.transform); RectTransform component3 = val5.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0.05f, 0.86f); component3.anchorMax = new Vector2(0.95f, 0.97f); component3.offsetMin = Vector2.zero; component3.offsetMax = Vector2.zero; Text component4 = val5.GetComponent<Text>(); component4.alignment = (TextAnchor)4; component4.text = "MoreShopItems Mod Conflict Detected!\nPLEASE READ CAREFULLY"; GameObject val6 = NewLabel("Message", 28, (FontStyle)0, val4.transform); RectTransform component5 = val6.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0.05f, 0.38f); component5.anchorMax = new Vector2(0.95f, 0.86f); component5.offsetMin = Vector2.zero; component5.offsetMax = Vector2.zero; Text component6 = val6.GetComponent<Text>(); component6.alignment = (TextAnchor)1; component6.horizontalOverflow = (HorizontalWrapMode)0; component6.verticalOverflow = (VerticalWrapMode)1; component6.text = "Detected installed mod(s): " + string.Join(", ", IncompatibleGuids.Where((string guid) => Chainloader.PluginInfos.ContainsKey(guid))) + "\n\nUsing these mods together with MoreShopItems CAN and WILL cause serious issues, including:\n- Getting stuck on the loading screen\n- Player upgrades not applying correctly or disappearing\n- Unpredictable Game behavior and Game instability\n- Corrupted Save files and Game crashes\n\nYou MUST disable / uninstall the listed mods above to use MoreShopItems without issues!\nRecommended Shared Upgrades mods to use with MoreShopItems instead:\n- BetterTeamUpgrades by MrByteSized\n- SharedUpgradesPlus by Vippy\n\nChoose how you want to proceed:"; GameObject val7 = NewRect("Buttons", val4.transform); RectTransform component7 = val7.GetComponent<RectTransform>(); component7.anchorMin = new Vector2(0.05f, 0.08f); component7.anchorMax = new Vector2(0.95f, 0.26f); component7.offsetMin = Vector2.zero; component7.offsetMax = Vector2.zero; ((Transform)component7).localScale = Vector3.one; Button val8 = NewButton("DisableMoreShopItems", val7.transform); Button val9 = NewButton("QuitGame", val7.transform); RectTransform component8 = ((Component)val8).GetComponent<RectTransform>(); RectTransform component9 = ((Component)val9).GetComponent<RectTransform>(); component8.anchorMin = new Vector2(0.02f, 0.1f); component8.anchorMax = new Vector2(0.32f, 0.9f); component8.offsetMin = Vector2.zero; component8.offsetMax = Vector2.zero; component9.anchorMin = new Vector2(0.68f, 0.1f); component9.anchorMax = new Vector2(0.98f, 0.9f); component9.offsetMin = Vector2.zero; component9.offsetMax = Vector2.zero; ((Component)val8).GetComponentInChildren<Text>().text = "Disable MoreShopItems"; ((Component)val9).GetComponentInChildren<Text>().text = "Quit Game"; ((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() { try { Harmony.UnpatchID("MoreShopItems"); } catch (Exception ex) { Plugin.Logger.LogError((object)("Error while unpatching Harmony patches: " + ex)); } try { if ((Object)(object)Plugin.Instance != (Object)null) { Object.Destroy((Object)(object)Plugin.Instance); Plugin.Logger.LogInfo((object)"Plugin component destroyed."); } else { Plugin.Logger.LogWarning((object)"Plugin instance was null when attempting to disable."); } } catch (Exception ex2) { Plugin.Logger.LogError((object)("Error while destroying plugin instance: " + ex2)); } } 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 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 //IL_002d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); ((Transform)val.GetComponent<RectTransform>()).localScale = Vector3.one; 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) //IL_0051: 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; val.GetComponent<RectTransform>().sizeDelta = new Vector2(600f, 40f); return val; } private Button NewButton(string name, Transform parent) { //IL_0023: 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) //IL_0041: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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>(); ((Selectable)val2).transition = (Transition)1; 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; ((ColorBlock)(ref colors)).disabledColor = new Color(0.12f, 0.12f, 0.12f, 0.5f); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.08f; ((Selectable)val2).colors = colors; val.GetComponent<RectTransform>().sizeDelta = new Vector2(200f, 56f); GameObject val3 = NewLabel("Label", 28, (FontStyle)0, val.transform); RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; return val2; } private void OnDestroy() { if (Time.timeScale == 0f) { Time.timeScale = 1f; } Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } [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.2.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.2.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.2.2", (object)true); Hashtable val2 = val; PhotonNetwork.CurrentRoom.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null); Plugin.Logger.LogInfo((object)"Mod version 4.2.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.2.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")] 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 { [CompilerGenerated] private sealed class <ClientCheckRoutine>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private int <retries>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ClientCheckRoutine>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <retries>5__2 = 5; break; case 1: <>1__state = -1; <retries>5__2--; break; } if (<retries>5__2 > 0) { if (MultiplayerHandler.IsModEnabled()) { Plugin.Logger.LogInfo((object)"Host Player has the Mod Enabled, Mod is active!"); return false; } <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 1; return true; } Plugin.Logger.LogWarning((object)"Host does NOT have the mod Enabled or is using a different Version, Mod is disabled! Client running on v4.2.2."); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePrefix() { if (SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClient()) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(ClientCheckRoutine()); } } [IteratorStateMachine(typeof(<ClientCheckRoutine>d__1))] public static IEnumerator ClientCheckRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ClientCheckRoutine>d__1(0); } } internal class ShelfEventListener : MonoBehaviourPunCallbacks, IOnEventCallback { private struct PendingShelf { public string shelfID; public Vector3 pos; public Quaternion rot; public string parentName; public string placeholder; public string configName; } private static bool _created; private static readonly HashSet<string> spawnedShelves = new HashSet<string>(); private static readonly List<PendingShelf> pendingShelves = new List<PendingShelf>(); public static void Ensure() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (!_created) { _created = true; GameObject val = new GameObject("MoreShopItems_ShelfEventListener"); Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent<ShelfEventListener>(); Plugin.Logger.LogInfo((object)"ShelfEventListener created!"); } } private void OnEnable() { PhotonNetwork.AddCallbackTarget((object)this); } private void OnDisable() { PhotonNetwork.RemoveCallbackTarget((object)this); } public override void OnJoinedRoom() { spawnedShelves.Clear(); pendingShelves.Clear(); Plugin.Logger.LogInfo((object)"[ShelfEventListener] OnJoinedRoom: cleared spawned shelf registry"); } public override void OnLeftRoom() { spawnedShelves.Clear(); pendingShelves.Clear(); Plugin.Logger.LogInfo((object)"[ShelfEventListener] OnLeftRoom: cleared spawned shelf registry"); } public void OnEvent(EventData photonEvent) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0113: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) if (photonEvent.Code != 155 || !(photonEvent.CustomData is object[] array) || array.Length < 6) { return; } string text = array[0] as string; Vector3 pos = (Vector3)array[1]; Quaternion rot = (Quaternion)array[2]; string text2 = array[3] as string; string placeholder = array[4] as string; string text3 = array[5] as string; if (!string.IsNullOrEmpty(text) && !spawnedShelves.Contains(text)) { GameObject obj = GameObject.Find(text2); Transform val = ((obj != null) ? obj.transform : null); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)("[ShelfEventListener] Parent " + text2 + " not found. Queueing shelf '" + text3 + "'.")); pendingShelves.Add(new PendingShelf { shelfID = text, pos = pos, rot = rot, parentName = text2, placeholder = placeholder, configName = text3 }); } else { SpawnShelfInstance(text, pos, rot, val, text3); } } } public static void ProcessPendingShelves() { //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) for (int num = pendingShelves.Count - 1; num >= 0; num--) { PendingShelf pendingShelf = pendingShelves[num]; GameObject obj = GameObject.Find(pendingShelf.parentName); Transform val = ((obj != null) ? obj.transform : null); if ((Object)(object)val != (Object)null) { SpawnShelfInstance(pendingShelf.shelfID, pendingShelf.pos, pendingShelf.rot, val, pendingShelf.configName); pendingShelves.RemoveAt(num); } } } private static void SpawnShelfInstance(string shelfID, Vector3 pos, Quaternion rot, Transform parent, string configName) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate<GameObject>(Plugin.CustomItemShelf, pos, rot, parent); spawnedShelves.Add(shelfID); Plugin.Logger.LogInfo((object)("[ShelfEventListener] Spawned shelf '" + configName + "' for client via event")); } } internal static class ShelfEvents { public const byte EV_SPAWN_SHELF = 155; public static void RaiseSpawnShelf(string shelfID, Vector3 pos, Quaternion rot, string parentName, string placeholder, string configName) { //IL_0036: 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_0055: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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) if (!PhotonNetwork.IsConnected || !PhotonNetwork.InRoom) { Plugin.Logger.LogWarning((object)("[ShelfEvents] Not in room - cannot raise event for shelf '" + configName + "'")); return; } object[] array = new object[6] { shelfID, pos, rot, parentName, placeholder, 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)("[ShelfEvents] 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[] RequiredActiveProps; public string[] PropsToDisable; public string[] PartialPropsToDisable; public Dictionary<string, Vector3> PropsToMove; public Func<GameObject, bool> CustomValidation; public Func<GameObject, Transform, Transform> CustomAnchorFinder; public Func<Transform, Transform, Vector3> CustomPosCalculator; public Action<GameObject, Transform, Transform, GameObject> CustomPostSpawnAction; } 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 = "", CustomAnchorFinder = delegate(GameObject mod, Transform parent) { Transform obj4 = parent.Find("Shop Ice Cream Freezer (1)"); return (obj4 == null || !((Component)obj4).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", RequiredActiveProps = new string[5] { "valuable shelf", "battery upgrade stand", "health stand", "revive stand", "upgrade stand" }, 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)", RequiredActiveProps = 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)" }, 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)", RequiredActiveProps = new string[5] { "Floor 01 (12)", "Window Shop", "shop sign megaball", "shop sign tyre", "shop sign boltzap" }, 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)", RequiredActiveProps = new string[5] { "Floor 01 (12)", "Window Shop", "shop sign megaball", "shop sign tyre", "shop sign boltzap" }, 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)", RequiredActiveProps = 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)" }, 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", CustomValidation = delegate(GameObject mod) { Transform obj3 = mod.transform.Find("WALLS/LEFT/Not Connected"); return obj3 != null && ((Component)obj3).gameObject.activeInHierarchy; }, CustomAnchorFinder = 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 val20 = item; if (((Object)val20).name == "Candy Shelf" && Vector3.Distance(val20.localPosition, new Vector3(-6.954f, 0f, -4.356f)) < 0.1f) { return val20; } } return null; }, TargetLocalPos = new Vector3(-6.854f, 0f, -2.456f), TargetRotEuler = new Vector3(0f, 180f, 0f), RotateRelativeToParent = false, CustomPostSpawnAction = 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 val19 = item2; if (((Object)val19).name == "cctv" && Vector3.Distance(anchor.position, val19.position) < 5f) { ((Component)val19).gameObject.SetActive(false); } if (((Object)val19).name == "Trashcan Trash" && Vector3.Distance(val19.localPosition, new Vector3(-7.02f, 1.059f, -4.91f)) < 0.1f) { ((Component)val19).gameObject.SetActive(false); } } } }, new ShelfSpawnConfig { Name = "Corner Stands Lamp Stand", ModuleName = "Module - Shop - N - Corner Stands(Clone)", ParentPath = "WALLS/TOP/Not Connected", CustomAnchorFinder = (GameObject mod, Transform parent) => mod.transform.Find("LIGHTS/shop prop lamp2"), CustomValidation = delegate(GameObject mod) { //IL_002a: 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_0063: Unknown result type (might be due to invalid IL or missing references) Transform val17 = mod.transform.Find("Shop Shopkeeper WIP/buttontest"); if ((Object)(object)val17 != (Object)null) { val17.localPosition = new Vector3(2.6378f, -4.759f, -1.2556f); } Transform val18 = mod.transform.Find("ITEM STANDS/valuable shelf"); return (Object)(object)val18 != (Object)null && Vector3.Distance(val18.localPosition, new Vector3(-4.453f, 0f, 7.317f)) < 0.1f; }, TargetLocalPos = new Vector3(0.906f, 0f, -1.166f), TargetRotEuler = new Vector3(0f, 270f, 0f), CustomPostSpawnAction = 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_008f: 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_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) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) Transform val15 = mod.transform.Find("PROPS"); if ((Object)(object)val15 == (Object)null) { return; } foreach (Transform item3 in val15) { Transform val16 = item3; if (((Object)val16).name == "Cardboard box (1)" && Vector3.Distance(val16.localPosition, new Vector3(4.398f, 0.736f, 6.909f)) < 0.1f) { ((Component)val16).gameObject.SetActive(false); } else if (((Object)val16).name == "Cardboard box" && Vector3.Distance(val16.localPosition, new Vector3(4.398f, 0.274f, 6.909f)) < 0.1f) { ((Component)val16).gameObject.SetActive(false); } else if (((Object)val16).name == "shop sign app" && Vector3.Distance(val16.localPosition, new Vector3(3.938f, 0.864f, 5.259f)) < 0.1f) { ((Component)val16).gameObject.SetActive(false); } else if (((Object)val16).name == "Shop Cash register") { val16.localPosition = new Vector3(4.697f, 1.465f, 5.174f); } else if (((Object)val16).name == "cashiers desk") { val16.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" }, CustomPostSpawnAction = delegate(GameObject mod, Transform parent, Transform anchor, GameObject spawned) { Transform obj2 = mod.transform.Find("Shop Magazine Stand"); if (obj2 != null) { ((Component)obj2).gameObject.SetActive(false); } } }, new ShelfSpawnConfig { Name = "Center Extract Valuable Upgrade", ModuleName = "Module - Shop - N - Center Extract(Clone)", ParentPath = "ITEM STANDS", AnchorPath = "valuable shelf", CustomValidation = 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 val13 = mod.transform.Find("WALLS/TOP/Not Connected"); if ((Object)(object)val13 == (Object)null || !((Component)val13).gameObject.activeInHierarchy || (Object)(object)val13.Find("Window Shop (1)") == (Object)null) { return false; } Transform val14 = mod.transform.Find("ITEM STANDS/Upgrade Stand"); return (Object)(object)val14 == (Object)null || Vector3.Distance(val14.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" }, CustomPostSpawnAction = 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 val12 = parent.Find("Upgrade Stand"); if ((Object)(object)val12 != (Object)null) { val12.localPosition = new Vector3(-3.386f, 0.026f, 6.199f); val12.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)", CustomValidation = 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 val10 = mod.transform.Find("WALLS/LEFT/Not Connected"); if ((Object)(object)val10 == (Object)null || !((Component)val10).gameObject.activeInHierarchy || (Object)(object)val10.Find("Window Shop (2)") == (Object)null) { return false; } Transform val11 = mod.transform.Find("ITEM STANDS/Upgrade Stand"); return (Object)(object)val11 == (Object)null || Vector3.Distance(val11.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)" }, CustomPostSpawnAction = 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 val8 = parent.Find("valuable shelf short (1)"); Transform[] componentsInChildren2 = ((Component)parent).GetComponentsInChildren<Transform>(true); foreach (Transform val9 in componentsInChildren2) { if (((Object)val9).name.Contains("Item Volume")) { bool flag = (Object)(object)anchor != (Object)null && Vector2.Distance(new Vector2(val9.position.x, val9.position.z), new Vector2(anchor.position.x, anchor.position.z)) < 0.5f; bool flag2 = (Object)(object)val8 != (Object)null && Vector2.Distance(new Vector2(val9.position.x, val9.position.z), new Vector2(val8.position.x, val8.position.z)) < 0.5f; if ((flag || flag2) && val9.position.y >= parent.position.y) { Object.DestroyImmediate((Object)(object)((Component)val9).gameObject); } } } } }, new ShelfSpawnConfig { Name = "Car Service Fuel", ModuleName = "Module - Shop - DE - Car Service(Clone)", ParentPath = "", CustomAnchorFinder = delegate(GameObject mod, Transform parent) { Transform[] componentsInChildren = mod.GetComponentsInChildren<Transform>(true); foreach (Transform val7 in componentsInChildren) { if (((Object)val7).name.Contains("shop product fuel can (1)")) { return val7; } } return null; }, CustomPosCalculator = (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)" }, CustomPostSpawnAction = 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 val3 = mod.transform.Find("LIGHTS"); if ((Object)(object)val3 != (Object)null) { foreach (Transform item4 in val3) { Transform val4 = item4; if (((Object)val4).name == "shop prop lamp2 (1)" && Vector3.Distance(val4.localPosition, new Vector3(-5.111f, 4f, 1.475f)) < 0.1f) { ((Component)val4).gameObject.SetActive(false); } } } Transform val5 = mod.transform.Find("PROPS"); if ((Object)(object)val5 != (Object)null) { foreach (Transform item5 in val5) { Transform val6 = item5; if (((Object)val6).name == "shop prop cable thin" && Vector3.Distance(val6.localPosition, new Vector3(-5.318f, 3.99f, -0.044f)) < 0.1f) { ((Component)val6).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 = "Soda Shelf", TargetLocalPos = new Vector3(-3.882f, 0.045f, -6.7374f), TargetRotEuler = Vector3.zero, RotateRelativeToParent = false, PropsToDisable = new string[1] { "Soda Shelf" }, CustomPostSpawnAction = 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); } } } } }; } [HarmonyPatch(typeof(ShopManager))] internal static class ShopManagerPatch { internal static class ShelfSpawner { public static GameObject Spawn(Vector3 pos, Quaternion rot, Transform parentTransform, string placeholderName, string configName) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Plugin.CustomItemShelf == (Object)null) { Plugin.Logger.LogError((object)("CustomItemShelf is null. Cannot spawn shelf '" + configName + "'.")); return null; } if (!SemiFunc.IsMultiplayer()) { if (!((Object)(object)parentTransform != (Object)null)) { return Object.Instantiate<GameObject>(Plugin.CustomItemShelf, pos, rot); } return Object.Instantiate<GameObject>(Plugin.CustomItemShelf, pos, rot, parentTransform); } if (!SemiFunc.IsMasterClient()) { return null; } string text = Guid.NewGuid().ToString("N"); GameObject val = Object.Instantiate<GameObject>(Plugin.CustomItemShelf, pos, rot); ((Object)val).name = "MoreShopShelf_" + text; if ((Object)(object)parentTransform != (Object)null) { val.transform.SetParent(parentTransform, true); } if (!string.IsNullOrEmpty(placeholderName)) { GameObject val2 = GameObject.Find(placeholderName); if ((Object)(object)val2 != (Object)null) { val2.SetActive(false); } } string parentName = (((Object)(object)parentTransform != (Object)null) ? ((Object)((Component)parentTransform).gameObject).name : string.Empty); ShelfEvents.RaiseSpawnShelf(text, pos, rot, parentName, placeholderName ?? string.Empty, configName); return val; } } private static GameObject? shelf; private static int originalCurrency; internal static bool isMoreUpgrades; 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")] 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); } } } [PunRPC] public static void SetParent(Transform parent, GameObject gameObj) { gameObj.transform.SetParent(parent); } [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")] private static void SpawnShelf() { //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: 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(); } 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.CustomValidation != null && !spawnConfig.CustomValidation(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 = null; val3 = ((spawnConfig.CustomAnchorFinder != null) ? spawnConfig.CustomAnchorFinder(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.CustomAnchorFinder != 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.CustomPosCalculator != null) ? spawnConfig.CustomPosCalculator(val2, val3) : (spawnConfig.OffsetRelativeToParent ? val2 : val3).TransformPoint(spawnConfig.TargetLocalPos)); Quaternion val5 = (spawnConfig.RotateRelativeToParent ? val2.rotation : val3.rotation) * Quaternion.Euler(spawnConfig.TargetRotEuler); string placeholderName = spawnConfig.NetworkPlaceholderOverride ?? ((Object)val3).name; GameObject val6 = null; if (SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClient()) { val6 = ShelfSpawner.Spawn(val4, val5, val2, placeholderName, spawnConfig.Name); if ((Object)(object)val6 != (Object)null) { SetParent(val2, val6); } } else if (!SemiFunc.IsMultiplayer()) { val6 = Object.Instantiate<GameObject>(Plugin.CustomItemShelf, val4, val5, val2); } if ((Object)(object)val6 != (Object)null || (SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClient())) { ProcessShelfProps(val, spawnConfig); spawnConfig.CustomPostSpawnAction?.Invoke(val, val2, val3, val6); num++; } } if (num > 0) { Plugin.Logger.LogInfo((object)$"Successfully spawned {num} custom shelf/shelves!"); } } private 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_00e1: 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: Starting Item Scan ---"); Task.Delay(2000).Wait(); 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); } } else { Plugin.Logger.LogInfo((object)"No potential Secret Items found."); } Plugin.Logger.LogInfo((object)"--- Shop Initialization: Item Scan Complete ---"); } 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 Dictionary<int, int> instancePrices = new Dictionary<int, int>(); private static Dictionary<string, Queue<int>> itemInstanceIds = new Dictionary<string, Queue<int>>(); [HarmonyPrefix] [HarmonyPatch(typeof(StatsManager), "ItemPurchase")] private static bool RefundExtraItem(string itemName, ref bool __runOriginal) { __runOriginal = true; 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; } __runOriginal = false; 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.ContainsKey(name)) { itemInstanceIds[name] = new Queue<int>(); } itemInstanceIds[name].Enqueue(instanceID); Plugin.Logger.LogInfo((object)$"Added to cart: {name} instance {instanceID} for {item.value} (total instances: {itemInstanceIds[name].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, ref 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 { [Header("Volume Settings")] public Vector3 boxSize = new Vector3(1f, 1f, 1f); public Vector3 centerOffset = Vector3.zero; public LayerMask itemLayer = LayerMask.op_Implicit(-1); [Header("Optimization")] public float checkInterval = 0.25f; private Dictionary<GameObject, List<GameObject>> trackedItems = new Dictionary<GameObject, List<GameObject>>(); private HashSet<GameObject> objectsInsideThisTick = new HashSet<GameObject>(); private List<GameObject> objectsToRemove = new List<GameObject>(); private float timer; private void Update() { //IL_0032: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) timer += Time.deltaTime; if (timer < checkInterval) { return; } timer = 0f; Vector3 val = ((Component)this).transform.position + ((Component)this).transform.rotation * centerOffset; Collider[] array = Physics.OverlapBox(val, boxSize / 2f, ((Component)this).transform.rotation, LayerMask.op_Implicit(itemLayer)); objectsInsideThisTick.Clear(); Collider[] array2 = array; foreach (Collider val2 in array2) { ItemAttributes componentInParent = ((Component)val2).GetComponentInParent<ItemAttributes>(); if ((Object)(object)componentInParent == (Object)null) { continue; } GameObject gameObject = ((Component)componentInParent).gameObject; objectsInsideThisTick.Add(gameObject); if (!trackedItems.TryGetValue(gameObject, out List<GameObject> value)) { value = new List<GameObject>(); FindAndDisableLights(gameObject.transform, value); trackedItems[gameObject] = value; continue; } foreach (GameObject item in value) { if (item.activeSelf) { item.SetActive(false); } } } objectsToRemove.Clear(); foreach (KeyValuePair<GameObject, List<GameObject>> trackedItem in trackedItems) { if (!((Object)(object)trackedItem.Key == (Object)null) && objectsInsideThisTick.Contains(trackedItem.Key)) { continue; } foreach (GameObject item2 in trackedItem.Value) { if ((Object)(object)item2 != (Object)null) { item2.SetActive(true); } } if ((Object)(object)trackedItem.Key != (Object)null) { objectsToRemove.Add(trackedItem.Key); } } foreach (GameObject item3 in objectsToRemove) { trackedItems.Remove(item3); } } private void FindAndDisableLights(Transform parent, List<GameObject> lightsFound) { Transform[] componentsInChildren = ((Component)parent).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { switch (((Object)val).name) { case "Item Light": case "Light - Small Lamp": case "Light": ((Component)val).gameObject.SetActive(false); lightsFound.Add(((Component)val).gameObject); break; } } } private void OnDrawGizmos() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_002d: 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) //IL_0039: 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_005c: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) Matrix4x4 matrix = Gizmos.matrix; Vector3 val = ((Component)this).transform.position + ((Component)this).transform.rotation * centerOffset; Gizmos.matrix = Matrix4x4.TRS(val, ((Component)this).transform.rotation, Vector3.one); Gizmos.color = new Color(0f, 0.5f, 1f, 0.15f); Gizmos.DrawCube(Vector3.zero, boxSize); Gizmos.color = new Color(0f, 0.5f, 1f, 0.8f); Gizmos.DrawWireCube(Vector3.zero, boxSize); Gizmos.matrix = matrix; } } } namespace MoreShopItems.Config { public static class ConfigEntries { private static 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 class ConfigHelper { public static ConfigEntry<bool> CreateConfig(string section, string name, bool value, string description, int min, int max) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown return ((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>(section, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>())); } 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"); } } }