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 SuppressorInBazaar v1.6.1
SuppressorInBazaar.dll
Decompiled 11 hours agousing System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HG; using ItemQualities; using On.RoR2; using On.RoR2.Items; using RoR2; using RoR2.Hologram; using RoR2.Items; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SuppressorInBazaar")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SuppressorInBazaar")] [assembly: AssemblyTitle("SuppressorInBazaar")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace SuppressorInBazaar; [BepInPlugin("thebugreport.SuppressorInBazaar", "SuppressorInBazaar", "1.5.1")] public class SuppressorInBazaar : BaseUnityPlugin { public sealed class SuppressorUnit { public Vector3 position; public float offsetY; public Quaternion rotation = Quaternion.Euler(0f, 85f, 0f); } public sealed class SuppressorGroup { public string groupName; public string sceneName; public List<SuppressorUnit> groupSuppressors; } public enum CostType { None, LunarCoin, VoidCoin } public static ConfigEntry<bool> stagedSuppressors; public static ConfigEntry<string> stagedSequence; public static ConfigEntry<string> amountOfSuppressors; public static ConfigEntry<int> itemsToSuppress; public static ConfigEntry<CostType> suppressorCostType; public static ConfigEntry<int> suppressorCostInit; public static ConfigEntry<bool> suppressorCostInitCount; public static ConfigEntry<int> suppressorCostIncrease; public static ConfigEntry<int> suppressorCostWhite; public static ConfigEntry<int> suppressorCostGreen; public static ConfigEntry<int> suppressorCostRed; public static ConfigEntry<bool> stageEnabled; public static ConfigEntry<string> amountOfStageSuppressors; public static ConfigEntry<bool> replaceVoidScrap; public static ConfigEntry<bool> fixRecyclerBug; public static ConfigEntry<bool> applyCoinChanges; public static ConfigEntry<int> debugSuppressorToSpawn; public bool qualityInstalled; public GameObject suppressorPrefab; public static List<SuppressorUnit> bazaarShopPositions = new List<SuppressorUnit> { new SuppressorUnit { position = new Vector3(-136.16f, -22.70239f, -37.74739f), rotation = Quaternion.Euler(0f, 85f, 0f), offsetY = -1.65f }, new SuppressorUnit { position = new Vector3(-115.7162f, -21.70239f, -54.23982f), rotation = Quaternion.Euler(0f, 5f, 0f), offsetY = -1.05f }, new SuppressorUnit { position = new Vector3(-89.48961f, -25.21006f, -55.79497f), rotation = Quaternion.Euler(0f, 255f, 0f), offsetY = -1.5f }, new SuppressorUnit { position = new Vector3(-79.88673f, -22.88724f, -58.02564f), rotation = Quaternion.Euler(0f, 235f, 0f), offsetY = -1.5f }, new SuppressorUnit { position = new Vector3(-123.1761f, -22.92046f, -0.2019209f), rotation = Quaternion.Euler(0f, 225f, 0f), offsetY = -1.5f }, new SuppressorUnit { position = new Vector3(-70.04802f, -22.58818f, -22.26592f), rotation = Quaternion.Euler(0f, 280f, 0f), offsetY = -1.4f }, new SuppressorUnit { position = new Vector3(-91.48799f, -22.65284f, -5.782152f), rotation = Quaternion.Euler(0f, 120f, 0f), offsetY = -1.5f }, new SuppressorUnit { position = new Vector3(-62.53033f, -22.66195f, -59.45711f), rotation = Quaternion.Euler(0f, 275f, 0f), offsetY = -1.4f }, new SuppressorUnit { position = new Vector3(-65.79401f, -22.75067f, -54.65296f), rotation = Quaternion.Euler(0f, 255f, 0f), offsetY = -1.4f }, new SuppressorUnit { position = new Vector3(-76.47423f, -20.97451f, -78.66338f), rotation = Quaternion.Euler(0f, 295f, 0f), offsetY = -1.6f } }; public static List<SuppressorGroup> sceneGroupCataloge = new List<SuppressorGroup> { new SuppressorGroup { groupName = "Bazaar Inside", sceneName = "bazaar", groupSuppressors = bazaarShopPositions } }; public void InitConfig() { amountOfSuppressors = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "Amount of Suppressors", "1-3", "How many Suppressors to spawn in the Bazaar. Use a single number or a range between two numbers (e.g. 1-3). Max amount is 10 (4-12 would convert into 4-10)."); stagedSuppressors = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Staged Suppressors", true, "If true, Void Suppressors will present items in a White > Green > Red sequence. If false, they will instead choose a random item tier every time."); stagedSequence = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "Staged Sequence", "wgr", "The Tier sequence used if Staged Suppressors is true. 'w' is White Tier, 'g' is Green Tier, 'r' is Red Tier. The amount of letters written is the amount of items that can be banished, with the tiers in that specific order.\nAdding letters in brackets (like \"w(ggw)(rrrrg)\" will pick a random tier from the letters in the brackets instead of choosing all of them.\nEach letter in a bracket has the same chance of being chosen, meaning lots of the same letter make that tier more likely to be picked.\nYou cant put brackets into brackets."); itemsToSuppress = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Items to Suppress", 3, "If 'Staged Suppressors' is false, This number will determine how many items a single Suppressor will let you banish before they close for good."); suppressorCostType = ((BaseUnityPlugin)this).Config.Bind<CostType>("Settings", "Cost Type", CostType.None, "What should Suppressor's cost to initialise? (Price applies when first opening the suppressor.)"); suppressorCostInit = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Initial Cost", 0, "Cost to open the suppressor initially to start banishing items."); suppressorCostIncrease = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Cost Increase", -1, "Cost to increase by every time you banish an item. If set to -1 or less, will instead use White Cost, Green Cost, and Red Cost for prices. 1 is recommended. Starts at Initial Cost."); suppressorCostInitCount = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "Cost Increase Counts Inital", true, "If Cost Increase applies when initially opening the suppressor or not."); suppressorCostWhite = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "White Cost", 1, "Cost to banish a white tier item. Only works if Cost Increase is set to -1 or less."); suppressorCostGreen = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Green Cost", 2, "Cost to banish a green tier item. Only works if Cost Increase is set to -1 or less."); suppressorCostRed = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Red Cost", 3, "Cost to banish a red tier item. Only works if Cost Increase is set to -1 or less."); stageEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage Suppressors", "Enabled", true, "If suppressors can spawn in place of unused Newt Alter spots in regular stages."); amountOfStageSuppressors = ((BaseUnityPlugin)this).Config.Bind<string>("Stage Suppressors", "Amount of Suppressors", "0-1", "How many Suppressors to spawn in stages that have newt alters. Use a single number or a range between two numbers (e.g. 1-3). Max amount is based on how many newt alters spots are not being used on that stage (4-12 would convert into 4-6 if there are 6 unused spaces)."); replaceVoidScrap = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "Replace Void Scrap", true, "If true, Void Scrap produced from banished items will produce regular scrap instead. Turn off if you have another mod installed that uses void/suppressed scrap. Requires Restart."); fixRecyclerBug = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "Fix Recycler Bug", true, "If true, enables hooks that fix both the Reycler and Dark Alchemy page both creating banished items."); applyCoinChanges = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "Apply Coin Changes", true, "If true, applies coin and price changes to suppressors. May cause conflict with mods like Suppression. Will disable suppressor cost if another mod doesn't apply them."); debugSuppressorToSpawn = ((BaseUnityPlugin)this).Config.Bind<int>("Debug", "Debug Suppressor To Spawn", -1, "If set to a value >= 0, will spawn only the suppressor at that index for debugging purposes. Set to -1 to disable. Can alternatively be used to make a single specific suppressor spawn if you just want one non-random one."); } public void Awake() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown InitConfig(); if (Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities")) { qualityInstalled = true; } SceneCatalog.OnActiveSceneChanged += new hook_OnActiveSceneChanged(SceneCatalog_OnActiveSceneChanged); VoidSuppressorBehavior.OnInteraction += new hook_OnInteraction(VoidSuppressorBehaviour_OnInteraction); VoidSuppressorBehavior.FixedUpdate += new hook_FixedUpdate(VoidSuppressorBehaviour_FixedUpdate); if (replaceVoidScrap.Value) { VoidSuppressorBehavior.RefreshItems += new hook_RefreshItems(VoidSuppressorBehavior_RefreshItems); } if (fixRecyclerBug.Value) { PickupTransmutationManager.GetAvailableGroupFromPickupIndex += new hook_GetAvailableGroupFromPickupIndex(PickupTransmutationManager_GetAvailableGroupFromPickupIndex); SuppressedItemManager.SuppressItem += new hook_SuppressItem(SuppressedItemManager_SuppressItem); } SetupSuppressorPrefab(); } public void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown SceneCatalog.OnActiveSceneChanged -= new hook_OnActiveSceneChanged(SceneCatalog_OnActiveSceneChanged); VoidSuppressorBehavior.OnInteraction -= new hook_OnInteraction(VoidSuppressorBehaviour_OnInteraction); VoidSuppressorBehavior.FixedUpdate -= new hook_FixedUpdate(VoidSuppressorBehaviour_FixedUpdate); VoidSuppressorBehavior.RefreshItems -= new hook_RefreshItems(VoidSuppressorBehavior_RefreshItems); PickupTransmutationManager.GetAvailableGroupFromPickupIndex -= new hook_GetAvailableGroupFromPickupIndex(PickupTransmutationManager_GetAvailableGroupFromPickupIndex); } private void SetupSuppressorPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) suppressorPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidSuppressor/VoidSuppressor.prefab").WaitForCompletion(); suppressorPrefab.GetComponent<PurchaseInteraction>().SetAvailable(true); } private List<int> GetSuppressorCountList(int maxPositions, ConfigEntry<string> config) { List<int> result = new List<int>(); if (maxPositions == 0) { return result; } string text = config.Value.Trim() ?? "1"; int minValue; int num; int result4; if (text.Contains("-")) { string[] array = text.Split('-', StringSplitOptions.RemoveEmptyEntries); if (array.Length == 2 && int.TryParse(array[0].Trim(), out var result2) && int.TryParse(array[1].Trim(), out var result3)) { result2 = Math.Max(0, Math.Min(result2, maxPositions)); result3 = Math.Max(0, Math.Min(result3, maxPositions)); minValue = Math.Min(result2, result3); num = Math.Max(result2, result3); } else { minValue = (num = 1); } } else if (int.TryParse(text, out result4)) { result4 = Math.Max(0, Math.Min(result4, maxPositions)); minValue = (num = result4); } else { minValue = (num = 1); } Random random = new Random(); int count = random.Next(minValue, num + 1); List<int> list = Enumerable.Range(0, maxPositions).ToList(); for (int num2 = list.Count - 1; num2 > 0; num2--) { int num3 = random.Next(0, num2 + 1); List<int> list2 = list; int index = num3; List<int> list3 = list; int index2 = num2; int value = list[num2]; int value2 = list[num3]; list2[index] = value; list3[index2] = value2; } return list.Take(count).ToList(); } private List<ItemTier> GetStagedSequence() { List<ItemTier> list = new List<ItemTier>(); string[] array = (from m in Regex.Matches(stagedSequence.Value, "\\(([^()]+)\\)|([^()])") select (!m.Groups[1].Success) ? m.Groups[2].Value : m.Groups[1].Value).ToArray(); Random random = new Random(); string[] array2 = array; foreach (string text in array2) { if (text.Length == 1) { switch (text) { case "w": list.Add((ItemTier)0); break; case "g": list.Add((ItemTier)1); break; case "r": list.Add((ItemTier)2); break; } } else if (text.Length >= 2) { int index = random.Next(text.Length); switch (text[index]) { case 'w': list.Add((ItemTier)0); break; case 'g': list.Add((ItemTier)1); break; case 'r': list.Add((ItemTier)2); break; } } } return list; } private CostTypeIndex GetConfigCostType() { return (CostTypeIndex)(suppressorCostType.Value switch { CostType.None => 0, CostType.LunarCoin => 3, CostType.VoidCoin => 14, _ => 0, }); } private void SetBehaviourPrices(VoidSuppressorBehavior self) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected I4, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_011b: Unknown result type (might be due to invalid IL or missing references) if (suppressorCostIncrease.Value < 0 && applyCoinChanges.Value) { ItemTier tier = ItemCatalog.GetItemDef(self.GetTransformItemIndex()).tier; switch ((int)tier) { case 0: ((Component)self).gameObject.GetComponent<PurchaseInteraction>().cost = suppressorCostWhite.Value; if (suppressorCostWhite.Value > 0) { ((Component)self).gameObject.GetComponent<PurchaseInteraction>().costType = GetConfigCostType(); } else { ((Component)self).gameObject.GetComponent<PurchaseInteraction>().costType = (CostTypeIndex)0; } break; case 1: ((Component)self).gameObject.GetComponent<PurchaseInteraction>().cost = suppressorCostGreen.Value; if (suppressorCostGreen.Value > 0) { ((Component)self).gameObject.GetComponent<PurchaseInteraction>().costType = GetConfigCostType(); } else { ((Component)self).gameObject.GetComponent<PurchaseInteraction>().costType = (CostTypeIndex)0; } break; case 2: ((Component)self).gameObject.GetComponent<PurchaseInteraction>().cost = suppressorCostRed.Value; if (suppressorCostRed.Value > 0) { ((Component)self).gameObject.GetComponent<PurchaseInteraction>().costType = GetConfigCostType(); } else { ((Component)self).gameObject.GetComponent<PurchaseInteraction>().costType = (CostTypeIndex)0; } break; } } else { int num = 0; int value = suppressorCostIncrease.Value; if (suppressorCostInitCount.Value) { num = value; } num += value * self.GetPurchaseCount(); ((Component)self).gameObject.GetComponent<PurchaseInteraction>().cost = num; if (num > 0) { ((Component)self).gameObject.GetComponent<PurchaseInteraction>().costType = GetConfigCostType(); } else { ((Component)self).gameObject.GetComponent<PurchaseInteraction>().costType = (CostTypeIndex)0; } } } private void SpawnSuppressorInstance(Vector3 position, Quaternion rotation) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0065: 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) GameObject val = Object.Instantiate<GameObject>(suppressorPrefab); val.transform.position = position; val.transform.rotation = rotation; if (suppressorCostType.Value != CostType.None && applyCoinChanges.Value) { val.GetComponent<PurchaseInteraction>().cost = suppressorCostInit.Value; if (suppressorCostInit.Value > 0) { val.GetComponent<PurchaseInteraction>().costType = GetConfigCostType(); } else { val.GetComponent<PurchaseInteraction>().costType = (CostTypeIndex)0; } val.AddComponent<HologramProjector>().disableHologramRotation = true; } NetworkServer.Spawn(val); } private void SpawnSuppressorInstance(SuppressorUnit unit) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(suppressorPrefab); Vector3 position = unit.position; position.y += unit.offsetY; val.transform.position = position; val.transform.rotation = unit.rotation; if (suppressorCostType.Value != CostType.None && applyCoinChanges.Value) { val.GetComponent<PurchaseInteraction>().cost = suppressorCostInit.Value; if (suppressorCostInit.Value > 0) { val.GetComponent<PurchaseInteraction>().costType = GetConfigCostType(); } else { val.GetComponent<PurchaseInteraction>().costType = (CostTypeIndex)0; } val.AddComponent<HologramProjector>().disableHologramRotation = true; } NetworkServer.Spawn(val); } private List<GameObject> FindAltarsOnStage(bool includeActive = false) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) List<GameObject> list = new List<GameObject>(); PortalStatueBehavior[] array = Resources.FindObjectsOfTypeAll(typeof(PortalStatueBehavior)) as PortalStatueBehavior[]; foreach (PortalStatueBehavior val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null) && (int)val.portalType == 0 && (includeActive || !((Component)val).gameObject.activeSelf)) { list.Add(((Component)val).gameObject); } } return list; } private void SceneCatalog_OnActiveSceneChanged(orig_OnActiveSceneChanged orig, Scene oldScene, Scene newScene) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(oldScene, newScene); if ((Object)(object)suppressorPrefab == (Object)null || !NetworkServer.active) { return; } foreach (SuppressorGroup item in sceneGroupCataloge) { if (!(((Scene)(ref newScene)).name == item.sceneName)) { continue; } List<SuppressorUnit> groupSuppressors = item.groupSuppressors; if (debugSuppressorToSpawn.Value >= 0) { int value = debugSuppressorToSpawn.Value; if (value >= 0 && value < groupSuppressors.Count) { SuppressorUnit suppressorUnit = groupSuppressors[value]; SpawnSuppressorInstance(suppressorUnit); Vector3 position = suppressorUnit.position; position.y += suppressorUnit.offsetY; Debug.Log((object)$"[SuppressorInBazaar] Spawned debug suppressor at index {value} (position {position})."); break; } } List<int> suppressorCountList = GetSuppressorCountList(groupSuppressors.Count, amountOfSuppressors); if (suppressorCountList == null || suppressorCountList.Count == 0) { break; } foreach (int item2 in suppressorCountList) { if (item2 >= 0 && item2 < groupSuppressors.Count) { SuppressorUnit unit = groupSuppressors[item2]; SpawnSuppressorInstance(unit); } } } if (!stageEnabled.Value) { return; } List<GameObject> list = FindAltarsOnStage(); List<int> suppressorCountList2 = GetSuppressorCountList(list.Count(), amountOfStageSuppressors); if (suppressorCountList2 == null && suppressorCountList2.Count <= 0) { return; } foreach (int item3 in suppressorCountList2) { if (item3 >= 0) { GameObject obj = list[item3]; Vector3 position2 = obj.transform.position; position2.y += -1.45f; Quaternion rotation = obj.transform.rotation; SpawnSuppressorInstance(position2, rotation); } } } private void VoidSuppressorBehavior_RefreshItems(orig_RefreshItems orig, VoidSuppressorBehavior self) { //IL_002a: 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) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00d9: Expected I4, but got Unknown //IL_0123: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_023e: 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_0246: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || self.GetTimeUntilItemRefresh() > 0f) { return; } SyncListPickupIndex nextItemsToSuppress = self.GetNextItemsToSuppress(); for (int num = ((SyncListStruct<PickupIndex>)(object)nextItemsToSuppress).Count - 1; num >= 0; num--) { PickupIndex val = ((SyncList<PickupIndex>)(object)nextItemsToSuppress)[num]; if (SuppressedItemManager.HasItemBeenSuppressed(((PickupIndex)(ref val)).itemIndex)) { ((SyncList<PickupIndex>)(object)nextItemsToSuppress).RemoveAt(num); } } int num2 = self.GetItemsSuppressedPerPurchase() - ((SyncListStruct<PickupIndex>)(object)nextItemsToSuppress).Count; if (num2 > 0) { self.SetMaxPurchaseCount(itemsToSuppress.Value); List<PickupIndex> list = null; PickupIndex item = PickupIndex.none; object rng = self.GetRng(); Xoroshiro128Plus val2 = (Xoroshiro128Plus)(((rng is Xoroshiro128Plus) ? rng : null) ?? ((object)(Xoroshiro128Plus)rng)); int num3 = val2.RangeInt(0, 3); if (stagedSuppressors.Value) { List<ItemTier> list2 = GetStagedSequence(); ItemTier val3 = list2[self.GetPurchaseCount()]; switch ((int)val3) { case 0: num3 = 0; break; case 1: num3 = 1; break; case 2: num3 = 2; break; } self.SetMaxPurchaseCount(list2.Count); } switch (num3) { case 0: { list = new List<PickupIndex>(Run.instance.availableTier1DropList); ItemIndex itemIndex3 = Items.ScrapWhite.itemIndex; item = PickupCatalog.FindPickupIndex(itemIndex3); self.SetTransformItemIndex((ItemIndex)((!self.GetTransformItems()) ? (-1) : ((int)itemIndex3))); break; } case 1: { list = new List<PickupIndex>(Run.instance.availableTier2DropList); ItemIndex itemIndex2 = Items.ScrapGreen.itemIndex; item = PickupCatalog.FindPickupIndex(itemIndex2); self.SetTransformItemIndex((ItemIndex)((!self.GetTransformItems()) ? (-1) : ((int)itemIndex2))); break; } case 2: { list = new List<PickupIndex>(Run.instance.availableTier3DropList); ItemIndex itemIndex = Items.ScrapRed.itemIndex; item = PickupCatalog.FindPickupIndex(itemIndex); self.SetTransformItemIndex((ItemIndex)((!self.GetTransformItems()) ? (-1) : ((int)itemIndex))); break; } } if (list != null && list.Count > 0) { list.Remove(item); foreach (PickupIndex item2 in (SyncList<PickupIndex>)(object)nextItemsToSuppress) { list.Remove(item2); } Util.ShuffleList<PickupIndex>(list, val2); int num4 = list.Count - num2; if (num4 > 0) { list.RemoveRange(num2, num4); } foreach (PickupIndex item3 in list) { ((SyncList<PickupIndex>)(object)nextItemsToSuppress).Add(item3); } } } self.InvokeRefreshPickupDisplays(); if (((SyncListStruct<PickupIndex>)(object)nextItemsToSuppress).Count != 0) { return; } if (self.GetPurchaseCount() < self.GetMaxPurchaseCount()) { self.SetPurchaseCount(self.GetPurchaseCount() + 1); self.RefreshItems(); return; } Transform symbolTransform = self.GetSymbolTransform(); if ((Object)(object)symbolTransform != (Object)null) { ((Component)symbolTransform).gameObject.SetActive(false); } self.GetPurchaseInteraction().SetAvailable(false); self.GetAnimator().SetBool(self.GetAnimatorIsAvailableName(), false); } private void VoidSuppressorBehaviour_OnInteraction(orig_OnInteraction orig, VoidSuppressorBehavior self, Interactor interactor) { orig.Invoke(self, interactor); if (self.GetPurchaseCount() == 0) { SetBehaviourPrices(self); } } private void VoidSuppressorBehaviour_FixedUpdate(orig_FixedUpdate orig, VoidSuppressorBehavior self) { if (self.GetPurchaseCount() >= self.GetMaxPurchaseCount()) { return; } if (self.GetTimeUntilUseRefresh() > 0f) { self.SetTimeUntilUseRefresh(self.GetTimeUntilUseRefresh() - Time.fixedDeltaTime); if (self.GetTimeUntilUseRefresh() <= 0f) { self.GetAnimator().SetBool(self.GetAnimatorSuppressName(), false); ((Component)self).gameObject.GetComponent<PurchaseInteraction>().SetAvailable(true); } } if (self.GetTimeUntilItemRefresh() > 0f) { self.SetTimeUntilItemRefresh(self.GetTimeUntilItemRefresh() - Time.fixedDeltaTime); if (self.GetTimeUntilItemRefresh() <= 0f) { SyncListPickupIndex nextItemsToSuppress = self.GetNextItemsToSuppress(); ((SyncList<PickupIndex>)(object)nextItemsToSuppress).Clear(); self.SetNextItemsToSuppress(nextItemsToSuppress); self.InvokeRefreshItems(); SetBehaviourPrices(self); } } } private PickupIndex[] PickupTransmutationManager_GetAvailableGroupFromPickupIndex(orig_GetAvailableGroupFromPickupIndex orig, PickupIndex pickupIndex) { //IL_000c: 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_002f: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected I4, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) PickupIndex[] array = ArrayUtils.GetSafe<PickupIndex[]>(ReflectionExtensions.GetAvaliablePickupGroupMap(), pickupIndex.value); PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); bool flag = qualityInstalled; object obj = null; if (flag) { try { obj = QualityCatalog.GetQualityTier(pickupIndex); } catch (Exception ex) { MonoBehaviour.print((object)ex); } } if (pickupDef != null && (int)pickupDef.itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if ((Object)(object)itemDef != (Object)null) { List<PickupIndex> list = null; ItemTier tier = itemDef.tier; switch ((int)tier) { case 0: list = Run.instance.availableTier1DropList; break; case 1: list = Run.instance.availableTier2DropList; break; case 2: list = Run.instance.availableTier3DropList; break; } if (list != null && array != null) { if (flag) { if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { list[i] = QualityCatalog.GetPickupIndexOfQuality(list[i], (QualityTier)obj); } return list.Where((PickupIndex pickup) => array.Contains(pickup)).ToArray(); } return (PickupIndex[])(object)new PickupIndex[0]; } return list.Where((PickupIndex pickup) => array.Contains(pickup)).ToArray(); } } } if (flag) { if (array != null) { for (int num = 0; num < array.Count(); num++) { array[num] = QualityCatalog.GetPickupIndexOfQuality(array[num], (QualityTier)(-1)); } } return array; } return array; } private bool SuppressedItemManager_SuppressItem(orig_SuppressItem orig, ItemIndex suppressedIndex, ItemIndex transformedIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) bool result = orig.Invoke(suppressedIndex, transformedIndex); Run.instance.allAvailableTierDroplists[(ItemTier)0] = Run.instance.availableTier1DropList; Run.instance.allAvailableTierDroplists[(ItemTier)1] = Run.instance.availableTier2DropList; Run.instance.allAvailableTierDroplists[(ItemTier)2] = Run.instance.availableTier3DropList; return result; } } public static class ReflectionExtensions { private static readonly ConcurrentDictionary<(Type, string), FieldInfo> FieldCache = new ConcurrentDictionary<(Type, string), FieldInfo>(); private static readonly ConcurrentDictionary<(Type, string), MethodInfo> MethodCache = new ConcurrentDictionary<(Type, string), MethodInfo>(); private static readonly FieldInfo _fiPickupGroupMap = typeof(PickupTransmutationManager).GetField("availablePickupGroupMap", BindingFlags.Static | BindingFlags.NonPublic); private static FieldInfo GetFieldInfo(Type type, string name) { if (type == null) { throw new ArgumentNullException("type"); } (Type, string) key = (type, name); if (FieldCache.TryGetValue(key, out var value)) { return value; } Type type2 = type; while (type2 != null) { value = type2.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (value != null) { FieldCache[key] = value; return value; } type2 = type2.BaseType; } throw new MissingFieldException("Field '" + name + "' not found on type '" + type.FullName + "' or its base types."); } private static MethodInfo GetMethodInfo(Type type, string name, params Type[] parameters) { if (type == null) { throw new ArgumentNullException("type"); } (Type, string) key = (type, name); if (MethodCache.TryGetValue(key, out var value)) { return value; } Type type2 = type; while (type2 != null) { value = type2.GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, parameters, null); if (value != null) { MethodCache[key] = value; return value; } type2 = type2.BaseType; } throw new MissingMethodException("Method '" + name + "' not found on type '" + type.FullName + "' or its base types."); } public static T GetPrivateField<T>(this object obj, string name) { if (obj == null) { throw new ArgumentNullException("obj"); } return (T)GetFieldInfo(obj.GetType(), name).GetValue(obj); } public static void SetPrivateField<T>(this object obj, string name, T value) { if (obj == null) { throw new ArgumentNullException("obj"); } GetFieldInfo(obj.GetType(), name).SetValue(obj, value); } public static SyncListPickupIndex GetNextItemsToSuppress(this VoidSuppressorBehavior self) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if ((Object)(object)self == (Object)null) { throw new ArgumentNullException("self"); } object value = GetFieldInfo(((object)self).GetType(), "nextItemsToSuppress").GetValue(self); SyncListPickupIndex result = new SyncListPickupIndex(); if (value == null) { return result; } return (SyncListPickupIndex)value; } public static void SetNextItemsToSuppress(this VoidSuppressorBehavior self, SyncListPickupIndex value) { self.SetPrivateField<SyncListPickupIndex>("nextItemsToSuppress", value); } public static float GetTimeUntilItemRefresh(this VoidSuppressorBehavior self) { return self.GetPrivateField<float>("timeUntilItemRefresh"); } public static void SetTimeUntilItemRefresh(this VoidSuppressorBehavior self, float value) { self.SetPrivateField("timeUntilItemRefresh", value); } public static float GetTimeUntilUseRefresh(this VoidSuppressorBehavior self) { return self.GetPrivateField<float>("timeUntilUseRefresh"); } public static void SetTimeUntilUseRefresh(this VoidSuppressorBehavior self, float value) { self.SetPrivateField("timeUntilUseRefresh", value); } public static int GetItemsSuppressedPerPurchase(this VoidSuppressorBehavior self) { return self.GetPrivateField<int>("itemsSuppressedPerPurchase"); } public static bool GetTransformItems(this VoidSuppressorBehavior self) { return self.GetPrivateField<bool>("transformItems"); } public static void SetTransformItems(this VoidSuppressorBehavior self, bool value) { self.SetPrivateField("transformItems", value); } public static ItemIndex GetTransformItemIndex(this VoidSuppressorBehavior self) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return self.GetPrivateField<ItemIndex>("transformItemIndex"); } public static void SetTransformItemIndex(this VoidSuppressorBehavior self, ItemIndex value) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) self.SetPrivateField<ItemIndex>("transformItemIndex", value); } public static int GetPurchaseCount(this VoidSuppressorBehavior self) { return self.GetPrivateField<int>("purchaseCount"); } public static void SetPurchaseCount(this VoidSuppressorBehavior self, int value) { self.SetPrivateField("purchaseCount", value); } public static int GetMaxPurchaseCount(this VoidSuppressorBehavior self) { return self.GetPrivateField<int>("maxPurchaseCount"); } public static void SetMaxPurchaseCount(this VoidSuppressorBehavior self, int value) { self.SetPrivateField("maxPurchaseCount", value); } public static object GetRng(this VoidSuppressorBehavior self) { return self.GetPrivateField<object>("rng"); } public static Transform GetSymbolTransform(this VoidSuppressorBehavior self) { return self.GetPrivateField<Transform>("symbolTransform"); } public static void SetSymbolTransform(this VoidSuppressorBehavior self, Transform value) { self.SetPrivateField<Transform>("symbolTransform", value); } public static PurchaseInteraction GetPurchaseInteraction(this VoidSuppressorBehavior self) { return self.GetPrivateField<PurchaseInteraction>("purchaseInteraction"); } public static Animator GetAnimator(this VoidSuppressorBehavior self) { return self.GetPrivateField<Animator>("animator"); } public static string GetAnimatorIsAvailableName(this VoidSuppressorBehavior self) { return self.GetPrivateField<string>("animatorIsAvailableName"); } public static string GetAnimatorSuppressName(this VoidSuppressorBehavior self) { return self.GetPrivateField<string>("animatorSuppressName"); } public static void InvokeRefreshPickupDisplays(this VoidSuppressorBehavior self) { if ((Object)(object)self == (Object)null) { throw new ArgumentNullException("self"); } GetMethodInfo(((object)self).GetType(), "RefreshPickupDisplays").Invoke(self, null); } public static void InvokeRefreshItems(this VoidSuppressorBehavior self) { if ((Object)(object)self == (Object)null) { throw new ArgumentNullException("self"); } GetMethodInfo(((object)self).GetType(), "RefreshItems").Invoke(self, null); } public static PickupIndex[][] GetAvaliablePickupGroupMap() { return (PickupIndex[][])_fiPickupGroupMap.GetValue(null); } }