Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BazaarIsMyHaven v5.4.0
BazaarIsMyHaven.dll
Decompiled 16 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; 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 IL.RoR2; using InLobbyConfig; using InLobbyConfig.Fields; using ItemStringParser; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.CaptainSupplyDrop; using On.EntityStates.Missions.RepurposedCrater; using On.EntityStates.NewtMonster; using On.RoR2; using On.RoR2.Projectile; using PerClientSync; using ProperSave; using R2API.Utils; using RoR2; using RoR2.Artifacts; using RoR2.CharacterAI; using RoR2.Hologram; using RoR2.Navigation; using RoR2.Networking; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Scripts.GameBehaviors; using ShareSuite; 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+f03cc8c65c0af5c6f4ed2e7508ccb7828afb87bc")] [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 static class BazaarAPI { public static void AddSection(BazaarBase section) { Main.instance.AddSection(section); } public static void AddPrinter(string name, Func<SpawnCard> spawnCard, Func<int> directorCost, Func<float> weight, Func<bool> isAvailable = null) { BazaarPrinter.AddKind(name, spawnCard, directorCost, weight, isAvailable); } public static void AddCauldron(string name, Func<SpawnCard> spawnCard, Func<int> directorCost, Func<float> weight, Func<bool> isAvailable = null) { BazaarCauldron.AddKind(name, spawnCard, directorCost, weight, isAvailable); } public static void AddCommandPedestalTier(string name, Func<List<PickupIndex>> dropList, Func<int> price, Func<int> directorCost, Func<float> weight, Func<bool> isAvailable = null) { BazaarCommandPedestal.AddTier(name, dropList, price, directorCost, weight, isAvailable); } public static void SetSurvivorDonationReward(string survivorOrBodyName, string rewardList) { ModConfig.SetModDonationReward(survivorOrBodyName, rewardList); } } 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<DirectorCard> 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<GameObject>(prefab, slot.Position, Quaternion.Euler(slot.Rotation)); NetworkServer.Spawn(obj); return obj; } private protected static DirectorKind AddedKind(string name, Func<SpawnCard> spawnCard, Func<int> cost, Func<float> weight, Func<bool> isAvailable) { return new DirectorKind { name = name, cost = cost, weight = weight, isAvailable = isAvailable, spawn = delegate(SpawnCardStruct slot) { SpawnCard val = spawnCard(); GameObject val2 = (Object.op_Implicit((Object)(object)val) ? val.prefab : null); if (Object.op_Implicit((Object)(object)val2)) { SpawnAt(val2, slot); } else { Log.LogError(name + " has no spawn card to spawn."); } } }; } protected static List<GameObject> SpawnInSlots(Dictionary<int, SpawnCardStruct> slots, GameObject prefab, int start, int count) { List<GameObject> list = new List<GameObject>(); for (int i = start; i < start + count; i++) { list.Add(SpawnAt(prefab, slots[i])); } return list; } public static void SpawnEffect(AsyncOperationHandle<GameObject> 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<T>(List<T> list, T defaultValue) { if (list == null || list.Count == 0) { return defaultValue; } return list[RNG.Next(list.Count)]; } protected List<t> DisorderList<t>(List<t> TList) { List<t> list = new List<t>(); foreach (t T in TList) { list.Insert(RNG.Next(list.Count()), T); } return list; } } public class BazaarCauldron : BazaarBase { private AsyncOperationHandle<GameObject> lunarCauldronWhiteToGreen; private AsyncOperationHandle<GameObject> lunarCauldronGreenToRed; private AsyncOperationHandle<GameObject> lunarCauldronRedToWhite; private AsyncOperationHandle<GameObject> transcendentCauldron; private Dictionary<int, SpawnCardStruct> DicCauldrons = new Dictionary<int, SpawnCardStruct>(); private KindCard card; private int spawned; private static readonly List<DirectorKind> addedKinds = new List<DirectorKind>(); public static void AddKind(string name, Func<SpawnCard> spawnCard, Func<int> cost, Func<float> weight, Func<bool> isAvailable) { addedKinds.Add(BazaarBase.AddedKind(name, spawnCard, cost, weight, isAvailable)); } 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) lunarCauldronWhiteToGreen = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarCauldrons/LunarCauldron, WhiteToGreen.prefab"); lunarCauldronGreenToRed = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarCauldrons/LunarCauldron, GreenToRed Variant.prefab"); lunarCauldronRedToWhite = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarCauldrons/LunarCauldron, RedToWhite Variant.prefab"); transcendentCauldron = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC4/BetterCauldron.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 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<DirectorCard> cards) { card = null; if (!ModConfig.CauldronSectionEnabled.Value) { return; } List<DirectorKind> kinds = GetKinds(); if (kinds.Count == 0) { Log.LogWarning("No cauldron types with a valid weight; skipping cauldrons."); return; } card = new KindCard("Lunar Cauldron", kinds, () => ModConfig.CauldronDirectorWeight.Value, () => ModConfig.CauldronMaxAmount.Value); cards.Add(card); } public override void SetupBazaar() { if (card != null) { DicCauldrons.Clear(); SetCauldron(); spawned = 0; SpawnLatePicks(); } } public override void SpawnLatePicks() { if (card != null) { while (spawned < card.picks.Count) { card.picks[spawned].spawn(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<CharacterBody>() : null); Inventory inventory = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); ShopTerminalBehavior component = ((Component)self).GetComponent<ShopTerminalBehavior>(); 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<PayCostContext, PayCostResults> 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<PayCostContext, PayCostResults>)(object)self.onDetailedPurchaseServer).AddListener(val2); try { orig.Invoke(self, activator); return; } finally { ((UnityEvent<PayCostContext, PayCostResults>)(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<int> list = new List<int> { 0, 1, 2, 3, 4, 5, 6 }; List<int> list2 = new List<int>(); 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<PickupIndex> listLunarItem) { listLunarItem = new List<PickupIndex>(); 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 List<DirectorKind> GetKinds() { //IL_0012: 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_004a: 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) List<DirectorKind> kinds = new List<DirectorKind>(); AddType("WhiteToGreen", lunarCauldronWhiteToGreen, ModConfig.CauldronWhiteToGreenWeight.Value); AddType("GreenToRed", lunarCauldronGreenToRed, ModConfig.CauldronGreenToRedWeight.Value); AddType("RedToWhite", lunarCauldronRedToWhite, ModConfig.CauldronRedToWhiteWeight.Value); if (Object.op_Implicit((Object)(object)DLC4Content.DLC4) && Run.instance.IsExpansionEnabled(DLC4Content.DLC4)) { AddType("Transcendent", transcendentCauldron, ModConfig.CauldronTranscendentWeight.Value); } kinds.AddRange(DirectorKind.Available(addedKinds)); return kinds; void AddType(string name, AsyncOperationHandle<GameObject> prefab, float weight) { //IL_000e: 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 (weight > 0f) { kinds.Add(new DirectorKind { name = name, cost = () => ModConfig.CauldronDirectorCost.Value, weight = () => weight, spawn = delegate(SpawnCardStruct slot) { BazaarBase.SpawnAt(prefab.WaitForCompletion(), slot); } }); } } } } public class BazaarCleansingPool : BazaarBase { private AsyncOperationHandle<InteractableSpawnCard> iscShrineCleanse; private AsyncOperationHandle<GameObject> lunarShopTerminal; private Dictionary<int, SpawnCardStruct> DicLunarPools = new Dictionary<int, SpawnCardStruct>(); 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<InteractableSpawnCard>((object)"RoR2/Base/ShrineCleanse/iscShrineCleanse.asset"); lunarShopTerminal = Addressables.LoadAssetAsync<GameObject>((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<DirectorCard> 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<PurchaseInteraction>().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<GameObject>(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 TierDropTable : PickupDropTable { public List<PickupIndex> pickups; public override int GetPickupCount() { if (pickups == null) { return 0; } return pickups.Count; } public override UniquePickup GeneratePickupPreReplacement(Xoroshiro128Plus rng) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) if (pickups == null || pickups.Count <= 0) { return UniquePickup.none; } return new UniquePickup(rng.NextElementUniform<PickupIndex>(pickups)); } } private class PedestalTier : DirectorKind { public Func<List<PickupIndex>> dropList; public Func<int> price; } private class VaultView : ClientView<GenericInteraction> { public BazaarCommandPedestal owner; private Interactability realInteractability; protected override void Apply(NetworkConnection client) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) GenericInteraction component = base.Component; realInteractability = component.interactability; PlayerCharacterMasterController player = PerClient.GetPlayer(client); if (Object.op_Implicit((Object)(object)player) && owner.storedEquipment.ContainsKey(player)) { component.interactability = (Interactability)2; } else if (Object.op_Implicit((Object)(object)player) && owner.buyers.Contains(player)) { component.interactability = (Interactability)0; } } protected override void Restore() { //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) base.Component.interactability = realInteractability; } } private const float SignHeight = 4.5f; private const float HiddenEssenceDepth = 5f; private const float DisplayDropHeight = 5f; private const uint InteractabilityBit = 1u; private static readonly List<PedestalTier> addedTiers = new List<PedestalTier>(); private AsyncOperationHandle<GameObject> vaultPrefab; private AsyncOperationHandle<GameObject> shrineUseEffect; private KindCard card; private bool spawned; private GameObject pedestal; private Xoroshiro128Plus rng; private TierDropTable dropTable; private bool sold; private UniquePickup offer; private bool hasOffer; private GameObject displayEssence; private readonly HashSet<PlayerCharacterMasterController> buyers = new HashSet<PlayerCharacterMasterController>(); private readonly Dictionary<PickupPickerController, Essence> essences = new Dictionary<PickupPickerController, Essence>(); private readonly Dictionary<PlayerCharacterMasterController, EquipmentIndex> storedEquipment = new Dictionary<PlayerCharacterMasterController, EquipmentIndex>(); public static BazaarCommandPedestal instance; private PedestalTier tier { get { if (card == null || card.picks.Count <= 0) { return null; } return (PedestalTier)card.picks[0]; } } public static void AddTier(string name, Func<List<PickupIndex>> dropList, Func<int> price, Func<int> directorCost, Func<float> weight, Func<bool> isAvailable) { addedTiers.Add(new PedestalTier { name = name, dropList = dropList, price = price, cost = directorCost, weight = weight, isAvailable = delegate { if (isAvailable == null || isAvailable()) { List<PickupIndex> list = dropList(); if (list != null) { return list.Count > 0; } return false; } return false; } }); } private static List<DirectorKind> GetTiers() { return DirectorKind.Available(ModConfig.CommandPedestalTiers.Select((ModConfig.CommandPedestalTier tier) => new PedestalTier { name = tier.name, dropList = () => tier.dropList(Run.instance), price = () => tier.cost.Value, cost = () => tier.directorCost.Value, weight = () => tier.weight.Value, isAvailable = () => tier.dropList(Run.instance).Count > 0 }).Concat(addedTiers)); } public BazaarCommandPedestal() { instance = this; } public IEnumerable<PickupIndex> 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<PickupIndex>(); } IEnumerable<PickupIndex> availableGroupFromPickupIndex = PickupTransmutationManager.GetAvailableGroupFromPickupIndex(offer.pickupIndex); return availableGroupFromPickupIndex ?? Enumerable.Empty<PickupIndex>(); } 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<GameObject>((object)"RoR2/DLC3/PowerOrbPedestal/PowerOrbVault.prefab"); shrineUseEffect = Addressables.LoadAssetAsync<GameObject>((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 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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); PickupPickerController.FixedUpdateServer += new hook_FixedUpdateServer(PickupPickerController_FixedUpdateServer); } public override void AddDirectorCards(List<DirectorCard> cards) { card = null; if (!ModConfig.CommandPedestalSectionEnabled.Value) { return; } List<DirectorKind> tiers = GetTiers(); if (tiers.Count != 0) { card = new KindCard("Command Pedestal", tiers, () => ModConfig.CommandPedestalDirectorWeight.Value, () => 1); 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<CharacterBody>() : 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<Interactor>() : null); CharacterBody val2 = (Object.op_Implicit((Object)(object)interactorObject) ? interactorObject.GetComponent<CharacterBody>() : 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); UpdateSwapAvailability(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<PickupPickerController, Essence> 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<CharacterBody>(); 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 int GetPrice() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (tier == null) { return 0; } return Helper.GetCost(tier.price(), ModConfig.CommandPedestalCostType.Value); } private bool TryRollPickup(out UniquePickup pickup) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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) List<PickupIndex> list = ((tier != null) ? tier.dropList() : null); if (list == null || list.Count == 0) { pickup = UniquePickup.none; return false; } if (!Object.op_Implicit((Object)(object)dropTable)) { dropTable = ScriptableObject.CreateInstance<TierDropTable>(); ((PickupDropTable)dropTable).canDropBeReplaced = false; } dropTable.pickups = list; pickup = ((PickupDropTable)dropTable).GeneratePickup(rng); 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<GameObject>(CommandArtifactManager.commandCubePrefab, ((Component)vault).transform.position + Vector3.down * 5f, Quaternion.identity); obj.GetComponent<PickupIndexNetworker>().NetworkpickupState = pickup; PickupPickerController component = obj.GetComponent<PickupPickerController>(); component.SetOptionsFromPickupForCommandArtifact(pickup); component.pickupThatGeneratedOptions = pickup; Rigidbody val = default(Rigidbody); if (obj.TryGetComponent<Rigidbody>(ref val)) { val.isKinematic = true; } NetworkServer.Spawn(obj); CharacterBody component2 = ((Component)activator).GetComponent<CharacterBody>(); essences[component] = new Essence { owner = (Object.op_Implicit((Object)(object)component2) ? component2.master : null), vaultPosition = GetEssencePosition(vault) }; component.OnInteractionBegin(activator); } private void PickupPickerController_FixedUpdateServer(orig_FixedUpdateServer orig, PickupPickerController self) { //IL_0042: 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) if (!essences.TryGetValue(self, out var value)) { orig.Invoke(self); return; } CharacterMaster currentParticipantMaster = self.networkUIPromptController.currentParticipantMaster; if (!Object.op_Implicit((Object)(object)currentParticipantMaster)) { return; } CharacterBody body = currentParticipantMaster.GetBody(); if (Object.op_Implicit((Object)(object)body)) { Vector3 val = body.inputBank.aimOrigin - value.vaultPosition; if (!(((Vector3)(ref val)).sqrMagnitude > self.cutoffDistance * self.cutoffDistance)) { return; } } self.networkUIPromptController.SetParticipantMaster((CharacterMaster)null); } 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<CharacterBody>() : 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<Interactor>() : null); PlayerCharacterMasterController val4 = (Object.op_Implicit((Object)(object)val) ? val.playerCharacterMasterController : null); PowerOrbPedestalManager val5 = (Object.op_Implicit((Object)(object)pedestal) ? pedestal.GetComponent<PowerOrbPedestalManager>() : 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) { VaultView vaultView = default(VaultView); if (Object.op_Implicit((Object)(object)pedestal) && pedestal.TryGetComponent<VaultView>(ref vaultView)) { ((ClientView)vaultView).SetDirty(PerClient.GetConnection(player), 1u); } } private void HideDisplayFor(PlayerCharacterMasterController player) { NetworkIdentity val = (Object.op_Implicit((Object)(object)displayEssence) ? displayEssence.GetComponent<NetworkIdentity>() : null); NetworkConnection connection = PerClient.GetConnection(player); if (!Object.op_Implicit((Object)(object)val) || connection == null) { return; } if (PerClient.IsLocal(connection)) { Transform val2 = displayEssence.transform.Find("PickupDisplay"); if (Object.op_Implicit((Object)(object)val2)) { ((Component)val2).gameObject.SetActive(false); } } else { PerClient.Hide(val, connection); } } 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<SphereCollider>() : 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<GameObject>(commandCubePrefab, val2 + Vector3.down * ((RaycastHit)(ref val3)).distance, Quaternion.identity); displayEssence.GetComponent<PickupIndexNetworker>().NetworkpickupState = offer; displayEssence.GetComponent<PickupPickerController>().SetAvailable(false); Rigidbody val4 = default(Rigidbody); if (displayEssence.TryGetComponent<Rigidbody>(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_00cf: Unknown result type (might be due to invalid IL or missing references) rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong); pedestal = Object.Instantiate<GameObject>(vaultPrefab.WaitForCompletion(), new Vector3(-63.9613f, -26.3518f, -73.8056f), Quaternion.Euler(0f, 300f, 0f)); pedestal.AddComponent<VaultView>().owner = this; NetworkServer.Spawn(pedestal); hasOffer = TryRollPickup(out offer); if (hasOffer) { SpawnDisplayEssence(); } Log.LogDebug("The Command Pedestal offers " + tier.name + "."); PriceSigns.Apply(new List<GameObject> { pedestal }, GetPrice(), ModConfig.CommandPedestalCostType.Value, 4.5f); } } public class BazaarDecorate : BazaarBase { private AsyncOperationHandle<GameObject> 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<GameObject>((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 Func<int> cost; private readonly Func<float> weight; private readonly Func<int> maxCount; private readonly Func<bool> isAvailable; public int Count { get; private set; } public int Spent { get; private set; } public virtual float Weight => Mathf.Max(0f, weight()); public DirectorCard(string name, Func<int> cost, Func<float> weight, Func<int> maxCount, Func<bool> isAvailable = null, bool allowLatePicks = true) { this.name = name; this.cost = cost; this.weight = weight; this.maxCount = maxCount; this.isAvailable = isAvailable; this.allowLatePicks = allowLatePicks; } public DirectorCard(string name, ConfigEntry<int> cost, ConfigEntry<float> weight, Func<int> maxCount, Func<bool> isAvailable = null, bool allowLatePicks = true) : this(name, (Func<int>)(() => cost.Value), (Func<float>)(() => weight.Value), maxCount, isAvailable, 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()); } protected virtual int PickCost(int credits) { return CheapestCost(); } } public class BazaarDirector : MonoBehaviour { private static readonly Random random = new Random(); private List<BazaarBase> sections; private List<DirectorCard> 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<DirectorCard> cards, string round) { List<DirectorCard> source = cards.ToList(); Dictionary<DirectorCard, int> dictionary = new Dictionary<DirectorCard, int>(); int num = credits; while (true) { List<DirectorCard> 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<DirectorCard, int> pick) => $"{pick.Value}x {pick.Key.name}"))); Log.LogInfo($"Director ({round}): {num} credits bought {text}; {credits} left."); return credits; } public static void Create(List<BazaarBase> sections, List<DirectorCard> cards, int credits) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) BazaarDirector bazaarDirector = new GameObject("BazaarDirector").AddComponent<BazaarDirector>(); 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<GameObject> altarPrefab; private AsyncOperationHandle<GameObject> LevelUpEffect; private AsyncOperationHandle<GameObject> MoneyPackPickupEffect; private AsyncOperationHandle<GameObject> TeamWarCryActivation; private AsyncOperationHandle<GameObject> ShrineUseEffect; private readonly Dictionary<PlayerCharacterMasterController, int> donationsDuringRun = new Dictionary<PlayerCharacterMasterController, int>(); 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<string> loggedRewardWarnings = new HashSet<string>(); 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<GameObject>((object)"RoR2/DLC1/DeepVoidPortalBattery/DeepVoidPortalBattery.prefab"); LevelUpEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/LevelUpEffect.prefab"); MoneyPackPickupEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/BonusGoldPackOnKill/MoneyPackPickupEffect.prefab"); TeamWarCryActivation = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/TeamWarCry/TeamWarCryActivation.prefab"); ShrineUseEffect = Addressables.LoadAssetAsync<GameObject>((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); ModCompatibilityProperSave.Register("BazaarIsMyHaven.DonationsDuringRun", SaveDonations, LoadDonations); } public override void RunStart() { donationsDuringRun.Clear(); loggedRewardWarnings.Clear(); } private object SaveDonations() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, int> dictionary = new Dictionary<string, int>(); foreach (KeyValuePair<PlayerCharacterMasterController, int> item in donationsDuringRun) { if (Object.op_Implicit((Object)(object)item.Key) && Object.op_Implicit((Object)(object)item.Key.networkUser)) { dictionary[GetUserKey(item.Key.networkUser.id)] = item.Value; } } return dictionary; } private void LoadDonations(object saved) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (!(saved is Dictionary<string, int> dictionary)) { return; } donationsDuringRun.Clear(); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance.networkUser) && dictionary.TryGetValue(GetUserKey(instance.networkUser.id), out var value)) { donationsDuringRun[instance] = value; } } } private static string GetUserKey(NetworkUserId id) { //IL_0005: 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_0016: Unknown result type (might be due to invalid IL or missing references) return $"{id.value}/{id.strValue}/{id.subId}"; } public override void RunEnd() { donationsDuringRun.Clear(); } public override void AddDirectorCards(List<DirectorCard> 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<CharacterBody>() : 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<DonationRewardDisplay>(); 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<InstancedPurchase>(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<PickupIndex, int> 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<PickupIndex, int> resolvedItems, out int tier) { //IL_01eb: Unknown result type (might be due to invalid IL or missing references) tier = 0; resolvedItems = new Dictionary<PickupIndex, int>(); 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<PickupIndex, int> 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<PickupIndex, int>[] array = resolvedItems.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair<PickupIndex, int> 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<PickupIndex, int> 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<GameObject>(altarPrefab.WaitForCompletion(), new Vector3(-114.4226f, -22.6017f, -49.9827f), Quaternion.Euler(0f, 300f, 0f)); PurchaseInteraction component = altar.GetComponent<PurchaseInteraction>(); 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<InstancedPurchase>().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<GameObject> prefab; public SpawnCardStruct slot; public bool spawned; public GameObject instance; } private class InstancedDroneShop : ClientView<DroneVendorMultiShopController> { public const uint AvailableBit = 1u; public bool open; public readonly HashSet<PlayerCharacterMasterController> closedFor = new HashSet<PlayerCharacterMasterController>(); private bool realAvailable; protected override void Apply(NetworkConnection client) { realAvailable = base.Component.available; base.Component.available = open && !closedFor.Contains(PerClient.GetPlayer(client)); } protected override void Restore() { base.Component.available = realAvailable; } } private AsyncOperationHandle<GameObject> DroneCombinerStation; private AsyncOperationHandle<GameObject> DroneUpgradeStation; private AsyncOperationHandle<GameObject> DroneScrapper; private AsyncOperationHandle<GameObject> TripleDroneShop; private readonly List<Station> stations = new List<Station>(); 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<GameObject>((object)"RoR2/DLC3/DroneCombinerStation/DroneCombinerStation.prefab"); DroneUpgradeStation = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/DroneAssemblyStation/DroneAssemblyStation.prefab"); DroneScrapper = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/DroneScrapper/DroneScrapper.prefab"); TripleDroneShop = Addressables.LoadAssetAsync<GameObject>((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 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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); DroneVendorMultiShopController.OnPurchase += new hook_OnPurchase(DroneVendorMultiShopController_OnPurchase); } 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<DirectorCard> 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<DirectorCard> cards, string name, ConfigEntry<int> cost, ConfigEntry<float> weight, AsyncOperationHandle<GameObject> 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<CharacterMaster> 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<BaseAI>(); CharacterBody component2 = val.bodyPrefab.GetComponent<CharacterBody>(); 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<NodeIndex> list = new List<NodeIndex>(); 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) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: 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<HologramProjector>(); 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); } if (ModConfig.DronesTripleDroneShopBuyAll.Value && self.doCloseOnTerminalPurchase != null) { for (int j = 0; j < self.doCloseOnTerminalPurchase.Length; j++) { self.doCloseOnTerminalPurchase[j] = false; } } if (!ModConfig.DronesTripleDroneShopInstancedPurchases.Value) { return; } array = (DroneVendorTerminalBehavior[])(((object)self._terminals) ?? ((object)new DroneVendorTerminalBehavior[0])); foreach (DroneVendorTerminalBehavior val4 in array) { if (Object.op_Implicit((Object)(object)val4) && Object.op_Implicit((Object)(object)val4.purchaseInteraction)) { InstancedPurchase instancedPurchase = ((Component)val4).gameObject.AddComponent<InstancedPurchase>(); instancedPurchase.original.available = val4.purchaseInteraction.available; instancedPurchase.original.pickup = val4.currentPickup; } } ((Component)self).gameObject.AddComponent<InstancedDroneShop>().open = self.available; } private void DroneVendorMultiShopController_OnPurchase(orig_OnPurchase orig, DroneVendorMultiShopController self, PayCostContext payCostContext, PayCostResults payCostResult) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) PlayerCharacterMasterController val = (Object.op_Implicit((Object)(object)payCostContext.activatorMaster) ? payCostContext.activatorMaster.playerCharacterMasterController : null); int num = ((self._terminals == null) ? (-1) : Array.FindIndex(self._terminals, (DroneVendorTerminalBehavior terminal) => Object.op_Implicit((Object)(object)terminal) && (Object)(object)terminal.purchaseInteraction == (Object)(object)payCostContext.purchaseInteraction)); InstancedDroneShop instancedDroneShop = default(InstancedDroneShop); if (!NetworkServer.active || !((Component)self).TryGetComponent<InstancedDroneShop>(ref instancedDroneShop) || !Object.op_Implicit((Object)(object)val) || num < 0) { orig.Invoke(self, payCostContext, payCostResult); return; } bool flag = self.doCloseOnTerminalPurchase[num]; self.doCloseOnTerminalPurchase[num] = !ModConfig.DronesTripleDroneShopBuyAll.Value; InstancedPurchase instancedPurchase = default(InstancedPurchase); for (int num2 = 0; num2 < self._terminals.Length; num2++) { DroneVendorTerminalBehavior val2 = self._terminals[num2]; if (Object.op_Implicit((Object)(object)val2) && (num2 == num || flag) && ((Component)val2).TryGetComponent<InstancedPurchase>(ref instancedPurchase)) { InstancedPurchaseStruct orCreate = instancedPurchase.GetOrCreate(val); orCreate.available = false; orCreate.pickup = UniquePickup.none; orCreate.hasBeenPurchased |= num2 == num; InstancedPurchases.UpdatePlayer(((Component)val2).gameObject, val); } } if (flag && instancedDroneShop.closedFor.Add(val)) { NetworkConnection connection = PerClient.GetConnection(val); if (PerClient.IsLocal(connection)) { self.Networkavailable = false; } else { ((ClientView)instancedDroneShop).SetDirty(connection, 1u); } PriceSigns.HideFor(((Component)self).gameObject, val); } DispatchDrone(self._terminals[num], payCostContext.activator); } private static void DispatchDrone(DroneVendorTerminalBehavior terminal, 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //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_006f: 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_0080: 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_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_009d: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) UniquePickup pickup = ((Component)terminal).GetComponent<InstancedPurchase>().original.pickup; PickupDef pickupDef = PickupCatalog.GetPickupDef(pickup.pickupIndex); DroneDef val = ((pickupDef != null) ? DroneCatalog.GetDroneDef(pickupDef.droneIndex) : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.masterPrefab) && Object.op_Implicit((Object)(object)activator)) { AkSoundEngine.PostEvent("Play_GG_INTER_DroneVendor_DroneReady", ((Component)terminal).gameObject); CharacterMaster val2 = new MasterSummon { masterPrefab = val.masterPrefab, position = terminal.dropTransform.position, rotation = ((Component)terminal).transform.rotation, summonerBodyObject = ((Component)activator).gameObject, ignoreTeamMemberLimit = true, useAmbientLevel = true, enablePrintController = true }.Perform(); if (Object.op_Implicit((Object)(object)val2)) { val2.inventory.GiveItemPermanent(Items.DroneUpgradeHidden, pickup.upgradeValue); terminal.NotifySummoner(((Component)activator).gameObject, val2.GetBodyObject()); } } } 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