using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.CaptainSupplyDrop; using EntityStates.Missions.RepurposedCrater; using EntityStates.NewtMonster; using EntityStates.Wisp1Monster; using HG.Reflection; using InLobbyConfig; using InLobbyConfig.Fields; using ItemStringParser; using Microsoft.CodeAnalysis; using On.EntityStates.CaptainSupplyDrop; using On.EntityStates.Missions.RepurposedCrater; using On.EntityStates.NewtMonster; using On.RoR2; using On.RoR2.Projectile; using R2API.Utils; using RoR2; using RoR2.Artifacts; using RoR2.CharacterAI; using RoR2.Hologram; using RoR2.Navigation; using RoR2.Networking; using RoR2.Projectile; using RoR2.Scripts.GameBehaviors; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BazaarIsMyHaven")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+b97861694253c4f1b3080898672b7303f5941aae")] [assembly: AssemblyProduct("BazaarIsMyHaven")] [assembly: AssemblyTitle("BazaarIsMyHaven")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BazaarIsMyHaven { public abstract class BazaarBase { protected Random RNG = new Random(); public abstract void Preload(); public abstract void SetupBazaar(); public virtual void Hook() { } public virtual void RunStart() { } public virtual void RunEnd() { } public virtual void AddDirectorCards(List cards) { } public virtual int CheckAfterSetup() { return 0; } public virtual void SpawnLatePicks() { } protected static GameObject SpawnAt(GameObject prefab, SpawnCardStruct slot) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate(prefab, slot.Position, Quaternion.Euler(slot.Rotation)); NetworkServer.Spawn(obj); return obj; } protected static List SpawnInSlots(Dictionary slots, GameObject prefab, int start, int count) { List list = new List(); for (int i = start; i < start + count; i++) { list.Add(SpawnAt(prefab, slots[i])); } return list; } public static void SpawnEffect(AsyncOperationHandle effect, Vector3 position, Color32 color, float scale = 1f) { //IL_0007: 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_000d: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0032: Expected O, but got Unknown EffectManager.SpawnEffect(effect.WaitForCompletion(), new EffectData { origin = position, rotation = Quaternion.identity, scale = scale, color = color }, true); } protected bool IsCurrentMapInBazaar() { //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) Scene activeScene = SceneManager.GetActiveScene(); return ((Scene)(ref activeScene)).name == "bazaar"; } protected bool IsMultiplayer() { return PlayerCharacterMasterController.instances.Count > 1; } protected T GetRandom(List list, T defaultValue) { if (list == null || list.Count == 0) { return defaultValue; } return list[RNG.Next(list.Count)]; } protected List DisorderList(List TList) { List list = new List(); foreach (t T in TList) { list.Insert(RNG.Next(list.Count()), T); } return list; } } public class BazaarCauldron : BazaarBase { private AsyncOperationHandle lunarCauldronWhiteToGreen; private AsyncOperationHandle lunarCauldronGreenToRed; private AsyncOperationHandle lunarCauldronRedToWhite; private AsyncOperationHandle transcendentCauldron; private AsyncOperationHandle[] LunarCauldronsCode; private Dictionary DicCauldrons = new Dictionary(); private DirectorCard card; private int spawned; public override void Preload() { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) lunarCauldronWhiteToGreen = Addressables.LoadAssetAsync((object)"RoR2/Base/LunarCauldrons/LunarCauldron, WhiteToGreen.prefab"); lunarCauldronGreenToRed = Addressables.LoadAssetAsync((object)"RoR2/Base/LunarCauldrons/LunarCauldron, GreenToRed Variant.prefab"); lunarCauldronRedToWhite = Addressables.LoadAssetAsync((object)"RoR2/Base/LunarCauldrons/LunarCauldron, RedToWhite Variant.prefab"); transcendentCauldron = Addressables.LoadAssetAsync((object)"RoR2/DLC4/BetterCauldron.prefab"); LunarCauldronsCode = new AsyncOperationHandle[4] { lunarCauldronWhiteToGreen, lunarCauldronGreenToRed, lunarCauldronRedToWhite, transcendentCauldron }; } public override void Hook() { //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 PurchaseInteraction.Awake += new hook_Awake(PurchaseInteraction_Awake); PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin); ShopTerminalBehavior.SetPickup += new hook_SetPickup(ShopTerminalBehavior_SetPickup); } public override void RunStart() { } public override void AddDirectorCards(List cards) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) card = null; if (!ModConfig.CauldronSectionEnabled.Value) { return; } if (!GetRandomLunarCauldron().IsValid()) { Log.LogWarning("No cauldron types with a valid weight; skipping cauldrons."); return; } card = new DirectorCard("Lunar Cauldron", ModConfig.CauldronDirectorCost, ModConfig.CauldronDirectorWeight, () => ModConfig.CauldronMaxAmount.Value); cards.Add(card); } public override void SetupBazaar() { if (card != null) { DicCauldrons.Clear(); SetCauldron(); spawned = 0; SpawnLatePicks(); } } public override void SpawnLatePicks() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (card != null) { while (spawned < card.Count) { BazaarBase.SpawnAt(GetRandomLunarCauldron().WaitForCompletion(), DicCauldrons[spawned]); spawned++; } } } public void PurchaseInteraction_Awake(orig_Awake orig, PurchaseInteraction self) { orig.Invoke(self); if (ModConfig.EnableMod.Value && ModConfig.CauldronSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active) { if (((Object)self).name.StartsWith("LunarCauldron, WhiteToGreen")) { self.cost = ModConfig.CauldronWhiteToGreenCost.Value; self.Networkcost = ModConfig.CauldronWhiteToGreenCost.Value; } if (((Object)self).name.StartsWith("LunarCauldron, GreenToRed")) { self.cost = ModConfig.CauldronGreenToRedCost.Value; self.Networkcost = ModConfig.CauldronGreenToRedCost.Value; } if (((Object)self).name.StartsWith("LunarCauldron, RedToWhite")) { self.cost = ModConfig.CauldronRedToWhiteCost.Value; self.Networkcost = ModConfig.CauldronRedToWhiteCost.Value; } if (((Object)self).name.StartsWith("BetterCauldron")) { self.cost = ModConfig.CauldronTranscendentCost.Value; self.Networkcost = ModConfig.CauldronTranscendentCost.Value; } } } public void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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) //IL_00f0: Invalid comparison between Unknown and I4 if (ModConfig.EnableMod.Value && ModConfig.CauldronSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarCauldron, RedToWhite Variant") && IsMultiplayer() && ModCompatibilityShareSuite.enabled && ModCompatibilityShareSuite.IsShareSuite_PrinterCauldronFixEnabled()) { CharacterBody val = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).GetComponent() : null); Inventory inventory = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); ShopTerminalBehavior component = ((Component)self).GetComponent(); PickupDef pickupDef = (Object.op_Implicit((Object)(object)component) ? PickupCatalog.GetPickupDef(component.CurrentPickup().pickupIndex) : null); if (Object.op_Implicit((Object)(object)inventory) && pickupDef != null && (int)pickupDef.itemIndex != -1) { bool compensated = false; UnityAction val2 = delegate(PayCostContext context, PayCostResults results) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (!compensated && (Object)(object)context.activator == (Object)(object)activator && Object.op_Implicit((Object)(object)inventory)) { compensated = true; inventory.GiveItemPermanent(pickupDef.itemIndex, 2); } }; ((UnityEvent)(object)self.onDetailedPurchaseServer).AddListener(val2); try { orig.Invoke(self, activator); return; } finally { ((UnityEvent)(object)self.onDetailedPurchaseServer).RemoveListener(val2); } } } orig.Invoke(self, activator); } public void ShopTerminalBehavior_SetPickup(orig_SetPickup orig, ShopTerminalBehavior self, UniquePickup newPickup, bool newHidden) { //IL_00fe: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) if (ModConfig.EnableMod.Value && ModConfig.CauldronSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active) { if (((Object)self).name.StartsWith("LunarCauldronGreen")) { CauldronHacked_SetPickupIndex(self, out var listLunarItem); if (listLunarItem.Count > 0) { newPickup.pickupIndex = listLunarItem[RNG.Next(0, listLunarItem.Count)]; } } if (((Object)self).name.StartsWith("LunarCauldronRed")) { CauldronHacked_SetPickupIndex(self, out var listLunarItem2); if (listLunarItem2.Count > 0) { newPickup.pickupIndex = listLunarItem2[RNG.Next(0, listLunarItem2.Count)]; } } if (((Object)self).name.StartsWith("LunarCauldronWhite")) { CauldronHacked_SetPickupIndex(self, out var listLunarItem3); if (listLunarItem3.Count > 0) { newPickup.pickupIndex = listLunarItem3[RNG.Next(0, listLunarItem3.Count)]; } } } orig.Invoke(self, newPickup, newHidden); } private void SetCauldron() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) List list = new List { 0, 1, 2, 3, 4, 5, 6 }; List list2 = new List(); while (list.Count > 0) { int index = RNG.Next(list.Count); list2.Add(list[index]); list.RemoveAt(index); } DicCauldrons.Add(list2[0], new SpawnCardStruct(new Vector3(-115.9816f, -24.1175f, -6.2091f), new Vector3(0f, 120f, 0f))); DicCauldrons.Add(list2[1], new SpawnCardStruct(new Vector3(-119.928f, -24.1238f, -7.0865f), new Vector3(0f, 140f, 0f))); DicCauldrons.Add(list2[2], new SpawnCardStruct(new Vector3(-123.4725f, -23.7951f, -5.469f), new Vector3(0f, 160f, 0f))); DicCauldrons.Add(list2[3], new SpawnCardStruct(new Vector3(-107.8159f, -23.8448f, -4.517f), new Vector3(0f, 130f, 0f))); DicCauldrons.Add(list2[4], new SpawnCardStruct(new Vector3(-101.2425f, -24.8612f, -9.1464f), new Vector3(0f, 160f, 0f))); DicCauldrons.Add(list2[5], new SpawnCardStruct(new Vector3(-98.5219f, -25.6548f, -12.3659f), new Vector3(0f, 155f, 0f))); DicCauldrons.Add(list2[6], new SpawnCardStruct(new Vector3(-94.6071f, -25.8717f, -13.6159f), new Vector3(0f, 135f, 0f))); } private void CauldronHacked_SetPickupIndex(ShopTerminalBehavior self, out List listLunarItem) { listLunarItem = new List(); if (((Object)self).name.EndsWith("Yellow")) { listLunarItem.AddRange(Run.instance.availableBossDropList); } if (((Object)self).name.EndsWith("Blue")) { listLunarItem.AddRange(Run.instance.availableLunarItemDropList); } if (((Object)self).name.EndsWith("Purple")) { listLunarItem.AddRange(Run.instance.availableVoidTier1DropList); listLunarItem.AddRange(Run.instance.availableVoidTier2DropList); listLunarItem.AddRange(Run.instance.availableVoidTier3DropList); listLunarItem.AddRange(Run.instance.availableVoidBossDropList); } } private AsyncOperationHandle GetRandomLunarCauldron() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) float num = ModConfig.CauldronWhiteToGreenWeight.Value; float num2 = ModConfig.CauldronGreenToRedWeight.Value; float num3 = ModConfig.CauldronRedToWhiteWeight.Value; float num4 = ((Object.op_Implicit((Object)(object)DLC4Content.DLC4) && Run.instance.IsExpansionEnabled(DLC4Content.DLC4)) ? ModConfig.CauldronTranscendentWeight.Value : 0f); if (num < 0f) { num = 0f; } if (num2 < 0f) { num2 = 0f; } if (num3 < 0f) { num3 = 0f; } if (num4 < 0f) { num4 = 0f; } float num5 = num + num2 + num3 + num4; if (num5 == 0f) { return default(AsyncOperationHandle); } double num6 = RNG.NextDouble() * (double)num5; if (num6 < (double)num) { return LunarCauldronsCode[0]; } if (num6 < (double)(num + num2)) { return LunarCauldronsCode[1]; } if (num6 < (double)(num + num2 + num3)) { return LunarCauldronsCode[2]; } return LunarCauldronsCode[3]; } } public class BazaarCleansingPool : BazaarBase { private AsyncOperationHandle iscShrineCleanse; private AsyncOperationHandle lunarShopTerminal; private Dictionary DicLunarPools = new Dictionary(); private DirectorCard card; private bool spawned; private GameObject pool; private GameObject hoveringCoin; public override void Preload() { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) iscShrineCleanse = Addressables.LoadAssetAsync((object)"RoR2/Base/ShrineCleanse/iscShrineCleanse.asset"); lunarShopTerminal = Addressables.LoadAssetAsync((object)"RoR2/Base/LunarShopTerminal/LunarShopTerminal.prefab"); } public override void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ShopTerminalBehavior.SetPickup += new hook_SetPickup(ShopTerminalBehavior_SetPickup); } public override void RunStart() { } public override void AddDirectorCards(List cards) { card = null; if (ModConfig.CleansingPoolSectionEnabled.Value) { card = new DirectorCard("Cleansing Pool", ModConfig.CleansingPoolDirectorCost, ModConfig.CleansingPoolDirectorWeight, () => 1); cards.Add(card); } } public override void SetupBazaar() { spawned = false; pool = null; hoveringCoin = null; SpawnLatePicks(); } public override void SpawnLatePicks() { if (card != null && card.Count != 0 && !spawned) { SpawnShrineCleanse(); spawned = true; } } private void ShopTerminalBehavior_SetPickup(orig_SetPickup orig, ShopTerminalBehavior self, UniquePickup newPickup, bool newHidden) { //IL_00a0: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (ModConfig.CleansingPoolRewardsLunarCoins.Value && NetworkServer.active && Object.op_Implicit((Object)(object)self)) { if (Object.op_Implicit((Object)(object)pool) && (Object)(object)((Component)self).gameObject == (Object)(object)pool) { newPickup.pickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex); } if (Object.op_Implicit((Object)(object)hoveringCoin) && (Object)(object)((Component)self).gameObject == (Object)(object)hoveringCoin) { newPickup.pickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex); ((Component)self).gameObject.GetComponent().SetAvailable(false); } } orig.Invoke(self, newPickup, newHidden); } private void SpawnShrineCleanse() { //IL_005e: 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) //IL_0080: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) DicLunarPools.Clear(); SetLunarPool(); pool = BazaarBase.SpawnAt(((SpawnCard)iscShrineCleanse.WaitForCompletion()).prefab, DicLunarPools[0]); if (ModConfig.CleansingPoolRewardsLunarCoins.Value) { GameObject val = Object.Instantiate(lunarShopTerminal.WaitForCompletion(), DicLunarPools[0].Position, Quaternion.identity); val.transform.localPosition = new Vector3(DicLunarPools[0].Position.x, DicLunarPools[0].Position.y + 0.5f, DicLunarPools[0].Position.z); val.transform.eulerAngles = DicLunarPools[0].Rotation; ((Object)val).name = "HoveringLunarCoin"; hoveringCoin = val; NetworkServer.Spawn(val); } } private void SetLunarPool() { //IL_0016: 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) DicLunarPools.Add(0, new SpawnCardStruct(new Vector3(-71.5092f, -25.5622f, -44.2288f), new Vector3(6.4123f, 0f, 356.459f))); } } public class BazaarCommandPedestal : BazaarBase { private class Essence { public CharacterMaster owner; public Vector3 vaultPosition; } private class CommandPedestalCard : DirectorCard { public ModConfig.CommandPedestalTier tier; public override float Weight { get { if (GetTiers().Count <= 0) { return 0f; } return base.Weight; } } public CommandPedestalCard() : base("Command Pedestal", null, ModConfig.CommandPedestalDirectorWeight, () => 1) { } private static List GetTiers() { return ModConfig.CommandPedestalTiers.Where((ModConfig.CommandPedestalTier tier) => tier.weight.Value > 0f && tier.dropList(Run.instance).Count > 0).ToList(); } protected override int CheapestCost() { List tiers = GetTiers(); if (tiers.Count != 0) { return tiers.Min((ModConfig.CommandPedestalTier tier) => Math.Max(0, tier.directorCost.Value)); } return int.MaxValue; } protected override int PickCost(int credits) { WeightedSelection val = new WeightedSelection(8); foreach (ModConfig.CommandPedestalTier tier in GetTiers()) { if (Math.Max(0, tier.directorCost.Value) <= credits) { val.AddChoice(tier, tier.weight.Value); } } this.tier = val.Evaluate(Random.value); return Math.Max(0, this.tier.directorCost.Value); } } private const float SignHeight = 4.5f; private const float HiddenEssenceDepth = 5f; private const float DisplayDropHeight = 5f; private AsyncOperationHandle vaultPrefab; private AsyncOperationHandle shrineUseEffect; private CommandPedestalCard card; private bool spawned; private GameObject pedestal; private Xoroshiro128Plus rng; private bool sold; private UniquePickup offer; private bool hasOffer; private GameObject displayEssence; private readonly HashSet buyers = new HashSet(); private readonly Dictionary essences = new Dictionary(); private readonly Dictionary storedEquipment = new Dictionary(); public static BazaarCommandPedestal instance; public BazaarCommandPedestal() { instance = this; } public IEnumerable GetChoicesFor(PlayerCharacterMasterController player) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)pedestal) || !hasOffer || sold || (ModConfig.CommandPedestalInstancedPurchases.Value && buyers.Contains(player))) { return Enumerable.Empty(); } IEnumerable availableGroupFromPickupIndex = PickupTransmutationManager.GetAvailableGroupFromPickupIndex(offer.pickupIndex); return availableGroupFromPickupIndex ?? Enumerable.Empty(); } public override void Preload() { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) vaultPrefab = Addressables.LoadAssetAsync((object)"RoR2/DLC3/PowerOrbPedestal/PowerOrbVault.prefab"); shrineUseEffect = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/VFX/ShrineUseEffect.prefab"); PriceSigns.Preload(); } public override void Hook() { //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 PowerOrbPedestalManager.DoOnInteract += new hook_DoOnInteract(PowerOrbPedestalManager_DoOnInteract); GenericInteraction.RoR2_IInteractable_GetInteractability += new hook_RoR2_IInteractable_GetInteractability(GenericInteraction_GetInteractability); PickupPickerController.GetInteractability += new hook_GetInteractability(PickupPickerController_GetInteractability); PickupPickerController.CreatePickup_UniquePickup += new hook_CreatePickup_UniquePickup(PickupPickerController_CreatePickup); } public override void AddDirectorCards(List cards) { card = null; if (ModConfig.CommandPedestalSectionEnabled.Value) { card = new CommandPedestalCard(); cards.Add(card); } } public override void SetupBazaar() { spawned = false; pedestal = null; displayEssence = null; hasOffer = false; sold = false; buyers.Clear(); essences.Clear(); storedEquipment.Clear(); SpawnLatePicks(); } public override void SpawnLatePicks() { if (card != null && card.Count != 0 && !spawned) { SpawnCommandPedestal(); spawned = true; } } private bool IsBazaarChest(Component component) { if (Object.op_Implicit((Object)(object)pedestal) && Object.op_Implicit((Object)(object)component) && (Object)(object)component.gameObject == (Object)(object)pedestal) { return NetworkServer.active; } return false; } private static PlayerCharacterMasterController GetPlayer(GameObject bodyObject) { CharacterBody val = (Object.op_Implicit((Object)(object)bodyObject) ? bodyObject.GetComponent() : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.master)) { return null; } return val.master.playerCharacterMasterController; } private void PowerOrbPedestalManager_DoOnInteract(orig_DoOnInteract orig, PowerOrbPedestalManager self, GameObject interactorObject) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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) if (!IsBazaarChest((Component)(object)self)) { orig.Invoke(self, interactorObject); return; } Interactor val = (Object.op_Implicit((Object)(object)interactorObject) ? interactorObject.GetComponent() : null); CharacterBody val2 = (Object.op_Implicit((Object)(object)interactorObject) ? interactorObject.GetComponent() : null); PlayerCharacterMasterController player = GetPlayer(interactorObject); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)player)) { return; } if (storedEquipment.ContainsKey(player)) { SwapStoredEquipment(self, player, val2); } else { if (sold || (ModConfig.CommandPedestalInstancedPurchases.Value && buyers.Contains(player))) { return; } CostTypeIndex value = ModConfig.CommandPedestalCostType.Value; int price = GetPrice(); if (!Helper.CanAfford(value, price, val, val2)) { Refuse(self); } else if (ModConfig.CommandPedestalBuyToInventory.Value) { if (TryGetWaitingEssence(val2.master, out var picker)) { picker.OnInteractionBegin(val); } else if (hasOffer) { SpawnHiddenEssence(self, offer, val); } else { Refuse(self); } } else if (!hasOffer) { Refuse(self); } else { Helper.PayCost(value, price, val, val2, pedestal, rng); CompletePurchase(self, player); DropEssence(self, offer); } } } private static void Refuse(PowerOrbPedestalManager vault) { vault.DoInteractResult(false); vault.CallRpcInteractResult(false); } private void CompletePurchase(PowerOrbPedestalManager vault, PlayerCharacterMasterController player) { if (ModConfig.CommandPedestalInstancedPurchases.Value) { buyers.Add(player); UpdateSwapAvailability(player); HideDisplayFor(player); PriceSigns.HideFor(pedestal, player); PlayBuyEffect(vault); return; } sold = true; if (Object.op_Implicit((Object)(object)displayEssence)) { NetworkServer.Destroy(displayEssence); } vault.DoInteractResult(true); vault.CallRpcInteractResult(true); if (storedEquipment.ContainsKey(player)) { ((MonoBehaviour)Main.instance).StartCoroutine(UpdateSwapAvailabilityLater(player)); } foreach (PickupPickerController key in essences.Keys) { if (Object.op_Implicit((Object)(object)key)) { NetworkServer.Destroy(((Component)key).gameObject); } } essences.Clear(); } private void PlayBuyEffect(PowerOrbPedestalManager vault) { //IL_0020: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_006e: 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_0073: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (Object.op_Implicit((Object)(object)vault.activationEffectAttach) ? vault.activationEffectAttach.position : ((Component)vault).transform.position); if (Object.op_Implicit((Object)(object)vault.activationEffectPrefab)) { EffectManager.SpawnEffect(vault.activationEffectPrefab, new EffectData { origin = val }, true); } PickupDef pickupDef = PickupCatalog.GetPickupDef(offer.pickupIndex); BazaarBase.SpawnEffect(shrineUseEffect, val, Color32.op_Implicit(pickupDef?.baseColor ?? Color.white)); } private bool TryGetWaitingEssence(CharacterMaster master, out PickupPickerController picker) { foreach (KeyValuePair essence in essences) { if (Object.op_Implicit((Object)(object)essence.Key) && (Object)(object)essence.Value.owner == (Object)(object)master) { picker = essence.Key; return true; } } picker = null; return false; } private Interactability GenericInteraction_GetInteractability(orig_RoR2_IInteractable_GetInteractability orig, GenericInteraction self, Interactor activator) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (IsBazaarChest((Component)(object)self) && Object.op_Implicit((Object)(object)activator)) { CharacterBody component = ((Component)activator).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.master) && TryGetWaitingEssence(component.master, out var _)) { return (Interactability)2; } PlayerCharacterMasterController player = GetPlayer(((Component)activator).gameObject); if (Object.op_Implicit((Object)(object)player) && storedEquipment.ContainsKey(player)) { return (Interactability)2; } if (buyers.Contains(player)) { return (Interactability)0; } } return orig.Invoke(self, activator); } private void SetInteractabilityForClient(PlayerCharacterMasterController player, Interactability interactability) { //IL_00e3: 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) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0071: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) NetworkConnection val = (Object.op_Implicit((Object)(object)player.networkUser) ? ((NetworkBehaviour)player.networkUser).connectionToClient : null); NetworkIdentity component = pedestal.GetComponent(); GenericInteraction component2 = pedestal.GetComponent(); if (val == null || !val.isReady || Util.ConnectionIsLocal(val) || !Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component2)) { return; } int networkChannel = ((NetworkBehaviour)component2).GetNetworkChannel(); NetworkWriter val2 = new NetworkWriter(); val2.StartMessage((short)8); val2.Write(component.netId); Interactability interactability2 = component2.interactability; try { component2.interactability = interactability; NetworkBehaviour[] behavioursOfSameChannel = component.GetBehavioursOfSameChannel(networkChannel, false); foreach (NetworkBehaviour val3 in behavioursOfSameChannel) { uint syncVarDirtyBits = val3.m_SyncVarDirtyBits; try { val3.m_SyncVarDirtyBits = (((Object)(object)val3 == (Object)(object)component2) ? 1u : 0u); val3.OnSerialize(val2, false); } finally { val3.m_SyncVarDirtyBits = syncVarDirtyBits; } } } finally { component2.interactability = interactability2; } val2.FinishMessage(); if (!val.SendWriter(val2, networkChannel)) { Log.LogWarning("Could not update the Command Pedestal for a client."); } } private int GetPrice() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (card == null || card.tier == null) { return 0; } return Helper.GetCost(card.tier.cost.Value, ModConfig.CommandPedestalCostType.Value); } private bool TryRollPickup(out UniquePickup pickup) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) List list = ((card != null && card.tier != null) ? card.tier.dropList(Run.instance) : null); if (list == null || list.Count == 0) { pickup = UniquePickup.none; return false; } pickup = new UniquePickup(rng.NextElementUniform(list)); return true; } private static Vector3 GetEssencePosition(PowerOrbPedestalManager vault) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) return (Object.op_Implicit((Object)(object)vault.activationEffectAttach) ? vault.activationEffectAttach : ((Component)vault).transform).position + Vector3.up; } private static void DropEssence(PowerOrbPedestalManager vault, UniquePickup pickup) { //IL_0001: 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) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0028: 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_0033: 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_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) Vector3 essencePosition = GetEssencePosition(vault); CreatePickupInfo val = default(CreatePickupInfo); ((CreatePickupInfo)(ref val)).pickup = pickup; val.position = essencePosition; val.artifactFlag = (PickupArtifactFlag)1; PickupDropletController.CreatePickupDroplet(val, essencePosition, Vector3.up * 20f + ((Component)vault).transform.forward * 2f); } private void SpawnHiddenEssence(PowerOrbPedestalManager vault, UniquePickup pickup, Interactor activator) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0042: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate(CommandArtifactManager.commandCubePrefab, ((Component)vault).transform.position + Vector3.down * 5f, Quaternion.identity); obj.GetComponent().NetworkpickupState = pickup; PickupPickerController component = obj.GetComponent(); component.SetOptionsFromPickupForCommandArtifact(pickup); component.pickupThatGeneratedOptions = pickup; Rigidbody val = default(Rigidbody); if (obj.TryGetComponent(ref val)) { val.isKinematic = true; } NetworkServer.Spawn(obj); CharacterBody component2 = ((Component)activator).GetComponent(); essences[component] = new Essence { owner = (Object.op_Implicit((Object)(object)component2) ? component2.master : null), vaultPosition = GetEssencePosition(vault) }; component.OnInteractionBegin(activator); } private Interactability PickupPickerController_GetInteractability(orig_GetInteractability orig, PickupPickerController self, Interactor activator) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && essences.TryGetValue(self, out var value) && Object.op_Implicit((Object)(object)value.owner)) { CharacterBody val = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).GetComponent() : null); if (!Object.op_Implicit((Object)(object)val) || (Object)(object)val.master != (Object)(object)value.owner) { return (Interactability)0; } } return orig.Invoke(self, activator); } private void PickupPickerController_CreatePickup(orig_CreatePickup_UniquePickup orig, PickupPickerController self, UniquePickup pickupState) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !essences.TryGetValue(self, out var value)) { orig.Invoke(self, pickupState); return; } essences.Remove(self); CharacterMaster val = (Object.op_Implicit((Object)(object)self.networkUIPromptController) ? self.networkUIPromptController.currentParticipantMaster : null); CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetBody() : null); Interactor val3 = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).GetComponent() : null); PlayerCharacterMasterController val4 = (Object.op_Implicit((Object)(object)val) ? val.playerCharacterMasterController : null); PowerOrbPedestalManager val5 = (Object.op_Implicit((Object)(object)pedestal) ? pedestal.GetComponent() : null); CostTypeIndex value2 = ModConfig.CommandPedestalCostType.Value; int price = GetPrice(); if (!Object.op_Implicit((Object)(object)val5) || !Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.inventory) || !Object.op_Implicit((Object)(object)val3) || !Object.op_Implicit((Object)(object)val4) || sold || (ModConfig.CommandPedestalInstancedPurchases.Value && buyers.Contains(val4)) || !Helper.CanAfford(value2, price, val3, val2)) { if (Object.op_Implicit((Object)(object)val5)) { Refuse(val5); } } else { Helper.PayCost(value2, price, val3, val2, pedestal, rng); GiveAndStore(val2, val4, pickupState.pickupIndex, value.vaultPosition); CompletePurchase(val5, val4); } } private void GiveAndStore(CharacterBody body, PlayerCharacterMasterController player, PickupIndex pickupIndex, Vector3 vaultPosition) { //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_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) //IL_000d: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) EquipmentIndex val = Helper.GivePickup(body, pickupIndex, vaultPosition, dropReplacedEquipmentAsPickupDroplet: false); if ((int)val == -1) { storedEquipment.Remove(player); return; } storedEquipment[player] = val; Helper.CreateItemTakenOrb(body.corePosition, pedestal, PickupCatalog.FindPickupIndex(val)); } private void SwapStoredEquipment(PowerOrbPedestalManager vault, PlayerCharacterMasterController player, CharacterBody body) { //IL_0007: 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_001d: 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_0024: Unknown result type (might be due to invalid IL or missing references) EquipmentIndex val = storedEquipment[player]; storedEquipment.Remove(player); GiveAndStore(body, player, PickupCatalog.FindPickupIndex(val), GetEssencePosition(vault)); UpdateSwapAvailability(player); } private void UpdateSwapAvailability(PlayerCharacterMasterController player) { SetInteractabilityForClient(player, (Interactability)(storedEquipment.ContainsKey(player) ? 2 : 0)); } private IEnumerator UpdateSwapAvailabilityLater(PlayerCharacterMasterController player) { yield return (object)new WaitForSecondsRealtime(0.5f); if (Object.op_Implicit((Object)(object)pedestal) && Object.op_Implicit((Object)(object)player)) { UpdateSwapAvailability(player); } } private void HideDisplayFor(PlayerCharacterMasterController player) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) NetworkIdentity val = (Object.op_Implicit((Object)(object)displayEssence) ? displayEssence.GetComponent() : null); NetworkConnection val2 = (Object.op_Implicit((Object)(object)player.networkUser) ? ((NetworkBehaviour)player.networkUser).connectionToClient : null); if (!Object.op_Implicit((Object)(object)val) || val2 == null) { return; } if (Util.ConnectionIsLocal(val2)) { Transform val3 = displayEssence.transform.Find("PickupDisplay"); if (Object.op_Implicit((Object)(object)val3)) { ((Component)val3).gameObject.SetActive(false); } return; } NetworkWriter val4 = new NetworkWriter(); val4.StartMessage((short)1); val4.Write(val.netId); val4.FinishMessage(); if (!val2.SendWriter(val4, QosChannelIndex.defaultReliable.intVal)) { Log.LogWarning("Could not hide the Command Pedestal's essence for a client."); } } private void SpawnDisplayEssence() { //IL_0058: 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: 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_0071: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) GameObject commandCubePrefab = CommandArtifactManager.commandCubePrefab; SphereCollider val = (Object.op_Implicit((Object)(object)commandCubePrefab) ? commandCubePrefab.GetComponent() : null); if (!Object.op_Implicit((Object)(object)val)) { return; } int num = 0; for (int i = 0; i < 32; i++) { if (!Physics.GetIgnoreLayerCollision(commandCubePrefab.layer, i)) { num |= 1 << i; } } Vector3 val2 = pedestal.transform.position + Vector3.up * 5f; RaycastHit val3 = default(RaycastHit); if (!Physics.SphereCast(val2, val.radius, Vector3.down, ref val3, 10f, num, (QueryTriggerInteraction)1)) { Log.LogWarning("Found nothing for the Command Pedestal's essence to rest on."); return; } displayEssence = Object.Instantiate(commandCubePrefab, val2 + Vector3.down * ((RaycastHit)(ref val3)).distance, Quaternion.identity); displayEssence.GetComponent().NetworkpickupState = offer; displayEssence.GetComponent().SetAvailable(false); Rigidbody val4 = default(Rigidbody); if (displayEssence.TryGetComponent(ref val4)) { val4.isKinematic = true; } NetworkServer.Spawn(displayEssence); Log.LogDebug($"The Command Pedestal's essence rests on {((Object)((RaycastHit)(ref val3)).collider).name}, {displayEssence.transform.position.y - pedestal.transform.position.y:0.00} m above the pedestal."); } private void SpawnCommandPedestal() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0035: 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_00c3: Unknown result type (might be due to invalid IL or missing references) rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong); pedestal = Object.Instantiate(vaultPrefab.WaitForCompletion(), new Vector3(-63.9613f, -26.3518f, -73.8056f), Quaternion.Euler(0f, 300f, 0f)); NetworkServer.Spawn(pedestal); hasOffer = TryRollPickup(out offer); if (hasOffer) { SpawnDisplayEssence(); } Log.LogDebug("The Command Pedestal offers " + card.tier.name + "."); PriceSigns.Apply(new List { pedestal }, GetPrice(), ModConfig.CommandPedestalCostType.Value, 4.5f); } } public class BazaarDecorate : BazaarBase { private AsyncOperationHandle TeleporterBeaconEffect; public override void Preload() { //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) TeleporterBeaconEffect = Addressables.LoadAssetAsync((object)"RoR2/Junk/Teleporter/TeleporterBeaconEffect.prefab"); } public override void Hook() { } public override void RunStart() { } public override void SetupBazaar() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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) BazaarBase.SpawnEffect(TeleporterBeaconEffect, new Vector3(-73.5143f, -22.2897f, 9.1621f), Color32.op_Implicit(Color.blue)); BazaarBase.SpawnEffect(TeleporterBeaconEffect, new Vector3(-57.0645f, -22.2698f, -0.5218f), Color32.op_Implicit(Color.blue)); BazaarBase.SpawnEffect(TeleporterBeaconEffect, new Vector3(15.7063f, -2.1074f, 2.5406f), Color32.op_Implicit(Color.blue)); BazaarBase.SpawnEffect(TeleporterBeaconEffect, new Vector3(2.5543f, -2.7093f, -8.7185f), Color32.op_Implicit(Color.blue)); } } public class DirectorCard { public readonly string name; public readonly bool allowLatePicks; private readonly ConfigEntry cost; private readonly ConfigEntry weight; private readonly Func maxCount; private readonly Func isAvailable; public int Count { get; private set; } public int Spent { get; private set; } public virtual float Weight => Mathf.Max(0f, weight.Value); public DirectorCard(string name, ConfigEntry cost, ConfigEntry weight, Func maxCount, Func isAvailable = null, bool allowLatePicks = true) { this.name = name; this.cost = cost; this.weight = weight; this.maxCount = maxCount; this.isAvailable = isAvailable; this.allowLatePicks = allowLatePicks; } public bool CanPick(int credits) { if (Weight > 0f && Count < maxCount() && (isAvailable == null || isAvailable())) { return CheapestCost() <= credits; } return false; } public int Pick(int credits) { int num = PickCost(credits); Count++; Spent += num; return num; } protected virtual int CheapestCost() { return Math.Max(0, cost.Value); } protected virtual int PickCost(int credits) { return CheapestCost(); } } public class BazaarDirector : MonoBehaviour { private static readonly Random random = new Random(); private List sections; private List cards; private int credits; public static int Credits { get { int num = ModConfig.DirectorExtraCredits.Value + ModConfig.DirectorCreditsPerStage.Value * Run.instance.stageClearCount; if (ModConfig.DirectorCreditsCap.Value < 0) { return num; } return Math.Min(num, ModConfig.DirectorCreditsCap.Value); } } public static int Spend(int credits, IEnumerable cards, string round) { List source = cards.ToList(); Dictionary dictionary = new Dictionary(); int num = credits; while (true) { List list = source.Where((DirectorCard card) => card.CanPick(credits)).ToList(); if (list.Count == 0) { break; } double num2 = random.NextDouble() * (double)list.Sum((DirectorCard card) => card.Weight); DirectorCard directorCard = list[list.Count - 1]; foreach (DirectorCard item in list) { if (num2 < (double)item.Weight) { directorCard = item; break; } num2 -= (double)item.Weight; } credits -= directorCard.Pick(credits); dictionary[directorCard] = dictionary.GetValueOrDefault(directorCard) + 1; } string text = ((dictionary.Count == 0) ? "nothing" : string.Join(", ", dictionary.Select((KeyValuePair pick) => $"{pick.Value}x {pick.Key.name}"))); Log.LogInfo($"Director ({round}): {num} credits bought {text}; {credits} left."); return credits; } public static void Create(List sections, List cards, int credits) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) BazaarDirector bazaarDirector = new GameObject("BazaarDirector").AddComponent(); bazaarDirector.sections = sections; bazaarDirector.cards = cards; bazaarDirector.credits = credits; } private IEnumerator Start() { yield return null; if (!NetworkServer.active) { yield break; } int num = 0; foreach (BazaarBase section in sections) { try { num += section.CheckAfterSetup(); } catch (Exception arg) { Log.LogError($"Could not check {section.GetType().Name} after setup: {arg}"); } } if (num > 0) { Spend(credits + num, cards.Where((DirectorCard card) => card.allowLatePicks), "late"); foreach (BazaarBase section2 in sections) { try { section2.SpawnLatePicks(); } catch (Exception arg2) { Log.LogError($"Could not spawn the late picks of {section2.GetType().Name}: {arg2}"); } } } Object.Destroy((Object)(object)((Component)this).gameObject); } } public class BazaarDonate : BazaarBase { private AsyncOperationHandle altarPrefab; private AsyncOperationHandle LevelUpEffect; private AsyncOperationHandle MoneyPackPickupEffect; private AsyncOperationHandle TeamWarCryActivation; private AsyncOperationHandle ShrineUseEffect; private readonly Dictionary donationsDuringRun = new Dictionary(); private DirectorCard card; private bool spawned; private GameObject altar; private static readonly Vector3 AltarSignOffset = new Vector3(1.5534f, 1.1769f, -0.1835f); private static readonly Quaternion AltarSignRotation = Quaternion.Euler(0f, 270f, 0f); private readonly ManualLogSource rewardLog = new ManualLogSource("BazaarIsMyHaven"); private readonly HashSet loggedRewardWarnings = new HashSet(); public BazaarDonate() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown rewardLog.LogEvent += delegate(object sender, LogEventArgs args) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) string text = args.Data?.ToString(); if (text != null && loggedRewardWarnings.Add(text)) { Log.GetSource().Log(args.Level, (object)text); } }; } public override void Preload() { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) altarPrefab = Addressables.LoadAssetAsync((object)"RoR2/DLC1/DeepVoidPortalBattery/DeepVoidPortalBattery.prefab"); LevelUpEffect = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/VFX/LevelUpEffect.prefab"); MoneyPackPickupEffect = Addressables.LoadAssetAsync((object)"RoR2/Base/BonusGoldPackOnKill/MoneyPackPickupEffect.prefab"); TeamWarCryActivation = Addressables.LoadAssetAsync((object)"RoR2/Base/TeamWarCry/TeamWarCryActivation.prefab"); ShrineUseEffect = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/VFX/ShrineUseEffect.prefab"); DonationRewardDisplay.Preload(); PriceSigns.Preload(); } public override void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin); } public override void RunStart() { donationsDuringRun.Clear(); loggedRewardWarnings.Clear(); } public override void RunEnd() { donationsDuringRun.Clear(); } public override void AddDirectorCards(List cards) { card = null; if (ModConfig.DonateSectionEnabled.Value) { card = new DirectorCard("Donation Altar", ModConfig.DonateDirectorCost, ModConfig.DonateDirectorWeight, () => 1); cards.Add(card); } } public override void SetupBazaar() { spawned = false; altar = null; SpawnLatePicks(); } public override void SpawnLatePicks() { if (card != null && card.Count != 0 && !spawned) { SpawnDonateAltar(); spawned = true; } } private void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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) //IL_0120: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_0192: Unknown result type (might be due to invalid IL or missing references) if (ModConfig.EnableMod.Value && ModConfig.DonateSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && Object.op_Implicit((Object)(object)altar) && (Object)(object)((Component)self).gameObject == (Object)(object)altar) { CharacterBody val = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).GetComponent() : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.master) || !Object.op_Implicit((Object)(object)val.inventory)) { return; } PlayerCharacterMasterController playerCharacterMasterController = val.master.playerCharacterMasterController; if (!Object.op_Implicit((Object)(object)playerCharacterMasterController) || !self.available || self.cost < 0 || !self.CanBeAffordedByInteractor(activator)) { return; } PlayerStruct playerStruct = Main.instance.GetPlayerStruct(playerCharacterMasterController); if (CanGetReward(playerCharacterMasterController) && TryGetReward(val.bodyIndex, donationsDuringRun.GetValueOrDefault(playerCharacterMasterController), out var resolvedItems, out var tier)) { Helper.PayCost(self.costType, self.cost, activator, val, ((Component)self).gameObject, self.rng); Helper.GivePickups(val, resolvedItems, ((Component)self).transform.position + Vector3.up * 6f, dropReplacedEquipmentsAsPickupDroplets: false); playerStruct.RewardCount++; donationsDuringRun[playerCharacterMasterController] = donationsDuringRun.GetValueOrDefault(playerCharacterMasterController) + 1; ShowRewardEffects(self, val, resolvedItems, tier); BazaarBase.SpawnEffect(ShrineUseEffect, ((Component)self).transform.position, new Color32((byte)64, (byte)127, byte.MaxValue, byte.MaxValue), 5f); DonationRewardDisplay component = ((Component)self).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.ShowNextReward(playerCharacterMasterController); } if (!CanGetReward(playerCharacterMasterController)) { DisableFor(playerCharacterMasterController); } } } else { orig.Invoke(self, activator); } } private void DisableFor(PlayerCharacterMasterController pc) { InstancedPurchase instancedPurchase = default(InstancedPurchase); if (Object.op_Implicit((Object)(object)altar) && altar.TryGetComponent(ref instancedPurchase)) { InstancedPurchaseStruct orCreate = instancedPurchase.GetOrCreate(pc); if (orCreate.available) { orCreate.available = false; InstancedPurchases.UpdatePlayer(altar, pc); PriceSigns.HideFor(altar, pc); } } } private bool CanGetReward(PlayerCharacterMasterController pc) { if (Main.instance.GetPlayerStruct(pc).RewardCount < ModConfig.DonateRewardLimitPerVisit.Value) { return donationsDuringRun.GetValueOrDefault(pc) < ModConfig.DonateRewardLimitPerRun.Value; } return false; } private Dictionary RollReward(PlayerCharacterMasterController pc) { //IL_0047: 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_004e: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) CharacterMaster master = pc.master; if (!Object.op_Implicit((Object)(object)master) || !CanGetReward(pc)) { return null; } CharacterBody body = master.GetBody(); BodyIndex bodyIndex = (BodyIndex)((!Object.op_Implicit((Object)(object)body)) ? ((!Object.op_Implicit((Object)(object)master.bodyPrefab)) ? (-1) : ((int)BodyCatalog.FindBodyIndex(master.bodyPrefab))) : ((int)body.bodyIndex)); if (!TryGetReward(bodyIndex, donationsDuringRun.GetValueOrDefault(pc), out var resolvedItems, out var _)) { return null; } return resolvedItems; } private bool TryGetReward(BodyIndex bodyIndex, int donations, out Dictionary resolvedItems, out int tier) { //IL_01eb: Unknown result type (might be due to invalid IL or missing references) tier = 0; resolvedItems = new Dictionary(); List<(float, int)> list = new List<(float, int)> { (ModConfig.DonateRewardList1Weight.Value, 1), (ModConfig.DonateRewardList2Weight.Value, 2), (ModConfig.DonateRewardList3Weight.Value, 3), (ModConfig.DonateRewardListCharacterWeight.Value, 4) }; list.RemoveAll(((float weight, int tier) item) => item.weight <= 0f); if (list.Count == 0) { rewardLog.LogWarning((object)"No donation lists with a valid weight; the Donation Altar gives no rewards."); return false; } if (ModConfig.DonateSequentialRewardLists.Value) { list.Sort(((float weight, int tier) a, (float weight, int tier) b) => b.weight.CompareTo(a.weight)); tier = list[donations % list.Count].Item2; } else { double num = RNG.NextDouble() * (double)list.Sum<(float, int)>(((float weight, int tier) item) => item.weight); tier = list[list.Count - 1].Item2; foreach (var item in list) { if (num < (double)item.Item1) { tier = item.Item2; break; } num -= (double)item.Item1; } } switch (tier) { case 1: ParseRewards(ModConfig.DonateRewardList1.Value, resolvedItems); break; case 2: ParseRewards(ModConfig.DonateRewardList2.Value, resolvedItems); break; case 3: ParseRewards(ModConfig.DonateRewardList3.Value, resolvedItems); break; case 4: { if (!ModConfig.DonateRewardListCharacters.TryGetValue(bodyIndex, out var value) || !ParseRewards(value.Value, resolvedItems)) { ParseRewards(ModConfig.DonateRewardListCharacterDefault.Value, resolvedItems); } break; } } if (resolvedItems.Count == 0) { rewardLog.LogWarning((object)"A donation list has no valid rewards; donations that choose it charge no coins."); return false; } return true; } private bool ParseRewards(string rewardList, Dictionary resolvedItems) { //IL_002b: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 resolvedItems.Clear(); ItemStringParser.ParseItemString(rewardList, resolvedItems, rewardLog, false, -1); KeyValuePair[] array = resolvedItems.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair keyValuePair = array[i]; PickupDef pickupDef = PickupCatalog.GetPickupDef(keyValuePair.Key); if (keyValuePair.Value <= 0 || pickupDef == null || ((int)pickupDef.itemIndex == -1 && (int)pickupDef.equipmentIndex == -1)) { resolvedItems.Remove(keyValuePair.Key); } } return resolvedItems.Count > 0; } private void ShowRewardEffects(PurchaseInteraction self, CharacterBody characterBody, Dictionary resolvedItems, int tier) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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) ChatHelper.DonationThanks(characterBody, resolvedItems, tier); BazaarBase.SpawnEffect(LevelUpEffect, ((Component)self).transform.position, new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 3f); BazaarBase.SpawnEffect(MoneyPackPickupEffect, ((Component)self).transform.position, new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 3f); BazaarBase.SpawnEffect(TeamWarCryActivation, ((Component)self).transform.position, new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), 3f); } private void SpawnDonateAltar() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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) altar = Object.Instantiate(altarPrefab.WaitForCompletion(), new Vector3(-114.4226f, -22.6017f, -49.9827f), Quaternion.Euler(0f, 300f, 0f)); PurchaseInteraction component = altar.GetComponent(); int cost = (component.Networkcost = (component.cost = Helper.GetCost(ModConfig.DonateCost.Value, ModConfig.DonateCostType.Value))); component.NetworkcostType = ModConfig.DonateCostType.Value; component.NetworkdisplayNameToken = "NEWT_STATUE_NAME"; component.NetworkcontextToken = "NEWT_STATUE_CONTEXT"; DonationRewardDisplay.Apply(altar, RollReward); altar.AddComponent().original.available = true; NetworkServer.Spawn(altar); VoidSignalBeam.Remove(altar); PriceSigns.Apply(altar, altar.transform.TransformPoint(AltarSignOffset), altar.transform.rotation * AltarSignRotation, cost, ModConfig.DonateCostType.Value); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance) && !CanGetReward(instance)) { DisableFor(instance); } } } } public class BazaarDrones : BazaarBase { private class Station { public DirectorCard card; public AsyncOperationHandle prefab; public SpawnCardStruct slot; public bool spawned; public GameObject instance; } private AsyncOperationHandle DroneCombinerStation; private AsyncOperationHandle DroneUpgradeStation; private AsyncOperationHandle DroneScrapper; private AsyncOperationHandle TripleDroneShop; private readonly List stations = new List(); private Station upgradeStation; private Station tripleDroneShop; public override void Preload() { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) DroneCombinerStation = Addressables.LoadAssetAsync((object)"RoR2/DLC3/DroneCombinerStation/DroneCombinerStation.prefab"); DroneUpgradeStation = Addressables.LoadAssetAsync((object)"RoR2/DLC3/DroneAssemblyStation/DroneAssemblyStation.prefab"); DroneScrapper = Addressables.LoadAssetAsync((object)"RoR2/DLC3/DroneScrapper/DroneScrapper.prefab"); TripleDroneShop = Addressables.LoadAssetAsync((object)"RoR2/DLC3/TripleDroneShop/TripleDroneShop.prefab"); PriceSigns.Preload(); } public override void Hook() { //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 Stage.RespawnAllNPCs += new hook_RespawnAllNPCs(Stage_RespawnAllNPCs); PickupPickerController.GetInteractability += new hook_GetInteractability(PickupPickerController_GetInteractability); PurchaseInteraction.GetInteractability += new hook_GetInteractability(PurchaseInteraction_GetInteractability); DroneVendorMultiShopController.Start += new hook_Start(DroneVendorMultiShopController_Start); DroneVendorMultiShopController.ResetDroneVendor += new hook_ResetDroneVendor(DroneVendorMultiShopController_ResetDroneVendor); } private static bool IsSectionActive() { if (ModConfig.DronesSectionEnabled.Value && Object.op_Implicit((Object)(object)DLC3Content.DLC3) && Object.op_Implicit((Object)(object)Run.instance)) { return Run.instance.IsExpansionEnabled(DLC3Content.DLC3); } return false; } public override void AddDirectorCards(List cards) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) stations.Clear(); upgradeStation = null; tripleDroneShop = null; if (IsSectionActive()) { AddStation(cards, "Drone Combiner Station", ModConfig.DronesDroneCombinerStationDirectorCost, ModConfig.DronesDroneCombinerStationDirectorWeight, DroneCombinerStation, new SpawnCardStruct(new Vector3(-81.4188f, -23.0829f, -3.7793f), new Vector3(0f, 165f, 350f))); upgradeStation = AddStation(cards, "Drone Upgrade Station", ModConfig.DronesDroneUpgradeStationDirectorCost, ModConfig.DronesDroneUpgradeStationDirectorWeight, DroneUpgradeStation, new SpawnCardStruct(new Vector3(-85.1751f, -22.264f, -3.539f), new Vector3(0f, 150f, 270f))); AddStation(cards, "Drone Scrapper", ModConfig.DronesDroneScrapperDirectorCost, ModConfig.DronesDroneScrapperDirectorWeight, DroneScrapper, new SpawnCardStruct(new Vector3(-92.3398f, -26.1678f, -51.8777f), new Vector3(0f, 315f, 0f))); tripleDroneShop = AddStation(cards, "Triple Drone Shop", ModConfig.DronesTripleDroneShopDirectorCost, ModConfig.DronesTripleDroneShopDirectorWeight, TripleDroneShop, new SpawnCardStruct(new Vector3(-64.3101f, -23.0074f, -19.7406f), new Vector3(0f, 300f, 6f))); } } private Station AddStation(List cards, string name, ConfigEntry cost, ConfigEntry weight, AsyncOperationHandle prefab, SpawnCardStruct slot) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) Station station = new Station { card = new DirectorCard(name, cost, weight, () => 1), prefab = prefab, slot = slot }; stations.Add(station); cards.Add(station.card); return station; } public override void SetupBazaar() { SpawnLatePicks(); } public override void SpawnLatePicks() { foreach (Station station in stations) { if (station.card.Count != 0 && !station.spawned) { station.instance = BazaarBase.SpawnAt(station.prefab.WaitForCompletion(), station.slot); station.spawned = true; } } } private void Stage_RespawnAllNPCs(orig_RespawnAllNPCs orig, Stage self) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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) orig.Invoke(self); if (!ModConfig.EnableMod.Value || !IsCurrentMapInBazaar() || !IsSectionActive() || !Object.op_Implicit((Object)(object)self.sceneDef) || !self.sceneDef.suppressNpcEntry) { return; } Transform playerSpawnTransform = self.GetPlayerSpawnTransform(); ReadOnlyCollection readOnlyInstancesList = CharacterMaster.readOnlyInstancesList; for (int i = 0; i < readOnlyInstancesList.Count; i++) { CharacterMaster val = readOnlyInstancesList[i]; if (!IsPlayerDrone(val) || Object.op_Implicit((Object)(object)val.GetBodyObject()) || !Util.IsDontDestroyOnLoad(((Component)val).gameObject)) { continue; } Vector3 val2 = Vector3.zero; Quaternion val3 = Quaternion.identity; if (Object.op_Implicit((Object)(object)playerSpawnTransform)) { val2 = playerSpawnTransform.position; val3 = playerSpawnTransform.rotation; BaseAI component = ((Component)val).GetComponent(); CharacterBody component2 = val.bodyPrefab.GetComponent(); NodeGraph val4 = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2)) ? component.GetDesiredSpawnNodeGraph() : null); if (Object.op_Implicit((Object)(object)val4)) { List list = new List(); val4.FindNodesInRange(val2, 10f, 100f, (HullMask)(1 << (int)component2.hullClassification), list); if (list.Count > 0) { val4.GetNodePosition(list[Random.Range(0, list.Count)], ref val2); } } } val.Respawn(val2, val3, true); } } private void DroneVendorMultiShopController_Start(orig_Start orig, DroneVendorMultiShopController self) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Invalid comparison between Unknown and I4 //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || tripleDroneShop == null || !Object.op_Implicit((Object)(object)tripleDroneShop.instance) || (Object)(object)((Component)self).gameObject != (Object)(object)tripleDroneShop.instance || !Object.op_Implicit((Object)(object)Run.instance)) { orig.Invoke(self); return; } float num = Mathf.Max(0f, ModConfig.DronesTripleDroneShopCommonWeight.Value); float num2 = Mathf.Max(0f, ModConfig.DronesTripleDroneShopUncommonWeight.Value); if (num + num2 <= 0f) { num = 1f; } self.tier1Chance = new RangeFloat { min = num, max = num }; self.tier2Chance = new RangeFloat { min = num2, max = num2 }; self.tier3Chance = new RangeFloat { min = 0f, max = 0f }; self.baseCostTier1 = ModConfig.DronesTripleDroneShopCommonCost.Value; self.baseCostTier2 = ModConfig.DronesTripleDroneShopUncommonCost.Value; CostTypeIndex val = (self.costType = ModConfig.DronesTripleDroneShopCostType.Value); Run instance = Run.instance; int stageClearCount = instance.stageClearCount; instance.stageClearCount = Mathf.Max(stageClearCount, 3); try { orig.Invoke(self); } finally { instance.stageClearCount = stageClearCount; } int num3 = (self.Networkcost = Helper.GetCost(self.baseCost, val)); DroneVendorTerminalBehavior[] array = (DroneVendorTerminalBehavior[])(((object)self._terminals) ?? ((object)new DroneVendorTerminalBehavior[0])); foreach (DroneVendorTerminalBehavior val2 in array) { if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.purchaseInteraction)) { val2.purchaseInteraction.Networkcost = num3; } } if ((int)val != 1) { HologramProjector component = ((Component)self).GetComponent(); Transform val3 = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.hologramPivot)) ? component.hologramPivot : ((Component)self).transform); self.Networkavailable = false; PriceSigns.Apply(((Component)self).gameObject, val3.position, ((Component)self).transform.rotation * Quaternion.Euler(0f, 180f, 0f), num3, val); } } private void DroneVendorMultiShopController_ResetDroneVendor(orig_ResetDroneVendor orig, DroneVendorMultiShopController self) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 orig.Invoke(self); if (NetworkServer.active && tripleDroneShop != null && Object.op_Implicit((Object)(object)tripleDroneShop.instance) && (Object)(object)((Component)self).gameObject == (Object)(object)tripleDroneShop.instance && (int)self.costType != 1) { self.Networkavailable = false; } } private Interactability PickupPickerController_GetInteractability(orig_GetInteractability orig, PickupPickerController self, Interactor activator) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!RefusesUpgrade(((Component)self).gameObject, activator)) { return orig.Invoke(self, activator); } return (Interactability)1; } private Interactability PurchaseInteraction_GetInteractability(orig_GetInteractability orig, PurchaseInteraction self, Interactor activator) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!RefusesUpgrade(((Component)self).gameObject, activator)) { return orig.Invoke(self, activator); } return (Interactability)1; } private bool RefusesUpgrade(GameObject interactable, Interactor activator) { if (upgradeStation == null || !Object.op_Implicit((Object)(object)upgradeStation.instance) || (Object)(object)interactable != (Object)(object)upgradeStation.instance || !Object.op_Implicit((Object)(object)activator)) { return false; } CharacterBody component = ((Component)activator).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.master)) { return !HasDrones(component.master); } return true; } private static bool HasDrones(CharacterMaster owner) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) MinionGroup val = MinionGroup.FindGroup(((NetworkBehaviour)owner).netId); if (val == null) { return false; } MinionOwnership[] members = val.members; foreach (MinionOwnership val2 in members) { CharacterMaster val3 = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).GetComponent() : null); CharacterBody val4 = (Object.op_Implicit((Object)(object)val3) ? val3.GetBody() : null); if (Object.op_Implicit((Object)(object)val4) && (val4.bodyFlags & 0x400000) != 0) { return true; } } return false; } private static bool IsPlayerDrone(CharacterMaster master) { //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_0061: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.bodyPrefab) || !Object.op_Implicit((Object)(object)master.minionOwnership)) { return false; } CharacterMaster ownerMaster = master.minionOwnership.ownerMaster; CharacterBody val = default(CharacterBody); if (Object.op_Implicit((Object)(object)ownerMaster) && Object.op_Implicit((Object)(object)ownerMaster.playerCharacterMasterController) && master.bodyPrefab.TryGetComponent(ref val)) { return (val.bodyFlags & 0x400000) > 0; } return false; } } public class BazaarEquipment : BazaarBase { private AsyncOperationHandle multiShopEquipmentTerminal; private Dictionary DicEquipments = new Dictionary(); private DirectorCard card; private int spawned; private PlayerCharacterMasterController currentActivator; public override void Preload() { //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) multiShopEquipmentTerminal = Addressables.LoadAssetAsync((object)"RoR2/Base/MultiShopEquipmentTerminal/MultiShopEquipmentTerminal.prefab"); PriceSigns.Preload(); } public override void Hook() { //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 PurchaseInteraction.Awake += new hook_Awake(PurchaseInteraction_Awake); PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin); ShopTerminalBehavior.DropPickup += new hook_DropPickup(ShopTerminalBehavior_DropPickup); ShopTerminalBehavior.GenerateNewPickupServer_bool += new hook_GenerateNewPickupServer_bool(ShopTerminalBehavior_GenerateNewPickupServer_bool); } public override void RunStart() { } public override void AddDirectorCards(List cards) { card = null; if (ModConfig.EquipmentSectionEnabled.Value) { card = new DirectorCard("Equipment Terminal", ModConfig.EquipmentDirectorCost, ModConfig.EquipmentDirectorWeight, GetMaxTerminals); cards.Add(card); } } public override void SetupBazaar() { if (card != null) { DicEquipments.Clear(); SetEquipment(); spawned = 0; SpawnLatePicks(); } } private static int GetMaxTerminals() { return Math.Min(ModConfig.EquipmentMaxAmount.Value, ModConfig.EquipmentReplaceLunarSeersWithEquipment.Value ? 5 : 3); } public void PurchaseInteraction_Awake(orig_Awake orig, PurchaseInteraction self) { //IL_005c: 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) orig.Invoke(self); if (ModConfig.EnableMod.Value && ModConfig.EquipmentSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ModConfig.EquipmentMaxAmount.Value > 0 && ((Object)self).name.StartsWith("MultiShopEquipmentTerminal")) { self.Networkcost = (self.cost = Helper.GetCost(ModConfig.EquipmentCost.Value, ModConfig.EquipmentCostType.Value)); self.NetworkcostType = ModConfig.EquipmentCostType.Value; } } private void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (ModConfig.EnableMod.Value && ModConfig.EquipmentSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("MultiShopEquipmentTerminal")) { CharacterBody val = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).GetComponent() : null); PlayerCharacterMasterController player = ((Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.master)) ? val.master.playerCharacterMasterController : null); PlayerCharacterMasterController val2 = currentActivator; try { currentActivator = player; if (FreeSwaps.IsFreeFor((Component)(object)self, player)) { FreeSwaps.RunFree(self, delegate { orig.Invoke(self, activator); return true; }); } else { orig.Invoke(self, activator); } return; } finally { currentActivator = val2; } } orig.Invoke(self, activator); } private void ShopTerminalBehavior_DropPickup(orig_DropPickup orig, ShopTerminalBehavior self) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e7: Unknown result type (might be due to invalid IL or missing references) if (ModConfig.EnableMod.Value && ModConfig.EquipmentSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("MultiShopEquipmentTerminal")) { if (ModConfig.EquipmentBuyToInventory.Value) { CharacterBody val = ((Object.op_Implicit((Object)(object)currentActivator) && Object.op_Implicit((Object)(object)currentActivator.master)) ? currentActivator.master.GetBody() : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.inventory)) { orig.Invoke(self); return; } EquipmentIndex val2 = Helper.GivePickup(val, self.CurrentPickup().pickupIndex, ((Component)self).transform.position, dropReplacedEquipmentAsPickupDroplet: false); if ((int)val2 != -1) { Helper.CreateItemTakenOrb(val.corePosition, ((Component)self).gameObject, PickupCatalog.FindPickupIndex(val2)); self.SetPickup(new UniquePickup(PickupCatalog.FindPickupIndex(val2)), false); ((Component)self).GetComponent().SetAvailable(true); bool num = !FreeSwaps.IsFreeFor((Component)(object)self, currentActivator); FreeSwaps.BuySlot(((Component)self).gameObject, currentActivator); PriceSigns.HideFor(((Component)self).gameObject, currentActivator); if (num) { InstancedPurchases.PlayBuySound(self, currentActivator); } } else { self.SetHasBeenPurchased(true); self.SetNoPickup(); } } else { orig.Invoke(self); self.SetNoPickup(); } } else { orig.Invoke(self); } } private void ShopTerminalBehavior_GenerateNewPickupServer_bool(orig_GenerateNewPickupServer_bool orig, ShopTerminalBehavior self, bool newHidden) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if (ModConfig.EnableMod.Value && ModConfig.EquipmentSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("MultiShopEquipmentTerminal") && Run.instance.stageRng.nextNormalizedFloat < ModConfig.EquipmentReplaceWithEliteChance.Value) { Dictionary dictionary = new Dictionary(); ItemStringParser.ParseItemString(ModConfig.EquipmentReplaceWithEliteList.Value, dictionary, Log.GetSource(), false, -1); bool flag = false; foreach (var (val2, num2) in dictionary) { if (num2 > 0) { self.SetPickup(new UniquePickup(val2), newHidden); flag = true; return; } } if (!flag) { Log.LogError("Could not get a proper pickup index from EquipmentReplaceWithEliteList: " + ModConfig.EquipmentReplaceWithEliteList.Value); } } orig.Invoke(self, newHidden); } private void SetEquipment() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) List list = new List { 0, 1, 2 }; if (ModConfig.EquipmentReplaceLunarSeersWithEquipment.Value) { list = new List { 2, 3, 4 }; DicEquipments.Add(0, new SpawnCardStruct(new Vector3(-133.9731f, -23.4f, -10.71112f), new Vector3(0f, 120f, 0f))); DicEquipments.Add(1, new SpawnCardStruct(new Vector3(-128.0793f, -23.4f, -7.056283f), new Vector3(0f, 160f, 0f))); } List list2 = new List(); while (list.Count > 0) { int index = RNG.Next(list.Count); list2.Add(list[index]); list.RemoveAt(index); } DicEquipments.Add(list2[0], new SpawnCardStruct(new Vector3(-139.5818f, -23.561f, -1.7491f), new Vector3(0f, 175f, 0f))); DicEquipments.Add(list2[1], new SpawnCardStruct(new Vector3(-136.5639f, -23.7163f, -0.5618f), new Vector3(0f, 145f, 0f))); DicEquipments.Add(list2[2], new SpawnCardStruct(new Vector3(-134.82f, -23.36f, 1.85f), new Vector3(0f, 105f, 0f))); } public override void SpawnLatePicks() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (card == null || card.Count <= spawned) { return; } List list = BazaarBase.SpawnInSlots(DicEquipments, multiShopEquipmentTerminal.WaitForCompletion(), spawned, card.Count - spawned); spawned = card.Count; list.ForEach(delegate(GameObject gameObject) { //IL_0038: 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) PurchaseInteraction component = gameObject.GetComponent(); ShopTerminalBehavior component2 = gameObject.GetComponent(); if (ModConfig.EquipmentInstancedPurchases.Value) { InstancedPurchase instancedPurchase = gameObject.AddComponent(); instancedPurchase.original.available = component.available; instancedPurchase.original.pickup = component2.pickup; instancedPurchase.original.hasBeenPurchased = component2.hasBeenPurchased; } }); PriceSigns.Apply(list, Helper.GetCost(ModConfig.EquipmentCost.Value, ModConfig.EquipmentCostType.Value), ModConfig.EquipmentCostType.Value, 5.25f); } } public class BazaarLunarShop : BazaarBase { private const string LunarShopObjectName = "LunarShopTerminal_BazaarIsMyHaven"; private AsyncOperationHandle lunarShopBud; private AsyncOperationHandle LunarRerollEffect; private Dictionary DicLunarShopTerminals = new Dictionary(); private int generateNewPickupIndex; private int lunarRecyclerRerolledCount; private List ObjectLunarShopTerminals_Spawn = new List(); private DirectorCard card; private PlayerCharacterMasterController currentActivator; private Dictionary> whichStallsHaveBeenBoughtOnce = new Dictionary>(); public override void Preload() { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) lunarShopBud = Addressables.LoadAssetAsync((object)"RoR2/Base/LunarShopTerminal/LunarShopTerminal.prefab"); LunarRerollEffect = Addressables.LoadAssetAsync((object)"RoR2/Base/LunarRecycler/LunarRerollEffect.prefab"); LunarBudScaleSync.Preload(); } public override void Hook() { //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 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown PurchaseInteraction.Awake += new hook_Awake(PurchaseInteraction_Awake); PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin); PurchaseInteraction.ScaleCost += new hook_ScaleCost(PurchaseInteraction_ScaleCost); PurchaseInteraction.SetAvailable += new hook_SetAvailable(PurchaseInteraction_SetAvailable); ShopTerminalBehavior.DropPickup += new hook_DropPickup(ShopTerminalBehavior_DropPickup); ShopTerminalBehavior.GenerateNewPickupServer_bool += new hook_GenerateNewPickupServer_bool(ShopTerminalBehavior_GenerateNewPickupServer_bool); SceneManager.sceneUnloaded += SceneUnloaded; } public override void RunStart() { RunEnd(); } public override void RunEnd() { ObjectLunarShopTerminals_Spawn.Clear(); whichStallsHaveBeenBoughtOnce.Clear(); currentActivator = null; } private void SceneUnloaded(Scene scene) { if (((Scene)(ref scene)).name == "bazaar") { RunEnd(); } } public override void AddDirectorCards(List cards) { card = null; if (ModConfig.LunarShopSectionEnabled.Value) { card = new DirectorCard("Lunar Bud", ModConfig.LunarShopDirectorCost, ModConfig.LunarShopDirectorWeight, () => ModConfig.LunarShopMaxAmount.Value, null, allowLatePicks: false); cards.Add(card); } } public override void SetupBazaar() { lunarRecyclerRerolledCount = 0; if (card != null) { generateNewPickupIndex = 0; whichStallsHaveBeenBoughtOnce.Clear(); SpawnLunarShopTerminal(); } RemoveLunarRecycler(); } private void RemoveLunarRecycler() { bool num = ModConfig.LunarRecyclerSectionEnabled.Value && (!ModConfig.LunarRecyclerAvailable.Value || ModConfig.LunarRecyclerCost.Value < 0); bool flag = card != null && card.Count == 0; if (!num && !flag) { return; } PurchaseInteraction[] array = Object.FindObjectsOfType(); foreach (PurchaseInteraction val in array) { if (((Object)val).name.StartsWith("LunarRecycler")) { NetworkServer.Destroy(((Component)val).gameObject); } } } public void PurchaseInteraction_Awake(orig_Awake orig, PurchaseInteraction self) { //IL_004f: 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) orig.Invoke(self); if (!ModConfig.EnableMod.Value || !IsCurrentMapInBazaar() || !NetworkServer.active) { return; } if (ModConfig.LunarShopSectionEnabled.Value && ((Object)self).name.StartsWith("LunarShopTerminal")) { self.NetworkcostType = ModConfig.LunarShopCostType.Value; if (ModConfig.LunarShopCost.Value >= 0) { self.Networkcost = (self.cost = Helper.GetCost(ModConfig.LunarShopCost.Value, ModConfig.LunarShopCostType.Value)); } } if (ModConfig.LunarRecyclerSectionEnabled.Value && ModConfig.LunarRecyclerAvailable.Value && ModConfig.LunarRecyclerCost.Value >= 0 && ((Object)self).name.StartsWith("LunarRecycler")) { self.cost = ModConfig.LunarRecyclerCost.Value; self.Networkcost = ModConfig.LunarRecyclerCost.Value; } } private bool TryCompletePurchase(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator, PlayerCharacterMasterController player) { bool purchaseSucceeded = false; UnityAction val = delegate(PayCostContext context, PayCostResults results) { if ((Object)(object)context.activator == (Object)(object)activator) { purchaseSucceeded = true; } }; PlayerCharacterMasterController val2 = currentActivator; ((UnityEvent)(object)self.onDetailedPurchaseServer).AddListener(val); try { currentActivator = player; orig.Invoke(self, activator); } finally { currentActivator = val2; ((UnityEvent)(object)self.onDetailedPurchaseServer).RemoveListener(val); } return purchaseSucceeded; } public void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (ModConfig.EnableMod.Value && IsCurrentMapInBazaar() && NetworkServer.active && (ModConfig.LunarShopSectionEnabled.Value || ModConfig.LunarRecyclerSectionEnabled.Value)) { CharacterBody val = (Object.op_Implicit((Object)(object)activator) ? ((Component)activator).GetComponent() : null); PlayerCharacterMasterController player = ((Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.master)) ? val.master.playerCharacterMasterController : null); if (!Object.op_Implicit((Object)(object)player)) { orig.Invoke(self, activator); return; } if (ModConfig.LunarShopSectionEnabled.Value && whichStallsHaveBeenBoughtOnce.TryGetValue(self, out var value)) { PlayerStruct playerStruct = Main.instance.GetPlayerStruct(player); bool flag = !value.Contains(player); int num = ModConfig.LunarShopBuyLimit.Value - playerStruct.LunarShopUseCount; if (flag && ModConfig.LunarShopBuyLimit.Value >= 0 && num <= 0) { ChatHelper.LunarShopTerminalUsesLeft(player, num); } else if ((FreeSwaps.IsFreeFor((Component)(object)self, player) ? FreeSwaps.RunFree(self, () => TryCompletePurchase(orig, self, activator, player)) : TryCompletePurchase(orig, self, activator, player)) && flag) { value.Add(player); playerStruct.LunarShopUseCount++; ChatHelper.LunarPurchase(); InstancedPurchase instancedPurchase = default(InstancedPurchase); if (((Component)self).TryGetComponent(ref instancedPurchase)) { instancedPurchase.GetOrCreate(player).hasBeenPurchasedOnce = true; } if (ModConfig.LunarShopBuyLimit.Value >= 0) { ChatHelper.LunarShopTerminalUsesLeft(player, ModConfig.LunarShopBuyLimit.Value - playerStruct.LunarShopUseCount); } } return; } if (((Object)self).name.StartsWith("LunarRecycler")) { if (!self.available || (ModConfig.LunarRecyclerSectionEnabled.Value && ModConfig.LunarRecyclerRerollLimit.Value >= 0 && lunarRecyclerRerolledCount >= ModConfig.LunarRecyclerRerollLimit.Value) || !TryCompletePurchase(orig, self, activator, player)) { return; } if (ModConfig.LunarRecyclerSectionEnabled.Value) { lunarRecyclerRerolledCount++; if (ModConfig.LunarRecyclerRerollLimit.Value >= 0) { int num2 = ModConfig.LunarRecyclerRerollLimit.Value - lunarRecyclerRerolledCount; ChatHelper.LunarRecyclerUsesLeft(num2); if (num2 <= 0) { self.SetAvailable(false); } } } if (!ModConfig.LunarShopSectionEnabled.Value) { return; } float num3 = 0f; { foreach (GameObject item in ObjectLunarShopTerminals_Spawn) { ((MonoBehaviour)Main.instance).StartCoroutine(DelayRerollEffect(item, num3)); num3 += 0.1f; } return; } } } orig.Invoke(self, activator); } private void PurchaseInteraction_ScaleCost(orig_ScaleCost orig, PurchaseInteraction self, float scalar) { if (ModConfig.EnableMod.Value && ModConfig.LunarRecyclerSectionEnabled.Value && ModConfig.LunarRecyclerAvailable.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarRecycler")) { scalar = ModConfig.LunarRecyclerCostMultiplier.Value; } orig.Invoke(self, scalar); } private void PurchaseInteraction_SetAvailable(orig_SetAvailable orig, PurchaseInteraction self, bool newAvailable) { if (ModConfig.EnableMod.Value && ModConfig.LunarRecyclerSectionEnabled.Value && ModConfig.LunarRecyclerAvailable.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarRecycler") && ModConfig.LunarRecyclerRerollLimit.Value >= 0) { newAvailable = newAvailable && lunarRecyclerRerolledCount < ModConfig.LunarRecyclerRerollLimit.Value; } orig.Invoke(self, newAvailable); } private void ShopTerminalBehavior_DropPickup(orig_DropPickup orig, ShopTerminalBehavior self) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Invalid comparison between Unknown and I4 //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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) if (ModConfig.EnableMod.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarShopTerminal")) { if (!ModConfig.LunarShopSectionEnabled.Value) { orig.Invoke(self); SendPurchasedFlagToClients(self); } else if (ModConfig.LunarShopBuyToInventory.Value) { CharacterBody val = ((Object.op_Implicit((Object)(object)currentActivator) && Object.op_Implicit((Object)(object)currentActivator.master)) ? currentActivator.master.GetBody() : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.inventory)) { orig.Invoke(self); SendPurchasedFlagToClients(self); self.SetNoPickup(); return; } EquipmentIndex val2 = Helper.GivePickup(val, self.CurrentPickup().pickupIndex, ((Component)self).transform.position, dropReplacedEquipmentAsPickupDroplet: false); if ((int)val2 != -1) { Helper.CreateItemTakenOrb(val.corePosition, ((Component)self).gameObject, PickupCatalog.FindPickupIndex(val2)); self.SetPickup(new UniquePickup(PickupCatalog.FindPickupIndex(val2)), false); ((Component)self).GetComponent().SetAvailable(true); bool num = !FreeSwaps.IsFreeFor((Component)(object)self, currentActivator); FreeSwaps.BuySlot(((Component)self).gameObject, currentActivator); if (num) { InstancedPurchases.PlayBuySound(self, currentActivator); } } else { self.SetHasBeenPurchased(true); SendPurchasedFlagToClients(self); self.SetNoPickup(); } } else { orig.Invoke(self); SendPurchasedFlagToClients(self); self.SetNoPickup(); } } else { orig.Invoke(self); } } private void ShopTerminalBehavior_GenerateNewPickupServer_bool(orig_GenerateNewPickupServer_bool orig, ShopTerminalBehavior self, bool newHidden) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (ModConfig.EnableMod.Value && ModConfig.LunarShopSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("LunarShopTerminal")) { if (TryGenerateLunarShopPickup(out var pickup)) { self.SetPickup(pickup, newHidden); } } else { orig.Invoke(self, newHidden); } } private void SendPurchasedFlagToClients(ShopTerminalBehavior shop) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || Object.op_Implicit((Object)(object)((Component)shop).GetComponent()) || !shop.hasBeenPurchased) { return; } NetworkIdentity component = ((Component)shop).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || component.observers == null) { return; } int networkChannel = ((NetworkBehaviour)shop).GetNetworkChannel(); NetworkWriter val = new NetworkWriter(); val.StartMessage((short)8); val.Write(component.netId); NetworkBehaviour[] behavioursOfSameChannel = component.GetBehavioursOfSameChannel(networkChannel, false); foreach (NetworkBehaviour val2 in behavioursOfSameChannel) { uint syncVarDirtyBits = val2.m_SyncVarDirtyBits; try { val2.m_SyncVarDirtyBits = (((Object)(object)val2 == (Object)(object)shop) ? 4u : 0u); val2.OnSerialize(val, false); } finally { val2.m_SyncVarDirtyBits = syncVarDirtyBits; } } val.FinishMessage(); foreach (NetworkConnection observer in component.observers) { if (observer.isReady && !Util.ConnectionIsLocal(observer) && !observer.SendWriter(val, networkChannel)) { Log.LogWarning("Could not send the bud purchased flag."); } } } private bool TryGenerateLunarShopPickup(out UniquePickup pickup) { //IL_0051: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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) //IL_0068: Unknown result type (might be due to invalid IL or missing references) int num = (ModConfig.LunarShopSequentialItems.Value ? generateNewPickupIndex : (-1)); Dictionary dictionary = new Dictionary(); ItemStringParser.ParseItemString(ModConfig.LunarShopItemList.Value, dictionary, Log.GetSource(), false, num); foreach (var (val2, num3) in dictionary) { if (num3 > 0 && PickupCatalog.GetPickupDef(val2) != null) { pickup = new UniquePickup(val2); generateNewPickupIndex++; return true; } } pickup = UniquePickup.none; Log.LogError("Could not get a pickup index from LunarShopItemList: " + ModConfig.LunarShopItemList.Value); return false; } private IEnumerator DelayRerollEffect(GameObject shop, float delay) { yield return (object)new WaitForSeconds(delay); if (!NetworkServer.active || !Object.op_Implicit((Object)(object)shop)) { yield break; } ShopTerminalBehavior component = shop.GetComponent(); PurchaseInteraction component2 = shop.GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component2)) { yield break; } InstancedPurchase instance = default(InstancedPurchase); if (shop.TryGetComponent(ref instance)) { if (!PlayerCharacterMasterController.instances.Any((PlayerCharacterMasterController pc) => Object.op_Implicit((Object)(object)pc) && instance.GetOrOriginal(pc).CanReroll) || !TryGenerateLunarShopPickup(out var pickup)) { yield break; } if (instance.original.CanReroll) { instance.original.pickup = pickup; instance.original.hidden = false; } foreach (InstancedPurchaseStruct value2 in instance.purchases.Values) { if (value2.CanReroll) { value2.pickup = pickup; value2.hidden = false; } } InstancedPurchases.UpdateAll(shop); } else { if ((whichStallsHaveBeenBoughtOnce.TryGetValue(component2, out var value) && value.Count > 0) || !component2.available || component.hasBeenPurchased || ((UniquePickup)(ref component.pickup)).Equals(UniquePickup.none) || !TryGenerateLunarShopPickup(out var pickup2)) { yield break; } component.SetPickup(pickup2, false); } SpawnRerollEffect(shop, instance); } private void SpawnRerollEffect(GameObject shop, InstancedPurchase instance) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0034: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0074: Expected O, but got Unknown //IL_0085: 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_008c: 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_009e: Expected O, but got Unknown if (EffectManager.DisableAllEffectSpawning) { return; } GameObject val = LunarRerollEffect.WaitForCompletion(); EffectData val2 = new EffectData { origin = shop.transform.position + Vector3.up * 2.5f, rotation = Quaternion.identity, scale = 2f, color = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue) }; if (!Object.op_Implicit((Object)(object)instance)) { EffectManager.SpawnEffect(val, val2, true); return; } EffectMessage val3 = new EffectMessage { effectIndex = EffectCatalog.FindEffectIndexFromPrefab(val), effectData = val2 }; HashSet hashSet = new HashSet(); foreach (PlayerCharacterMasterController instance2 in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance2) && instance.GetOrOriginal(instance2).CanReroll) { NetworkConnection val4 = (Object.op_Implicit((Object)(object)instance2.networkUser) ? ((NetworkBehaviour)instance2.networkUser).connectionToClient : null); if (val4 != null && val4.isReady && hashSet.Add(val4)) { val4.SendByChannel((short)52, (MessageBase)(object)val3, QosChannelIndex.effects.intVal); } } } } public static List GenerateCirclePoints(float radius, float startAngle, float endAngle, float orientation, int numberOfPoints) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) List list = new List(); float num = (endAngle - startAngle) / (float)(numberOfPoints - 1); if (numberOfPoints <= 1) { num = 0f; } for (int i = 0; i < numberOfPoints; i++) { float num2 = (startAngle + (float)i * num + orientation) * (MathF.PI / 180f); float num3 = radius * Mathf.Cos(num2); float num4 = radius * Mathf.Sin(num2); list.Add(new Vector2(num3, num4)); } return list; } private void SetLunarShopTerminal() { //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027b: 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_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: 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_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(-76.6438f, -24.0468f, -41.6449f); float orientation = 280f; float num = 140f; float num2 = 135f; float num3 = 123f; float num4 = 330f; float num5 = 325f; float num6 = 339f; List list = new List(); int count = card.Count; if ((float)count <= 10f) { if ((float)count < 10f) { float num7 = num5 - num2; num2 += num7 / ((float)count + 1f); num5 -= num7 / ((float)count + 1f); } if (count >= 3 && count < 10) { float num8 = (10f - (float)count) / 7f; float num9 = (num2 + num5) / 2f; float num10 = Mathf.Min(num5 - num2 + 90f * num8, 180f); num2 = num9 - num10 / 2f; num5 = num9 + num10 / 2f; } list = GenerateCirclePoints(4f, num2, num5, orientation, count); list.Reverse(); } else { new List(); float num11 = (float)count * 3f / 8f; float num12 = (float)count * 5f / 8f; int num13 = Mathf.RoundToInt(num11); int num14 = Mathf.RoundToInt(num12); if (num13 + num14 != count) { float num15 = MathF.PI * 2f + 3f / (float)num13; float num16 = MathF.PI * 2f + 5f / (float)(count - num13); float num17 = MathF.PI * 2f + 3f / (float)num14; float num18 = MathF.PI * 2f + 5f / (float)(count - num14); if (Math.Abs(num15 - num16) < Math.Abs(num17 - num18)) { num14 = count - num13; } else { num13 = count - num14; } } if ((float)count < 20f) { float num19 = num6 - num3; num3 += num19 / ((float)num14 + 1f); num6 -= num19 / ((float)num14 + 1f); num19 = num4 - num; num += num19 / ((float)num13 + 1f); num4 -= num19 / ((float)num13 + 1f); } List collection = GenerateCirclePoints(3f, num, num4, orientation, num13); List list2 = GenerateCirclePoints(5f, num3, num6, orientation, num14); list2.Reverse(); list.AddRange(list2); list.AddRange(collection); } Vector3 position = default(Vector3); for (int i = 0; i < list.Count; i++) { Quaternion val2 = Quaternion.LookRotation(new Vector3(0f - list[i].x, 0f, 0f - list[i].y)); if ((float)count > 10f) { Vector2 val3 = list[i]; if (((Vector2)(ref val3)).magnitude < 4f) { val2 = Quaternion.LookRotation(new Vector3(list[i].x, 0f, list[i].y)); } } val2 *= Quaternion.Euler(0f, 180f, 0f); ((Vector3)(ref position))..ctor(val.x + list[i].x, val.y, val.z + list[i].y); DicLunarShopTerminals.Add(i, new SpawnCardStruct(position, ((Quaternion)(ref val2)).eulerAngles)); } } private void DisableLunarBudPickupClearing(PurchaseInteraction purchaseInteraction, ShopTerminalBehavior shopTerminalBehavior) { PurchaseEvent onPurchase = purchaseInteraction.onPurchase; if (onPurchase == null) { Log.LogWarning("The bud's purchase event is missing"); return; } for (int i = 0; i < ((UnityEventBase)onPurchase).GetPersistentEventCount(); i++) { if (((UnityEventBase)onPurchase).GetPersistentTarget(i) == (Object)(object)shopTerminalBehavior && ((UnityEventBase)onPurchase).GetPersistentMethodName(i) == "SetNoPickup") { ((UnityEventBase)onPurchase).SetPersistentListenerState(i, (UnityEventCallState)0); } } } private void SpawnLunarShopTerminal() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) if (ModCompatibilityQoLChests.enabled) { ModCompatibilityQoLChests.RegisterQoLChestsBlacklist("LunarShopTerminal_BazaarIsMyHaven"); } ObjectLunarShopTerminals_Spawn.Clear(); DicLunarShopTerminals.Clear(); SetLunarShopTerminal(); GameObject[] array = Object.FindObjectsOfType(); foreach (GameObject val in array) { if (((Object)val).name.StartsWith("LunarShopTerminal")) { NetworkServer.Destroy(val); } } List list = BazaarBase.SpawnInSlots(DicLunarShopTerminals, lunarShopBud.WaitForCompletion(), 0, DicLunarShopTerminals.Count); ObjectLunarShopTerminals_Spawn.AddRange(list); for (int j = 0; j < list.Count; j++) { GameObject val2 = list[j]; ((Object)val2).name = "LunarShopTerminal_BazaarIsMyHaven"; val2.transform.localScale = Vector3.one; PurchaseInteraction component = val2.GetComponent(); ShopTerminalBehavior component2 = val2.GetComponent(); DisableLunarBudPickupClearing(component, component2); if (ModConfig.LunarShopInstancedPurchases.Value) { InstancedPurchase instancedPurchase = val2.AddComponent(); instancedPurchase.lunarShopIndex = j; instancedPurchase.original.available = component.available; instancedPurchase.original.pickup = component2.pickup; instancedPurchase.original.hasBeenPurchased = component2.hasBeenPurchased; instancedPurchase.original.hidden = component2.hidden; } whichStallsHaveBeenBoughtOnce.Add(component, new List()); } LunarBudScaleSync.Apply(list); } } public class BazaarPrinter : BazaarBase { private class PrinterCard : DirectorCard { public readonly List tiers = new List(); public PrinterCard() : base("Printer", null, ModConfig.PrinterDirectorWeight, () => ModConfig.PrinterMaxAmount.Value) { } protected override int CheapestCost() { List<(ItemTier, float)> tierChoices = GetTierChoices(); if (tierChoices.Count != 0) { return tierChoices.Min<(ItemTier, float)>(((ItemTier tier, float weight) choice) => GetTierCost(choice.tier)); } return int.MaxValue; } protected override int PickCost(int credits) { //IL_001d: 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_005b: 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) //IL_0067: 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) WeightedSelection val = new WeightedSelection(8); foreach (var tierChoice in GetTierChoices()) { if (GetTierCost(tierChoice.tier) <= credits) { val.AddChoice(tierChoice.tier, tierChoice.weight); } } ItemTier val2 = val.Evaluate(Random.value); tiers.Add(val2); return GetTierCost(val2); } } private AsyncOperationHandle iscDuplicator; private AsyncOperationHandle iscDuplicatorLarge; private AsyncOperationHandle iscDuplicatorMilitary; private AsyncOperationHandle iscDuplicatorWild; private AsyncOperationHandle[] PrintersCode; private Dictionary DicPrinters = new Dictionary(); private PrinterCard card; private int spawned; public override void Preload() { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) iscDuplicator = Addressables.LoadAssetAsync((object)"RoR2/Base/Duplicator/iscDuplicator.asset"); iscDuplicatorLarge = Addressables.LoadAssetAsync((object)"RoR2/Base/DuplicatorLarge/iscDuplicatorLarge.asset"); iscDuplicatorMilitary = Addressables.LoadAssetAsync((object)"RoR2/Base/DuplicatorMilitary/iscDuplicatorMilitary.asset"); iscDuplicatorWild = Addressables.LoadAssetAsync((object)"RoR2/Base/DuplicatorWild/iscDuplicatorWild.asset"); PrintersCode = new AsyncOperationHandle[4] { iscDuplicator, iscDuplicatorLarge, iscDuplicatorMilitary, iscDuplicatorWild }; } public override void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ShopTerminalBehavior.SetPickup += new hook_SetPickup(ShopTerminalBehavior_SetPickup); } public override void RunStart() { } public override void AddDirectorCards(List cards) { card = null; if (ModConfig.PrinterSectionEnabled.Value) { if (GetTierChoices().Count == 0) { Log.LogWarning("No printer tiers with a valid weight; skipping printers."); return; } card = new PrinterCard(); cards.Add(card); } } public override void SetupBazaar() { if (card != null) { DicPrinters.Clear(); SetPrinter(); spawned = 0; SpawnLatePicks(); } } public override void SpawnLatePicks() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (card != null) { while (spawned < card.tiers.Count) { SpawnPrinter(card.tiers[spawned], DicPrinters[spawned]); spawned++; } } } private void ShopTerminalBehavior_SetPickup(orig_SetPickup orig, ShopTerminalBehavior self, UniquePickup newPickup, bool newHidden) { //IL_0174: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected I4, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) WeightedSelection> weightedSelection; if (ModConfig.EnableMod.Value && ModConfig.PrinterSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("Duplicator")) { string text = ((Object)self).name.Substring("Duplicator".Length); ItemTier result; bool flag = Enum.TryParse(text, out result); if (text == "Void") { result = (ItemTier)5; flag = true; } if (flag) { weightedSelection = new WeightedSelection>(8); switch (result - 5) { case 1: AddDropList(Run.instance.availableVoidTier1DropList); break; case 2: AddDropList(Run.instance.availableVoidTier2DropList); break; case 3: AddDropList(Run.instance.availableVoidTier3DropList); break; case 4: AddDropList(Run.instance.availableVoidBossDropList); break; case 0: AddDropList(Run.instance.availableVoidTier1DropList); AddDropList(Run.instance.availableVoidTier2DropList); AddDropList(Run.instance.availableVoidTier3DropList); AddDropList(Run.instance.availableVoidBossDropList); break; } if (weightedSelection.Count > 0) { List list = weightedSelection.Evaluate(Random.value); newPickup.pickupIndex = list[Random.Range(0, list.Count)]; } } } orig.Invoke(self, newPickup, newHidden); void AddDropList(List drops) { if (drops.Count > 0) { weightedSelection.AddChoice(drops, 25f); } } } private unsafe void SpawnPrinter(ItemTier tier, SpawnCardStruct slot) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected I4, but got Unknown SpawnCard val = null; string text = null; switch ((int)tier) { case 0: val = (SpawnCard)(object)iscDuplicator.WaitForCompletion(); break; case 1: val = (SpawnCard)(object)iscDuplicatorLarge.WaitForCompletion(); break; case 2: val = (SpawnCard)(object)iscDuplicatorMilitary.WaitForCompletion(); break; case 4: val = (SpawnCard)(object)iscDuplicatorWild.WaitForCompletion(); break; case 6: case 7: case 8: case 9: val = (SpawnCard)(object)iscDuplicatorMilitary.WaitForCompletion(); text = "Duplicator" + ((object)(*(ItemTier*)(&tier))/*cast due to .constrained prefix*/).ToString(); break; case 5: val = (SpawnCard)(object)iscDuplicatorMilitary.WaitForCompletion(); text = "DuplicatorVoid"; break; } GameObject val2 = BazaarBase.SpawnAt(val.prefab, slot); if (text != null) { ((Object)val2).name = text; } } private static int GetTierCost(ItemTier tier) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected I4, but got Unknown return (int)tier switch { 0 => Math.Max(0, ModConfig.PrinterDirectorCostWhite.Value), 1 => Math.Max(0, ModConfig.PrinterDirectorCostGreen.Value), 4 => Math.Max(0, ModConfig.PrinterDirectorCostBoss.Value), _ => Math.Max(0, ModConfig.PrinterDirectorCostRed.Value), }; } private void SetPrinter() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_013c: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) List list = new List { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; List list2 = new List(); while (list.Count > 0) { int index = RNG.Next(list.Count); list2.Add(list[index]); list.RemoveAt(index); } DicPrinters.Add(list2[0], new SpawnCardStruct(new Vector3(-112f, -26.8f, -46f), new Vector3(0f, 32.2f, 0f))); DicPrinters.Add(list2[1], new SpawnCardStruct(new Vector3(-108f, -26.8f, -48.5f), new Vector3(0f, 32.2f, 0f))); DicPrinters.Add(list2[2], new SpawnCardStruct(new Vector3(-104f, -26.7f, -51f), new Vector3(0f, 32.2f, 0f))); DicPrinters.Add(list2[3], new SpawnCardStruct(new Vector3(-127f, -26f, -34.5f), new Vector3(0f, 32.2f, 0f))); DicPrinters.Add(list2[4], new SpawnCardStruct(new Vector3(-131f, -26f, -31.8f), new Vector3(0f, 32.2f, 0f))); DicPrinters.Add(list2[5], new SpawnCardStruct(new Vector3(-135f, -26f, -29f), new Vector3(0f, 32.2f, 0f))); DicPrinters.Add(list2[6], new SpawnCardStruct(new Vector3(-144f, -24.7f, -24f), new Vector3(0f, 60.2f, 0f))); DicPrinters.Add(list2[7], new SpawnCardStruct(new Vector3(-145f, -25f, -20f), new Vector3(0f, 80f, 0f))); DicPrinters.Add(list2[8], new SpawnCardStruct(new Vector3(-146f, -25.3f, -16f), new Vector3(0f, 100f, 0f))); } private static List<(ItemTier tier, float weight)> GetTierChoices() { List<(ItemTier tier, float weight)> choices = new List<(ItemTier, float)>(); AddTier((ItemTier)0, ModConfig.PrinterTier1Weight.Value, Run.instance.availableTier1DropList.Count); AddTier((ItemTier)1, ModConfig.PrinterTier2Weight.Value, Run.instance.availableTier2DropList.Count); AddTier((ItemTier)2, ModConfig.PrinterTier3Weight.Value, Run.instance.availableTier3DropList.Count); AddTier((ItemTier)4, ModConfig.PrinterTierBossWeight.Value, Run.instance.availableBossDropList.Count); AddTier((ItemTier)6, ModConfig.PrinterTierVoid1Weight.Value, Run.instance.availableVoidTier1DropList.Count); AddTier((ItemTier)7, ModConfig.PrinterTierVoid2Weight.Value, Run.instance.availableVoidTier2DropList.Count); AddTier((ItemTier)8, ModConfig.PrinterTierVoid3Weight.Value, Run.instance.availableVoidTier3DropList.Count); AddTier((ItemTier)9, ModConfig.PrinterTierVoidBossWeight.Value, Run.instance.availableVoidBossDropList.Count); int availableCount = Run.instance.availableVoidTier1DropList.Count + Run.instance.availableVoidTier2DropList.Count + Run.instance.availableVoidTier3DropList.Count + Run.instance.availableVoidBossDropList.Count; AddTier((ItemTier)5, ModConfig.PrinterTierVoidAnyWeight.Value, availableCount); return choices; void AddTier(ItemTier choice, float weight, int num) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (num > 0 && weight > 0f) { choices.Add((choice, weight)); } } } } public class BazaarRestack : BazaarBase { private AsyncOperationHandle iscShrineRestack; private DirectorCard card; private bool spawned; public override void Preload() { //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) iscShrineRestack = Addressables.LoadAssetAsync((object)"RoR2/Base/ShrineRestack/iscShrineRestack.asset"); } public override void Hook() { } public override void RunStart() { } public override void AddDirectorCards(List cards) { card = null; if (ModConfig.ShrineOfOrderSectionEnabled.Value) { card = new DirectorCard("Shrine of Order", ModConfig.ShrineOfOrderDirectorCost, ModConfig.ShrineOfOrderDirectorWeight, () => 1); cards.Add(card); } } public override void SetupBazaar() { spawned = false; SpawnLatePicks(); } public override void SpawnLatePicks() { if (card != null && card.Count != 0 && !spawned) { SpawnShrineRestack(); spawned = true; } } private void SpawnShrineRestack() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) GameObject val = BazaarBase.SpawnAt(((SpawnCard)iscShrineRestack.WaitForCompletion()).prefab, new SpawnCardStruct(new Vector3(-130f, -24f, -40f), new Vector3(0f, 220f, 0f))); if (ModConfig.ShrineOfOrderUseLimit.Value >= 0) { val.GetComponent().maxPurchaseCount = ModConfig.ShrineOfOrderUseLimit.Value; } else { val.GetComponent().maxPurchaseCount = int.MaxValue; } val.GetComponent().costMultiplierPerPurchase = 1f; val.GetComponent().cost = ModConfig.ShrineOfOrderCost.Value; val.GetComponent().Networkcost = ModConfig.ShrineOfOrderCost.Value; } } public class BazaarScrapper : BazaarBase { private AsyncOperationHandle iscScrapper; private Dictionary DicScrapers = new Dictionary(); private DirectorCard card; private bool spawned; public override void Preload() { //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) iscScrapper = Addressables.LoadAssetAsync((object)"RoR2/Base/Scrapper/iscScrapper.asset"); } public override void Hook() { } public override void RunStart() { } public override void AddDirectorCards(List cards) { card = null; if (ModConfig.ScrapperSectionEnabled.Value) { card = new DirectorCard("Scrappers", ModConfig.ScrapperDirectorCost, ModConfig.ScrapperDirectorWeight, () => (ModConfig.ScrapperMaxAmount.Value > 0) ? 1 : 0); cards.Add(card); } } public override void SetupBazaar() { spawned = false; SpawnLatePicks(); } public override void SpawnLatePicks() { if (card != null && card.Count != 0 && !spawned) { DicScrapers.Clear(); SetScraper(); BazaarBase.SpawnInSlots(DicScrapers, ((SpawnCard)iscScrapper.WaitForCompletion()).prefab, 0, ModConfig.ScrapperMaxAmount.Value); spawned = true; } } private void SetScraper() { //IL_0067: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) List list = new List { 0, 1 }; List list2 = new List(); while (list.Count > 0) { int index = RNG.Next(list.Count); list2.Add(list[index]); list.RemoveAt(index); } DicScrapers.Add(list2[0], new SpawnCardStruct(new Vector3(-100f, -25f, -40f), new Vector3(0f, 72f, 0f))); DicScrapers.Add(list2[1], new SpawnCardStruct(new Vector3(-95f, -25.5f, -35f), new Vector3(0f, 72f, 0f))); } } public class BazaarWanderingChef : BazaarBase { private AsyncOperationHandle mealPrep; private AsyncOperationHandle ChefWok_WhitesAndGreens; private Dictionary> allAvailableRecipes; private PickupIndex[] allAvailableTargetPickupIndexes; private int randomTargetPickupIndex; private List possibleRecipes; private ShopTerminalBehavior cauldron; private GameObject chef; private DirectorCard card; public override void Preload() { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) mealPrep = Addressables.LoadAssetAsync((object)"RoR2/DLC3/MealPrep/MealPrep.prefab"); ChefWok_WhitesAndGreens = Addressables.LoadAssetAsync((object)"RoR2/DLC3/MealPrep/ChefWok, WhitesAndGreens.prefab"); } public override void Hook() { //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 ShopTerminalBehavior.SetPickup += new hook_SetPickup(ShopTerminalBehavior_SetPickup); CraftingController.AttemptFindPossibleRecipes += new hook_AttemptFindPossibleRecipes(CraftingController_AttemptFindPossibleRecipes); CraftingController.GetGeneratedOptionsFromInteractor += new hook_GetGeneratedOptionsFromInteractor(CraftingController_GetGeneratedOptionsFromInteractor); CraftingController.CanTakePickupAfterUseByIngredientSlots += new hook_CanTakePickupAfterUseByIngredientSlots(CraftingController_CanTakePickupAfterUseByIngredientSlots); MealPrepController.BeginCookingServer += new hook_BeginCookingServer(MealPrepController_BeginCookingServer); } public override void RunStart() { RunEnd(); if (ModConfig.WanderingChefSectionEnabled.Value && IsAlloyedCollectiveEnabled() && !ModConfig.WanderingChefUnrestrictedCrafting.Value) { allAvailableRecipes = GetAvailableRecipes(); allAvailableTargetPickupIndexes = allAvailableRecipes.Keys.ToArray(); randomTargetPickupIndex = RNG.Next(allAvailableTargetPickupIndexes.Length); } } public override void RunEnd() { allAvailableRecipes = null; allAvailableTargetPickupIndexes = null; possibleRecipes = null; cauldron = null; } private static bool IsAlloyedCollectiveEnabled() { if (Object.op_Implicit((Object)(object)DLC3Content.DLC3) && Object.op_Implicit((Object)(object)Run.instance)) { return Run.instance.IsExpansionEnabled(DLC3Content.DLC3); } return false; } public override void AddDirectorCards(List cards) { card = null; if (!ModConfig.WanderingChefSectionEnabled.Value || !IsAlloyedCollectiveEnabled()) { return; } if (!ModConfig.WanderingChefUnrestrictedCrafting.Value && (allAvailableTargetPickupIndexes == null || allAvailableTargetPickupIndexes.Length == 0)) { Log.LogWarning("No recipes; skipping the Wandering Chef this visit."); return; } card = new DirectorCard("Wandering CHEF", ModConfig.WanderingChefDirectorCost, ModConfig.WanderingChefDirectorWeight, () => 1, null, allowLatePicks: false); cards.Add(card); } public override void SetupBazaar() { chef = null; cauldron = null; if (card != null && card.Count > 0) { SpawnWanderingChef(); } } public override int CheckAfterSetup() { if (!Object.op_Implicit((Object)(object)chef) || ModConfig.WanderingChefUnrestrictedCrafting.Value || !ModConfig.WanderingChefCraftableRecipesOnly.Value) { return 0; } if (TryChooseCraftableRecipe()) { return 0; } Log.LogInfo("No craftable recipe for the Wandering Chef; the director spends his credits on something else."); NetworkServer.Destroy(chef); if (Object.op_Implicit((Object)(object)cauldron)) { NetworkServer.Destroy(((Component)cauldron).gameObject); } chef = null; cauldron = null; return card.Spent; } private void ShopTerminalBehavior_SetPickup(orig_SetPickup orig, ShopTerminalBehavior self, UniquePickup newPickup, bool newHidden) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_006f: Unknown result type (might be due to invalid IL or missing references) if (ModConfig.EnableMod.Value && ModConfig.WanderingChefSectionEnabled.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("CookingCauldron")) { if (possibleRecipes == null || possibleRecipes.Count == 0) { newPickup.pickupIndex = PickupIndex.none; } else { newPickup.pickupIndex = possibleRecipes[0].result; } } orig.Invoke(self, newPickup, newHidden); } private void CraftingController_AttemptFindPossibleRecipes(orig_AttemptFindPossibleRecipes orig, CraftingController self) { //IL_00fb: 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) if (ModConfig.EnableMod.Value && ModConfig.WanderingChefSectionEnabled.Value && !ModConfig.WanderingChefUnrestrictedCrafting.Value && IsCurrentMapInBazaar() && NetworkServer.active && ((Object)self).name.StartsWith("WanderingChef") && possibleRecipes != null && possibleRecipes.Count > 0) { self._possibleRecipes = possibleRecipes.ToArray(); if (!self.AllSlotsEmpty()) { self._possibleRecipes = FindRecipesThatCanAcceptIngredients(self.ingredients); } CraftableCatalog.FilterByEntitlement(ref self._possibleRecipes); if (!self.AllSlotsFilled()) { return; } self.bestFitRecipe = null; for (int i = 0; i < self._possibleRecipes.Length; i++) { RecipeEntry val = self._possibleRecipes[i]; if (val != null && CraftableCatalog.ValidateRecipe(val, self.ingredients)) { self.bestFitRecipe = val; } } if (self.bestFitRecipe != null) { self.result = self.bestFitRecipe.result; self.amountToDrop = self.bestFitRecipe.amountToDrop; ((NetworkBehaviour)self).SetDirtyBit(CraftingController.resultDirtyBit); } } else { orig.Invoke(self); } } private List