Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Suppression v3.0.3
Suppression.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HG; using HG.Reflection; using Microsoft.CodeAnalysis; using R2API; using RoR2; using RoR2.CharacterAI; using RoR2.Hologram; using RoR2.Items; using RoR2.UI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Suppression")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Suppression")] [assembly: AssemblyTitle("Suppression")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Suppression { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInPlugin("Acanthi.Suppression", "Suppression", "0.0.1")] public class Suppression : BaseUnityPlugin { public class VoidSuppressorReworker : MonoBehaviour { private PurchaseInteraction purchaseInteraction; private HologramProjector hologramProjector; private GameObject reworkPanel; private Animator animator; private MultiBodyTrigger nearbyTrigger; private int stage; private int purchaseCount; private bool hasRevealed; private bool bought; private CharacterBody currentBody; private PickupPickerController reworkController; public List<Option> options = new List<Option>(); public void Awake() { purchaseInteraction = ((Component)this).gameObject.GetComponent<PurchaseInteraction>(); hologramProjector = ((Component)this).gameObject.GetComponent<HologramProjector>(); reworkController = ((Component)this).gameObject.GetComponent<PickupPickerController>(); animator = ((Component)((Component)this).gameObject.transform.Find("mdlVoidSuppressor")).gameObject.GetComponent<Animator>(); nearbyTrigger = ((Component)((Component)this).gameObject.transform.Find("NearbyTrigger")).gameObject.GetComponent<MultiBodyTrigger>(); } public void SetOptionsFromInteractorWithSpecifiedTier(Interactor activator, ItemTierDef itemTierSpecified) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)activator)) { return; } CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component)) { return; } Inventory inventory = component.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return; } List<Option> list = new List<Option>(); for (int i = 0; i < inventory.itemAcquisitionOrder.Count; i++) { ItemIndex val = inventory.itemAcquisitionOrder[i]; ItemDef itemDef = ItemCatalog.GetItemDef(val); ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier); PickupIndex pickupIndex = PickupCatalog.FindPickupIndex(val); if ((Object)(object)itemTierDef == (Object)(object)itemTierSpecified && (!Object.op_Implicit((Object)(object)itemTierDef) || itemTierDef.canScrap) && itemDef.canRemove && !itemDef.hidden && itemDef.DoesNotContainTag((ItemTag)10) && (!((Object)(object)((Component)this).GetComponent<LemurianEggController>() != (Object)null) || (!itemDef.ContainsTag((ItemTag)13) && !itemDef.ContainsTag((ItemTag)23))) && !itemDef.ContainsTag((ItemTag)22)) { Option item = new Option { available = true }; ((Option)(ref item)).pickupIndex = pickupIndex; list.Add(item); } } reworkController.SetOptionsServer(list.ToArray()); } public void Start() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) hasRevealed = false; bought = false; currentBody = null; Object.Destroy((Object)(object)((Component)this).gameObject.GetComponent<VoidSuppressorBehavior>()); int childCount = ((Component)((Component)this).gameObject.transform.GetChild(0)).transform.childCount; GameObject val = new GameObject(); val.transform.localPosition = hologramLocalPosOriginal; val.transform.localRotation = new Quaternion(0f, 180f, 0f, 0f); Object.Instantiate<GameObject>(val, ((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.transform); Object.Destroy((Object)(object)val); hologramProjector.hologramPivot = ((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.transform.GetChild(childCount); reworkController.cutoffDistance = 10f; reworkController.panelPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Scrapper/ScrapperPickerPanel.prefab").WaitForCompletion(), "ScrapperPickerPanel"); ((Component)reworkController.panelPrefab.transform.Find("MainPanel/Juice/Label")).gameObject.GetComponent<LanguageTextMeshController>().token = "SUPPRESSOR_POPUP_TEXT"; ((Component)reworkController.panelPrefab.transform.GetChild(1).GetChild(0).GetChild(10)).gameObject.SetActive(false); ((Component)reworkController.panelPrefab.transform.GetChild(1).GetChild(0).GetChild(9)).gameObject.SetActive(false); ((Component)reworkController.panelPrefab.transform.GetChild(1).GetChild(0).GetChild(8)).gameObject.SetActive(false); ((Component)reworkController.panelPrefab.transform.GetChild(1).GetChild(0).GetChild(7)).gameObject.SetActive(false); ((Component)reworkController.panelPrefab.transform.Find("MainPanel/Juice/ScrapperDetailsVertical/InspectPanel/InspectPanelArea/InspectionPanel/HorizontalBox/InspectIconContainer/InspectVisualBackground/InspectedVisual").GetChild(0)).gameObject.SetActive(false); ((Component)reworkController.panelPrefab.transform.Find("MainPanel/Juice/ScrapperDetailsVertical/InspectPanel/InspectPanelArea/InspectionPanel/HorizontalBox/InspectIconContainer/InspectVisualBackground/InspectedVisual").GetChild(1)).gameObject.SetActive(false); if (!NetworkServer.active) { GameObject val2 = Object.Instantiate<GameObject>(lunarInfectionLarge, ((Component)this).gameObject.transform); Renderer[] array = (from thing in val2.GetComponentsInChildren<Renderer>() where ((Object)thing.material).name == "matLunarInfection (Instance)" select thing).ToArray(); Renderer[] array2 = array; foreach (Renderer val3 in array2) { ((Component)val3).gameObject.SetActive(true); ((Component)val3).gameObject.transform.localScale = new Vector3(0.3f, 0.4f, 0.4f); ((Component)val3).gameObject.transform.localPosition = new Vector3(0.15f, -0.65f, 0.4f); val3.material = Object.Instantiate<Material>(brotherInfectionWhite); val3.material.SetColor("_EmColor", Color32.op_Implicit(ColorCatalog.GetColor(ItemTierCatalog.GetItemTierDef((ItemTier)6).colorIndex))); } } ((UnityEvent<Interactor>)(object)purchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)onPurchase); ((UnityEvent<int>)(object)reworkController.onPickupSelected).AddListener((UnityAction<int>)onPickupSelected); ((UnityEvent<CharacterBody>)(object)nearbyTrigger.onAnyQualifyingBodyEnter).AddListener((UnityAction<CharacterBody>)OnPlayerNearby); ((UnityEvent<CharacterBody>)(object)nearbyTrigger.onAnyQualifyingBodyExit).AddListener((UnityAction<CharacterBody>)OnPlayerFar); ((Behaviour)reworkController).enabled = false; } public void OnPlayerNearby(CharacterBody body) { if (body.isPlayerControlled) { animator.SetBool("IsPlayerNearby", true); } } public void OnPlayerFar(CharacterBody body) { if (body.isPlayerControlled) { animator.SetBool("IsPlayerNearby", false); } } public void onPurchase(Interactor interactor) { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //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_0125: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)("Purchase " + purchaseCount + "!")); if (!hasRevealed) { Debug.Log((object)"Revealed!"); hasRevealed = true; animator.SetBool("IsActive", true); purchaseCount = 1; purchaseInteraction.cost = 0; purchaseInteraction.SetAvailableTrue(); return; } if (!bought) { bought = true; purchaseInteraction.cost = 0; } options = new List<Option>(); switch (purchaseCount) { case 1: foreach (PickupIndex availableTier1Drop in Run.instance.availableTier1DropList) { PickupIndex current2 = availableTier1Drop; if (!((Object)ItemCatalog.GetItemDef(((PickupIndex)(ref current2)).itemIndex)).name.Contains("scrap")) { options.Add(new Option { pickup = new UniquePickup(PickupCatalog.FindPickupIndex(((PickupIndex)(ref current2)).itemIndex)), available = ((PickupIndex)(ref current2)).isValid }); } } Debug.Log((object)"Generated Options! (Tier 1)"); break; case 2: foreach (PickupIndex availableTier2Drop in Run.instance.availableTier2DropList) { PickupIndex current3 = availableTier2Drop; if (!((Object)ItemCatalog.GetItemDef(((PickupIndex)(ref current3)).itemIndex)).name.Contains("scrap")) { options.Add(new Option { pickup = new UniquePickup(PickupCatalog.FindPickupIndex(((PickupIndex)(ref current3)).itemIndex)), available = ((PickupIndex)(ref current3)).isValid }); } } Debug.Log((object)"Generated Options! (Tier 2)"); break; case 3: foreach (PickupIndex availableTier3Drop in Run.instance.availableTier3DropList) { PickupIndex current = availableTier3Drop; if (!((Object)ItemCatalog.GetItemDef(((PickupIndex)(ref current)).itemIndex)).name.Contains("scrap")) { options.Add(new Option { pickup = new UniquePickup(PickupCatalog.FindPickupIndex(((PickupIndex)(ref current)).itemIndex)), available = ((PickupIndex)(ref current)).isValid }); } } Debug.Log((object)"Generated Options! (Tier 3)"); break; default: Debug.Log((object)"This should never happen."); break; } if (!Object.op_Implicit((Object)(object)((Component)interactor).GetComponent<CharacterBody>())) { return; } currentBody = ((Component)interactor).GetComponent<CharacterBody>(); ((UnityEvent<Interactor>)(object)reworkController.onServerInteractionBegin).Invoke(interactor); reworkController.networkUIPromptController.SetParticipantMasterFromInteractor(interactor); if (reworkScrapOnly) { switch (purchaseCount) { case 1: SetOptionsFromInteractorWithSpecifiedTier(interactor, ItemTierCatalog.GetItemTierDef((ItemTier)0)); break; case 2: SetOptionsFromInteractorWithSpecifiedTier(interactor, ItemTierCatalog.GetItemTierDef((ItemTier)1)); break; case 3: SetOptionsFromInteractorWithSpecifiedTier(interactor, ItemTierCatalog.GetItemTierDef((ItemTier)2)); break; } } else { reworkController.SetOptionsServer(options.ToArray()); } if (purchaseCount <= 3) { purchaseInteraction.SetAvailableTrue(); } Debug.Log((object)"Interaction Available!"); } public void onPickupSelected(int pickupIndex) { //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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)("Pickup selected with index: " + pickupIndex)); ItemIndex itemIndex = PickupCatalog.entries[pickupIndex].itemIndex; if (SuppressedItemManager.SuppressItem(itemIndex, (ItemIndex)(purchaseCount switch { 1 => Items.ScrapWhiteSuppressed.itemIndex, 2 => Items.ScrapGreenSuppressed.itemIndex, 3 => Items.ScrapRedSuppressed.itemIndex, _ => -1, }))) { ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex); ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier); ColoredTokenChatMessage val = new ColoredTokenChatMessage(); ((SubjectChatMessage)val).subjectAsCharacterBody = currentBody; ((SubjectChatMessage)val).baseToken = "VOID_SUPPRESSOR_USE_MESSAGE"; val.paramTokens = new string[1] { itemDef.nameToken }; val.paramColors = (Color32[])(object)new Color32[1] { ColorCatalog.GetColor(itemTierDef.colorIndex) }; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } purchaseCount++; bought = false; purchaseInteraction.cost = purchaseCount; if (purchaseCount > 3) { animator.SetBool("IsActive", false); purchaseInteraction.SetAvailable(false); } currentBody = null; reworkController.networkUIPromptController.SetParticipantMaster((CharacterMaster)null); Debug.Log((object)"Cleared Interaction."); } public void Update() { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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) if (currency == 2) { ((Component)hologramProjector.hologramPivot).gameObject.SetActive(false); } else if (hasRevealed) { if (purchaseCount <= 0) { ((Component)hologramProjector.hologramPivot).gameObject.SetActive(false); } else if (purchaseCount == 1) { ((Component)hologramProjector.hologramPivot).gameObject.SetActive(true); } ((Component)hologramProjector.hologramPivot).gameObject.transform.localPosition = Vector3.MoveTowards(((Component)hologramProjector.hologramPivot).gameObject.transform.localPosition, hologramLocalPosOpen, Time.fixedDeltaTime); } else { ((Component)hologramProjector.hologramPivot).gameObject.transform.localPosition = Vector3.MoveTowards(((Component)hologramProjector.hologramPivot).gameObject.transform.localPosition, hologramLocalPosOriginal, Time.fixedDeltaTime); } } } public class VoidSuppressorBehaviorFixer : MonoBehaviour { private VoidSuppressorBehavior voidSuppressor; private PurchaseInteraction purchaseInteraction; private HologramProjector hologramProjector; private int stage; public void Awake() { voidSuppressor = ((Component)this).gameObject.GetComponent<VoidSuppressorBehavior>(); purchaseInteraction = ((Component)this).gameObject.GetComponent<PurchaseInteraction>(); hologramProjector = ((Component)this).gameObject.GetComponent<HologramProjector>(); } public void Start() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0029: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) int childCount = ((Component)((Component)this).gameObject.transform.GetChild(0)).transform.childCount; GameObject val = new GameObject(); val.transform.localPosition = hologramLocalPosOriginal; val.transform.localRotation = new Quaternion(0f, 180f, 0f, 0f); Object.Instantiate<GameObject>(val, ((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.transform); Object.Destroy((Object)(object)val); hologramProjector.hologramPivot = ((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.transform.GetChild(childCount); if (!NetworkServer.active) { GameObject val2 = Object.Instantiate<GameObject>(lunarInfectionLarge, ((Component)this).gameObject.transform); Renderer[] array = (from thing in val2.GetComponentsInChildren<Renderer>() where ((Object)thing.material).name == "matLunarInfection (Instance)" select thing).ToArray(); Renderer[] array2 = array; foreach (Renderer val3 in array2) { ((Component)val3).gameObject.SetActive(true); ((Component)val3).gameObject.transform.localScale = new Vector3(0.3f, 0.4f, 0.4f); ((Component)val3).gameObject.transform.localPosition = new Vector3(0.15f, -0.65f, 0.4f); val3.material = Object.Instantiate<Material>(brotherInfectionWhite); val3.material.SetColor("_EmColor", Color32.op_Implicit(ColorCatalog.GetColor(ItemTierCatalog.GetItemTierDef((ItemTier)6).colorIndex))); } } if (!Object.op_Implicit((Object)(object)purchaseInteraction)) { return; } ((UnityEvent<Interactor>)(object)purchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)delegate { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"Why are we here? Just to suffer?"); if (voidSuppressor.purchaseCount <= 0) { purchaseInteraction.cost = 0; } else if (voidSuppressor.purchaseCount == 1) { purchaseInteraction.cost = (int)(1f * voidSuppressor.costMultiplierPerPurchase); if (dropScrapOnSuppress) { PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Items.ScrapWhiteSuppressed.itemIndex), ((Component)this).gameObject.transform.position, Vector3.up * 10f); } } else if (voidSuppressor.purchaseCount == 2) { if (dropScrapOnSuppress) { PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Items.ScrapGreenSuppressed.itemIndex), ((Component)this).gameObject.transform.position, Vector3.up * 10f); } } else if (dropScrapOnSuppress) { PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Items.ScrapRedSuppressed.itemIndex), ((Component)this).gameObject.transform.position, Vector3.up * 10f); } }); } public void Update() { //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)voidSuppressor)) { return; } if (currency == 2) { ((Component)hologramProjector.hologramPivot).gameObject.SetActive(false); } else if (voidSuppressor.hasRevealed) { if (voidSuppressor.purchaseCount <= 0) { ((Component)hologramProjector.hologramPivot).gameObject.SetActive(false); } else if (voidSuppressor.purchaseCount == 1) { ((Component)hologramProjector.hologramPivot).gameObject.SetActive(true); } ((Component)hologramProjector.hologramPivot).gameObject.transform.localPosition = Vector3.MoveTowards(((Component)hologramProjector.hologramPivot).gameObject.transform.localPosition, hologramLocalPosOpen, Time.fixedDeltaTime); } else { ((Component)hologramProjector.hologramPivot).gameObject.transform.localPosition = Vector3.MoveTowards(((Component)hologramProjector.hologramPivot).gameObject.transform.localPosition, hologramLocalPosOriginal, Time.fixedDeltaTime); } } } public const string PluginGUID = "Acanthi.Suppression"; public const string PluginAuthor = "Acanthi"; public const string PluginName = "Suppression"; public const string PluginVersion = "0.0.1"; public static InteractableSpawnCard voidSuppressorSpawnCard; public static GameObject lunarInfectionLarge; public static Material brotherInfectionWhite; public static Vector3 hologramLocalPosOriginal = new Vector3(0.2f, 0.8f, 1f); public static Vector3 hologramLocalPosOpen = new Vector3(0.2f, 0.8f, 1.4f); public static bool dropScrapOnSuppress; public static bool singleItemOnly; public static bool reworkScrapOnly; public static int alwaysReveal; public static int currency; public static bool reworkEnable; [SystemInitializer(new Type[] { typeof(SceneCatalog) })] public static void Init() { Log.Warning("Suppression!"); FixStrangeScrap(); SetupVoidSuppressorPrefab(); Stage.onServerStageBegin += onServerStageBegin; } public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); InitConfig(); AddTokens(); } public void InitConfig() { currency = ((BaseUnityPlugin)this).Config.Bind<int>("Common", "Use Currency", 0, "(0 = Void Coins, 1 = Lunar Coins, 2 = Disable Cost)").Value; reworkEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("Rework", "Enable Rework", true, "Opens a command menu allowing you to choose which item to erase.").Value; reworkScrapOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Rework", "Choose from Current Inventory", false, "Only allows choosing an item from your inventory (similar to a scrapper).").Value; dropScrapOnSuppress = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla", "Drop Scrap on Suppress", false, "Drops Strange Scrap after removing an item from the universe.").Value; singleItemOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Vanilla", "Single Item Only", false, "Removes the ability to suppress multiple items.").Value; alwaysReveal = ((BaseUnityPlugin)this).Config.Bind<int>("Vanilla", "Always Reveal Item", 0, "(0 = 75% Chance, 1 = Always Show, 2 = Never Show)").Value; } private void AddTokens() { LanguageAPI.Add("SUPPRESSOR_POPUP_TEXT", "<i>Era?sing Pot??ential No?n-E??n?t?ity?...</i>"); } private static void FixStrangeScrap() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) Items.ScrapWhiteSuppressed.tier = (ItemTier)0; if (Items.ScrapWhiteSuppressed.DoesNotContainTag((ItemTag)10)) { ref ItemTag[] tags = ref Items.ScrapWhiteSuppressed.tags; ItemTag val = (ItemTag)10; ArrayUtils.ArrayAppend<ItemTag>(ref tags, ref val); } Items.ScrapGreenSuppressed.tier = (ItemTier)1; if (Items.ScrapGreenSuppressed.DoesNotContainTag((ItemTag)10)) { ref ItemTag[] tags2 = ref Items.ScrapGreenSuppressed.tags; ItemTag val = (ItemTag)10; ArrayUtils.ArrayAppend<ItemTag>(ref tags2, ref val); } Items.ScrapRedSuppressed.tier = (ItemTier)2; if (Items.ScrapRedSuppressed.DoesNotContainTag((ItemTag)10)) { ref ItemTag[] tags3 = ref Items.ScrapRedSuppressed.tags; ItemTag val = (ItemTag)10; ArrayUtils.ArrayAppend<ItemTag>(ref tags3, ref val); } } private static void SetupVoidSuppressorPrefab() { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) lunarInfectionLarge = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/bazaar/LunarInfectionLargeMesh.prefab").WaitForCompletion(); brotherInfectionWhite = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Brother/matBrotherInfectionWhite.mat").WaitForCompletion(); voidSuppressorSpawnCard = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC1/VoidSuppressor/iscVoidSuppressor.asset").WaitForCompletion(); ((SpawnCard)voidSuppressorSpawnCard).prefab.transform.position = new Vector3(0f, 0f, 0f); Vector3 localPosition = ((Component)((SpawnCard)voidSuppressorSpawnCard).prefab.gameObject.transform.GetChild(0)).gameObject.transform.localPosition; ((Component)((SpawnCard)voidSuppressorSpawnCard).prefab.gameObject.transform.GetChild(0)).gameObject.transform.localPosition = new Vector3(localPosition.x, localPosition.y - 1.45f, localPosition.z); if (currency != 2) { ((SpawnCard)voidSuppressorSpawnCard).prefab.GetComponent<PurchaseInteraction>().cost = 1; ((SpawnCard)voidSuppressorSpawnCard).prefab.GetComponent<PurchaseInteraction>().costType = (CostTypeIndex)((currency == 0) ? 14 : 3); } ((SpawnCard)voidSuppressorSpawnCard).prefab.GetComponent<Highlight>().targetRenderer = (Renderer)(object)((Component)((Component)((SpawnCard)voidSuppressorSpawnCard).prefab.gameObject.transform.GetChild(0)).gameObject.transform.GetChild(5)).GetComponent<SkinnedMeshRenderer>(); if (reworkEnable) { ((SpawnCard)voidSuppressorSpawnCard).prefab.AddComponent<NetworkUIPromptController>(); ((SpawnCard)voidSuppressorSpawnCard).prefab.AddComponent<PickupPickerController>(); ((SpawnCard)voidSuppressorSpawnCard).prefab.AddComponent<VoidSuppressorReworker>(); } else { ((SpawnCard)voidSuppressorSpawnCard).prefab.AddComponent<VoidSuppressorBehaviorFixer>(); ((SpawnCard)voidSuppressorSpawnCard).prefab.GetComponent<VoidSuppressorBehavior>().costMultiplierPerPurchase = 2f; } ((SpawnCard)voidSuppressorSpawnCard).prefab.AddComponent<HologramProjector>().disableHologramRotation = true; } private static void onServerStageBegin(Stage obj) { bool flag = true; bool flag2 = true; Log.Warning("Spawned a supressor!"); FindAltarsInScene(); } public static void FindAltarsInScene() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_02c8: 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) PortalStatueBehavior[] array = Resources.FindObjectsOfTypeAll(typeof(PortalStatueBehavior)) as PortalStatueBehavior[]; foreach (PortalStatueBehavior val in array) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null || (int)val.portalType != 0 || ((Component)val).gameObject.activeSelf) { continue; } InteractableSpawnCard val2 = Object.Instantiate<InteractableSpawnCard>(voidSuppressorSpawnCard); ((SpawnCard)val2).prefab.transform.rotation = ((Component)val).gameObject.transform.rotation; ((Component)((SpawnCard)val2).prefab.GetComponent<Highlight>().targetRenderer).gameObject.transform.localPosition = ((Component)((Component)val).GetComponent<Highlight>().targetRenderer).gameObject.transform.localPosition; ((Component)((SpawnCard)val2).prefab.GetComponent<Highlight>().targetRenderer).gameObject.transform.localRotation = ((Component)((Component)val).GetComponent<Highlight>().targetRenderer).gameObject.transform.localRotation; DirectorPlacementRule val3 = new DirectorPlacementRule { placementMode = (PlacementMode)0, spawnOnTarget = ((Component)val).gameObject.transform, position = ((Component)val).gameObject.transform.position }; DirectorSpawnRequest val4 = new DirectorSpawnRequest((SpawnCard)(object)val2, val3, Run.instance.stageRng); GameObject val5 = DirectorCore.instance.TrySpawnObject(val4); VoidSuppressorBehavior component = val5.GetComponent<VoidSuppressorBehavior>(); component.numItemsToReveal = 0; component.itemsSuppressedPerPurchase = 0; if (alwaysReveal == 1) { component.numItemsToReveal = 3; } else if (alwaysReveal == 2) { component.numItemsToReveal = 0; } else { for (int j = 0; j < 3; j++) { float num = Random.Range(0f, 100f); if (num <= (float)(75 / (j + 1))) { component.numItemsToReveal++; } } } if (singleItemOnly) { component.itemsSuppressedPerPurchase = 1; } else { float num2 = Random.Range(0f, 100f); if (num2 <= 50f) { component.itemsSuppressedPerPurchase = 1; } else { component.itemsSuppressedPerPurchase = 3; } } Renderer[] array2 = (from thing in ((Component)val).GetComponentsInChildren<Renderer>() where ((Object)thing.material).name == "matLunarInfection (Instance)" select thing).ToArray(); Renderer[] array3 = array2; foreach (Renderer val6 in array3) { ((Component)val6).gameObject.SetActive(true); val6.material = Object.Instantiate<Material>(brotherInfectionWhite); val6.material.SetColor("_EmColor", Color32.op_Implicit(ColorCatalog.GetColor(ItemTierCatalog.GetItemTierDef((ItemTier)6).colorIndex))); GameObject val7 = Object.Instantiate<GameObject>(((Component)val6).gameObject, val5.transform); } break; } } } }