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 Arcrines Artifacts v1.1.2
plugins/ArcrinesArtifacts.dll
Decompiled 2 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ArcrinesArtifacts")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ArcrinesArtifacts")] [assembly: AssemblyTitle("ArcrinesArtifacts")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 ExamplePlugin { 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); } } } namespace ArcrinesArtifacts { public struct RivalItemSyncMessage : INetMessage, ISerializableObject { public ItemIndex item1; public ItemIndex item2; public void Serialize(NetworkWriter writer) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected I4, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected I4, but got Unknown writer.Write((int)item1); writer.Write((int)item2); } public void Deserialize(NetworkReader reader) { //IL_0008: 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) item1 = (ItemIndex)reader.ReadInt32(); item2 = (ItemIndex)reader.ReadInt32(); } public void OnReceived() { //IL_0025: 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_00d4: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } if (Object.op_Implicit((Object)(object)ArcrinesArtifactsPlugin.customMonsterInventory)) { ArcrinesArtifactsPlugin.customMonsterInventory.GiveItemPermanent(item1, 1); ArcrinesArtifactsPlugin.customMonsterInventory.GiveItemPermanent(item2, 1); } foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)2)) { if (Object.op_Implicit((Object)(object)teamMember.body) && Object.op_Implicit((Object)(object)teamMember.body.inventory)) { teamMember.body.inventory.GiveItemPermanent(item1, 1); teamMember.body.inventory.GiveItemPermanent(item2, 1); } } string text = Language.GetString(ItemCatalog.GetItemDef(item1).nameToken); string text2 = Language.GetString(ItemCatalog.GetItemDef(item2).nameToken); string baseToken = "<color=#e57373>The monsters have acquired: " + text + " and " + text2 + "!</color>"; Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = baseToken }); } } [BepInPlugin("com.arcrine.ArcrinesArtifacts", "Arcrine's Artifacts", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ArcrinesArtifactsPlugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<string, string> <>9__26_0; public static hook_Start <>9__28_0; public static hook_RecalculateStats <>9__28_1; public static hook_Start <>9__28_2; public static hook_Start <>9__28_3; public static hook_OnCharacterDeath <>9__28_4; public static hook_PerformInteraction <>9__28_5; public static hook_FixedUpdate <>9__29_0; public static hook_TakeDamage <>9__29_1; public static hook_FixedUpdate <>9__29_2; public static hook_OnCharacterDeath <>9__30_0; public static CalcChargeRateDelegate <>9__31_2; public static hook_Awake <>9__31_0; public static hook_Start <>9__32_0; public static hook_OnBodyStart <>9__32_1; public static hook_RollItem <>9__33_0; public static hook_OnInteractionBegin <>9__33_1; public static hook_OnInteractionBegin <>9__34_3; internal string <LoadScares>b__26_0(string f) { return f; } internal void <ApplyNewArtifactHooks>b__28_0(orig_Start orig, ClassicStageInfo self) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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) //IL_011d: 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) //IL_012f: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown orig.Invoke(self); if (!RunArtifactManager.instance.IsArtifactEnabled(pantheonArtifact) || self.monsterSelection == null) { return; } WeightedSelection<DirectorCard> val = new WeightedSelection<DirectorCard>(8); for (int i = 0; i < self.monsterSelection.Count; i++) { ChoiceInfo<DirectorCard> choice = self.monsterSelection.GetChoice(i); DirectorCard val2 = choice.value; float num = choice.weight; if (val2 != null && (Object)(object)val2.spawnCard != (Object)null) { CharacterMaster component = val2.spawnCard.prefab.GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.bodyPrefab)) { CharacterBody component2 = component.bodyPrefab.GetComponent<CharacterBody>(); if (!component2.isChampion && !component2.isBoss) { num = 0f; } else { SpawnCard obj = Object.Instantiate<SpawnCard>(val2.spawnCard); CharacterSpawnCard val3 = (CharacterSpawnCard)(object)((obj is CharacterSpawnCard) ? obj : null); ((SpawnCard)val3).directorCreditCost = 20; DirectorCard val4 = new DirectorCard { spawnCard = (SpawnCard)(object)val3, selectionWeight = 100, spawnDistance = val2.spawnDistance, preventOverhead = val2.preventOverhead, minimumStageCompletions = val2.minimumStageCompletions, forbiddenUnlockableDef = val2.forbiddenUnlockableDef, requiredUnlockableDef = val2.requiredUnlockableDef }; val2 = val4; num = 100f; } } } if (num > 0f) { val.AddChoice(val2, num); } } self.monsterSelection = val; } internal void <ApplyNewArtifactHooks>b__28_1(orig_RecalculateStats orig, CharacterBody self) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 orig.Invoke(self); if ((Object)(object)Run.instance == (Object)null) { return; } if (RunArtifactManager.instance.IsArtifactEnabled(pantheonArtifact) && (int)self.teamComponent.teamIndex == 2 && (self.isChampion || self.isBoss)) { self.maxHealth *= 0.15f; self.damage *= 0.5f; } if (RunArtifactManager.instance.IsArtifactEnabled(rouletteArtifact) && self.isPlayerControlled) { Random random = new Random((int)Run.instance.seed + Run.instance.stageClearCount); self.maxHealth *= (float)random.NextDouble() * 2.5f + 0.5f; self.damage *= (float)random.NextDouble() * 2.5f + 0.5f; self.moveSpeed *= (float)random.NextDouble() * 2f + 0.5f; } if (!RunArtifactManager.instance.IsArtifactEnabled(necromancerArtifact) || !self.isPlayerControlled) { return; } int num = 0; foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1)) { if (Object.op_Implicit((Object)(object)teamMember.body) && Object.op_Implicit((Object)(object)teamMember.body.inventory) && teamMember.body.inventory.GetItemCountPermanent(Items.Ghost) > 0) { num++; } } if (num > 0) { self.maxHealth *= Mathf.Pow(0.98f, (float)num); } } internal void <ApplyNewArtifactHooks>b__28_2(orig_Start orig, SceneDirector self) { //IL_003a: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Invalid comparison between Unknown and I4 orig.Invoke(self); if (!RunArtifactManager.instance.IsArtifactEnabled(wakeArtifact)) { return; } RenderSettings.ambientIntensity = 0f; RenderSettings.ambientLight = new Color(0.05f, 0.05f, 0.05f); RenderSettings.skybox = null; RenderSettings.reflectionIntensity = 0f; RenderSettings.fog = true; RenderSettings.fogMode = (FogMode)2; RenderSettings.fogDensity = 0.08f; RenderSettings.fogColor = Color.black; Light[] array = Object.FindObjectsOfType<Light>(); foreach (Light val in array) { if (((Object)((Component)val).gameObject).name != "WakeFlashlight" && (int)val.type == 1) { val.intensity = 0f; ((Behaviour)val).enabled = false; } } } internal void <ApplyNewArtifactHooks>b__28_3(orig_Start orig, CameraRigController self) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!((Object)(object)Run.instance != (Object)null) || !RunArtifactManager.instance.IsArtifactEnabled(wakeArtifact)) { return; } if (Object.op_Implicit((Object)(object)self.sceneCam)) { self.sceneCam.clearFlags = (CameraClearFlags)2; self.sceneCam.backgroundColor = Color.black; Component component = ((Component)self.sceneCam).GetComponent("RampFog"); if (Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)component); } } ((Component)self).gameObject.AddComponent<WakeFlashlightController>(); if (enableJumpscares.Value) { ((Component)self).gameObject.AddComponent<WakeJumpscare>(); } } internal void <ApplyNewArtifactHooks>b__28_4(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00f9: 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_0117: Expected O, but got Unknown orig.Invoke(self, damageReport); if (NetworkServer.active && RunArtifactManager.instance.IsArtifactEnabled(necromancerArtifact) && (int)damageReport.attackerTeamIndex == 1 && Object.op_Implicit((Object)(object)damageReport.victimBody) && Object.op_Implicit((Object)(object)damageReport.victimMaster) && (!Object.op_Implicit((Object)(object)damageReport.victimBody.inventory) || damageReport.victimBody.inventory.GetItemCountPermanent(Items.Ghost) <= 0)) { MasterSummon val = new MasterSummon { masterPrefab = MasterCatalog.GetMasterPrefab(damageReport.victimMaster.masterIndex), position = damageReport.victimBody.corePosition, rotation = damageReport.victimBody.transform.rotation, summonerBodyObject = (Object.op_Implicit((Object)(object)damageReport.attackerBody) ? ((Component)damageReport.attackerBody).gameObject : null), ignoreTeamMemberLimit = true, inventoryToCopy = damageReport.victimMaster.inventory, useAmbientLevel = true }; CharacterMaster val2 = val.Perform(); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.inventory)) { val2.inventory.GiveItemPermanent(Items.Ghost, 1); } } } internal void <ApplyNewArtifactHooks>b__28_5(orig_PerformInteraction orig, Interactor self, GameObject interactableObject) { orig.Invoke(self, interactableObject); if (RunArtifactManager.instance.IsArtifactEnabled(wakeArtifact) && enableJumpscares.Value) { CharacterBody component = ((Component)self).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && component.hasEffectiveAuthority && Random.value <= 0.005f) { TriggerJumpscare(); } } } internal void <ApplyRhythmHooks>b__29_0(orig_FixedUpdate orig, GenericSkill self) { if (RunArtifactManager.instance.IsArtifactEnabled(rhythmArtifact)) { float rechargeStopwatch = self.rechargeStopwatch; orig.Invoke(self); if (self.rechargeStopwatch > rechargeStopwatch && self.rechargeStopwatch - rechargeStopwatch < 0.5f) { self.rechargeStopwatch = rechargeStopwatch; } } else { orig.Invoke(self); } } internal void <ApplyRhythmHooks>b__29_1(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 orig.Invoke(self, damageInfo); if (!RunArtifactManager.instance.IsArtifactEnabled(rhythmArtifact)) { return; } if (Object.op_Implicit((Object)(object)damageInfo.attacker)) { CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && component.hasEffectiveAuthority) { GenericSkill[] allSkills = component.skillLocator.allSkills; foreach (GenericSkill val in allSkills) { if (val.rechargeStopwatch < val.finalRechargeInterval) { val.rechargeStopwatch += damageInfo.damage * 0.02f; } } } } if (!Object.op_Implicit((Object)(object)self.body) || !self.body.hasEffectiveAuthority || (int)self.body.teamComponent.teamIndex != 1 || !(damageInfo.damage > 0f)) { return; } GenericSkill[] allSkills2 = self.body.skillLocator.allSkills; foreach (GenericSkill val2 in allSkills2) { if (val2.rechargeStopwatch < val2.finalRechargeInterval) { val2.rechargeStopwatch += 1.5f; } } } internal void <ApplyRhythmHooks>b__29_2(orig_FixedUpdate orig, CharacterMotor self) { orig.Invoke(self); if (!RunArtifactManager.instance.IsArtifactEnabled(rhythmArtifact) || !Object.op_Implicit((Object)(object)self.body) || !self.body.hasEffectiveAuthority) { return; } float magnitude = ((Vector3)(ref self.velocity)).magnitude; if (!(magnitude > 0.1f)) { return; } float num = magnitude * Time.fixedDeltaTime * 0.15f; if (!self.isGrounded) { num *= 2f; } GenericSkill[] allSkills = self.body.skillLocator.allSkills; foreach (GenericSkill val in allSkills) { if (val.rechargeStopwatch < val.finalRechargeInterval) { val.rechargeStopwatch += num; } } } internal void <ApplyHivemindHooks>b__30_0(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //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) orig.Invoke(self, damageReport); if (!NetworkServer.active || !RunArtifactManager.instance.IsArtifactEnabled(hivemindArtifact) || (int)damageReport.victimTeamIndex != 2) { return; } foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)2)) { if (Object.op_Implicit((Object)(object)teamMember.body) && (Object)(object)teamMember.body != (Object)(object)damageReport.victimBody && Vector3.Distance(teamMember.body.corePosition, damageReport.damageInfo.position) <= 30f) { teamMember.body.AddTimedBuff(Buffs.TeamWarCry, 5f); } } } internal void <ApplyCapitalismHooks>b__31_0(orig_Awake orig, HoldoutZoneController self) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown orig.Invoke(self); ((Component)self).gameObject.AddComponent<CapitalismVisuals>(); object obj = <>9__31_2; if (obj == null) { CalcChargeRateDelegate val = delegate(ref float rate) { if (RunArtifactManager.instance.IsArtifactEnabled(capitalismArtifact)) { rate = 0f; } }; <>9__31_2 = val; obj = (object)val; } self.calcChargeRate += (CalcChargeRateDelegate)obj; } internal void <ApplyCapitalismHooks>b__31_2(ref float rate) { if (RunArtifactManager.instance.IsArtifactEnabled(capitalismArtifact)) { rate = 0f; } } internal void <ApplyRivalHooks>b__32_0(orig_Start orig, Run self) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown orig.Invoke(self); if (NetworkServer.active) { GameObject val = new GameObject("RivalMonsterInventory"); customMonsterInventory = val.AddComponent<Inventory>(); NetworkServer.Spawn(val); } } internal void <ApplyRivalHooks>b__32_1(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 orig.Invoke(self, body); if (NetworkServer.active && (int)self.teamIndex == 2 && RunArtifactManager.instance.IsArtifactEnabled(rivalArtifact) && Object.op_Implicit((Object)(object)customMonsterInventory)) { self.inventory.AddItemsFrom(customMonsterInventory); } } internal void <ApplyLocksmithHooks>b__33_0(orig_RollItem orig, ChestBehavior self) { if (RunArtifactManager.instance.IsArtifactEnabled(locksmithArtifact) && ((Object)((Component)self).gameObject).name.Contains("RustyChest")) { int num = 0; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance.master.inventory)) { num = Mathf.Max(num, instance.master.inventory.GetItemCountPermanent(Items.TreasureCache)); } } if (num > 0) { self.tier1Chance = 80f; self.tier2Chance = 20f * (float)num; self.tier3Chance = 1f * (float)(num * num); } } orig.Invoke(self); } internal void <ApplyLocksmithHooks>b__33_1(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor interactor) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 int num = 0; Inventory val = null; if (RunArtifactManager.instance.IsArtifactEnabled(locksmithArtifact) && (int)self.costType == 12) { CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory)) { val = component.inventory; num = val.GetItemCountPermanent(Items.TreasureCache); } } orig.Invoke(self, interactor); if ((Object)(object)val != (Object)null && num > 0) { int itemCountPermanent = val.GetItemCountPermanent(Items.TreasureCache); if (itemCountPermanent < num) { val.GiveItemPermanent(Items.TreasureCache, num - itemCountPermanent); } } } internal void <ApplyInflationHooks>b__34_3(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor interactor) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 orig.Invoke(self, interactor); if (!NetworkServer.active || !RunArtifactManager.instance.IsArtifactEnabled(inflationArtifact) || (int)self.costType != 1) { return; } PurchaseInteraction[] array = Object.FindObjectsOfType<PurchaseInteraction>(); foreach (PurchaseInteraction val in array) { if ((Object)(object)val != (Object)(object)self && val.available && (int)val.costType == 1) { long num = (long)val.cost * 2L; val.Networkcost = (int)((num > int.MaxValue) ? int.MaxValue : num); } } } } public static ArtifactDef rhythmArtifact; public static ArtifactDef hivemindArtifact; public static ArtifactDef capitalismArtifact; public static ArtifactDef rivalArtifact; public static ArtifactDef locksmithArtifact; public static ArtifactDef inflationArtifact; public static ArtifactDef pantheonArtifact; public static ArtifactDef wakeArtifact; public static ArtifactDef necromancerArtifact; public static ArtifactDef rouletteArtifact; private GameObject potentialPrefab; public static GameObject coinPrefab; public static Inventory customMonsterInventory; private float capitalismTimer = 0f; private Dictionary<NetworkInstanceId, uint> savedGold = new Dictionary<NetworkInstanceId, uint>(); private bool hasSavedGoldThisStage = false; public static List<List<Sprite>> scareAnimations = new List<List<Sprite>>(); public static ConfigEntry<bool> enableJumpscares; public static ConfigEntry<bool> debugJumpscareTimer; public static ConfigEntry<KeyCode> wakeFlashKey; public static event Action OnJumpscareTriggered; public static void TriggerJumpscare() { ArcrinesArtifactsPlugin.OnJumpscareTriggered?.Invoke(); } public void Awake() { //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: 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_023f: Unknown result type (might be due to invalid IL or missing references) NetworkingAPI.RegisterMessageType<RivalItemSyncMessage>(); enableJumpscares = ((BaseUnityPlugin)this).Config.Bind<bool>("Artifact of Wake", "Enable Jumpscares", true, "If true, random animated jumpscares will occur while playing with the Artifact of Wake."); debugJumpscareTimer = ((BaseUnityPlugin)this).Config.Bind<bool>("Artifact of Wake", "Test Jumpscares (30s)", false, "TESTING ONLY: If true, jumpscares trigger exactly every 30 seconds."); wakeFlashKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Artifact of Wake", "Flashbang Keybind", (KeyCode)118, "Pressing this key spends gold to create a massive flare of light that stuns nearby enemies."); rhythmArtifact = CreateArtifact("Artifact of Rhythm", "Cooldowns only recharge when dealing damage or moving.", LoadIcon("RhythmON.png"), LoadIcon("RhythmOFF.png")); hivemindArtifact = CreateArtifact("Artifact of the Hivemind", "Killing a monster buffs all nearby monsters.", LoadIcon("HiveON.png"), LoadIcon("HiveOFF.png")); capitalismArtifact = CreateArtifact("Artifact of Capitalism", "The Teleporter drains your gold to charge.", LoadIcon("TaxON.png"), LoadIcon("TaxOFF.png")); rivalArtifact = CreateArtifact("Artifact of the Rival", "Chests drop 3 choices. You pick 1, the monsters get the other 2.", LoadIcon("RivalON.png"), LoadIcon("RivalOFF.png")); locksmithArtifact = CreateArtifact("Artifact of the Locksmith", "Rusted Keys are not consumed. Stacking them increases rewards.", LoadIcon("LockON.png"), LoadIcon("LockOFF.png")); inflationArtifact = CreateArtifact("Artifact of Inflation", "Keep gold between stages. Buying items doubles all other prices.", LoadIcon("GoldON.png"), LoadIcon("GoldOFF.png")); pantheonArtifact = CreateArtifact("Artifact of the Pantheon", "Only Bosses spawn, but their health and damage are drastically reduced.", LoadIcon("PanthON.png"), LoadIcon("PanthOFF.png")); wakeArtifact = CreateArtifact("Artifact of Wake", "The world is plunged into darkness. Press the Flash key to stun enemies in the dark.", LoadIcon("WakeON.png"), LoadIcon("WakeOFF.png")); necromancerArtifact = CreateArtifact("Artifact of the Necromancer", "Enemies you kill resurrect to fight for you. Max health drops per active ghost.", LoadIcon("NecroON.png"), LoadIcon("NecroOFF.png")); rouletteArtifact = CreateArtifact("Artifact of the Roulette", "Your base health, damage, and speed are randomized per stage.", LoadIcon("RollON.png"), LoadIcon("RollOFF.png")); LoadScares(); potentialPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/OptionPickup/OptionPickup.prefab").WaitForCompletion(); coinPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/CoinEmitter.prefab").WaitForCompletion(); ApplyRhythmHooks(); ApplyHivemindHooks(); ApplyCapitalismHooks(); ApplyRivalHooks(); ApplyLocksmithHooks(); ApplyInflationHooks(); ApplyNewArtifactHooks(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Arcrine's Artifacts have successfully loaded! Let the chaos begin."); } private Sprite LoadIcon(string fileName) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string[] files = Directory.GetFiles(directoryName, fileName, SearchOption.AllDirectories); if (files.Length != 0) { byte[] array = File.ReadAllBytes(files[0]); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, array); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } ((BaseUnityPlugin)this).Logger.LogError((object)("Missing Icon: " + fileName + " anywhere in the mod folder.")); return null; } private void LoadScares() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00c0: 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) string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); for (int i = 1; i <= 3; i++) { string[] files = Directory.GetFiles(directoryName, $"scare{i}_*.png", SearchOption.AllDirectories); if (files.Length != 0) { List<Sprite> list = new List<Sprite>(); string[] array = files.OrderBy((string f) => f).ToArray(); string[] array2 = array; foreach (string path in array2) { byte[] array3 = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, array3); list.Add(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f))); } if (list.Count > 0) { scareAnimations.Add(list); } } } } private ArtifactDef CreateArtifact(string name, string desc, Sprite onSprite, Sprite offSprite) { ArtifactDef val = ScriptableObject.CreateInstance<ArtifactDef>(); val.nameToken = name; val.descriptionToken = desc; val.smallIconSelectedSprite = onSprite; val.smallIconDeselectedSprite = offSprite; ContentAddition.AddArtifactDef(val); return val; } private void ApplyNewArtifactHooks() { //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_0020: Expected O, but got Unknown //IL_003a: 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_0045: Expected O, but got Unknown //IL_005f: 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_006a: Expected O, but got Unknown //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_008f: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown object obj = <>c.<>9__28_0; if (obj == null) { hook_Start val = delegate(orig_Start orig, ClassicStageInfo self) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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) //IL_011d: 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) //IL_012f: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown orig.Invoke(self); if (RunArtifactManager.instance.IsArtifactEnabled(pantheonArtifact) && self.monsterSelection != null) { WeightedSelection<DirectorCard> val7 = new WeightedSelection<DirectorCard>(8); for (int i = 0; i < self.monsterSelection.Count; i++) { ChoiceInfo<DirectorCard> choice = self.monsterSelection.GetChoice(i); DirectorCard val8 = choice.value; float num = choice.weight; if (val8 != null && (Object)(object)val8.spawnCard != (Object)null) { CharacterMaster component = val8.spawnCard.prefab.GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.bodyPrefab)) { CharacterBody component2 = component.bodyPrefab.GetComponent<CharacterBody>(); if (!component2.isChampion && !component2.isBoss) { num = 0f; } else { SpawnCard obj7 = Object.Instantiate<SpawnCard>(val8.spawnCard); CharacterSpawnCard val9 = (CharacterSpawnCard)(object)((obj7 is CharacterSpawnCard) ? obj7 : null); ((SpawnCard)val9).directorCreditCost = 20; DirectorCard val10 = new DirectorCard { spawnCard = (SpawnCard)(object)val9, selectionWeight = 100, spawnDistance = val8.spawnDistance, preventOverhead = val8.preventOverhead, minimumStageCompletions = val8.minimumStageCompletions, forbiddenUnlockableDef = val8.forbiddenUnlockableDef, requiredUnlockableDef = val8.requiredUnlockableDef }; val8 = val10; num = 100f; } } } if (num > 0f) { val7.AddChoice(val8, num); } } self.monsterSelection = val7; } }; <>c.<>9__28_0 = val; obj = (object)val; } ClassicStageInfo.Start += (hook_Start)obj; object obj2 = <>c.<>9__28_1; if (obj2 == null) { hook_RecalculateStats val2 = delegate(orig_RecalculateStats orig, CharacterBody self) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 orig.Invoke(self); if (!((Object)(object)Run.instance == (Object)null)) { if (RunArtifactManager.instance.IsArtifactEnabled(pantheonArtifact) && (int)self.teamComponent.teamIndex == 2 && (self.isChampion || self.isBoss)) { self.maxHealth *= 0.15f; self.damage *= 0.5f; } if (RunArtifactManager.instance.IsArtifactEnabled(rouletteArtifact) && self.isPlayerControlled) { Random random = new Random((int)Run.instance.seed + Run.instance.stageClearCount); self.maxHealth *= (float)random.NextDouble() * 2.5f + 0.5f; self.damage *= (float)random.NextDouble() * 2.5f + 0.5f; self.moveSpeed *= (float)random.NextDouble() * 2f + 0.5f; } if (RunArtifactManager.instance.IsArtifactEnabled(necromancerArtifact) && self.isPlayerControlled) { int num = 0; foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1)) { if (Object.op_Implicit((Object)(object)teamMember.body) && Object.op_Implicit((Object)(object)teamMember.body.inventory) && teamMember.body.inventory.GetItemCountPermanent(Items.Ghost) > 0) { num++; } } if (num > 0) { self.maxHealth *= Mathf.Pow(0.98f, (float)num); } } } }; <>c.<>9__28_1 = val2; obj2 = (object)val2; } CharacterBody.RecalculateStats += (hook_RecalculateStats)obj2; object obj3 = <>c.<>9__28_2; if (obj3 == null) { hook_Start val3 = delegate(orig_Start orig, SceneDirector self) { //IL_003a: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Invalid comparison between Unknown and I4 orig.Invoke(self); if (RunArtifactManager.instance.IsArtifactEnabled(wakeArtifact)) { RenderSettings.ambientIntensity = 0f; RenderSettings.ambientLight = new Color(0.05f, 0.05f, 0.05f); RenderSettings.skybox = null; RenderSettings.reflectionIntensity = 0f; RenderSettings.fog = true; RenderSettings.fogMode = (FogMode)2; RenderSettings.fogDensity = 0.08f; RenderSettings.fogColor = Color.black; Light[] array = Object.FindObjectsOfType<Light>(); foreach (Light val7 in array) { if (((Object)((Component)val7).gameObject).name != "WakeFlashlight" && (int)val7.type == 1) { val7.intensity = 0f; ((Behaviour)val7).enabled = false; } } } }; <>c.<>9__28_2 = val3; obj3 = (object)val3; } SceneDirector.Start += (hook_Start)obj3; object obj4 = <>c.<>9__28_3; if (obj4 == null) { hook_Start val4 = delegate(orig_Start orig, CameraRigController self) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if ((Object)(object)Run.instance != (Object)null && RunArtifactManager.instance.IsArtifactEnabled(wakeArtifact)) { if (Object.op_Implicit((Object)(object)self.sceneCam)) { self.sceneCam.clearFlags = (CameraClearFlags)2; self.sceneCam.backgroundColor = Color.black; Component component = ((Component)self.sceneCam).GetComponent("RampFog"); if (Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)component); } } ((Component)self).gameObject.AddComponent<WakeFlashlightController>(); if (enableJumpscares.Value) { ((Component)self).gameObject.AddComponent<WakeJumpscare>(); } } }; <>c.<>9__28_3 = val4; obj4 = (object)val4; } CameraRigController.Start += (hook_Start)obj4; object obj5 = <>c.<>9__28_4; if (obj5 == null) { hook_OnCharacterDeath val5 = delegate(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00f9: 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_0117: Expected O, but got Unknown orig.Invoke(self, damageReport); if (NetworkServer.active && RunArtifactManager.instance.IsArtifactEnabled(necromancerArtifact) && (int)damageReport.attackerTeamIndex == 1 && Object.op_Implicit((Object)(object)damageReport.victimBody) && Object.op_Implicit((Object)(object)damageReport.victimMaster) && (!Object.op_Implicit((Object)(object)damageReport.victimBody.inventory) || damageReport.victimBody.inventory.GetItemCountPermanent(Items.Ghost) <= 0)) { MasterSummon val7 = new MasterSummon { masterPrefab = MasterCatalog.GetMasterPrefab(damageReport.victimMaster.masterIndex), position = damageReport.victimBody.corePosition, rotation = damageReport.victimBody.transform.rotation, summonerBodyObject = (Object.op_Implicit((Object)(object)damageReport.attackerBody) ? ((Component)damageReport.attackerBody).gameObject : null), ignoreTeamMemberLimit = true, inventoryToCopy = damageReport.victimMaster.inventory, useAmbientLevel = true }; CharacterMaster val8 = val7.Perform(); if (Object.op_Implicit((Object)(object)val8) && Object.op_Implicit((Object)(object)val8.inventory)) { val8.inventory.GiveItemPermanent(Items.Ghost, 1); } } }; <>c.<>9__28_4 = val5; obj5 = (object)val5; } GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)obj5; object obj6 = <>c.<>9__28_5; if (obj6 == null) { hook_PerformInteraction val6 = delegate(orig_PerformInteraction orig, Interactor self, GameObject interactableObject) { orig.Invoke(self, interactableObject); if (RunArtifactManager.instance.IsArtifactEnabled(wakeArtifact) && enableJumpscares.Value) { CharacterBody component = ((Component)self).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && component.hasEffectiveAuthority && Random.value <= 0.005f) { TriggerJumpscare(); } } }; <>c.<>9__28_5 = val6; obj6 = (object)val6; } Interactor.PerformInteraction += (hook_PerformInteraction)obj6; } private void ApplyRhythmHooks() { //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_0020: Expected O, but got Unknown //IL_003a: 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_0045: Expected O, but got Unknown //IL_005f: 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_006a: Expected O, but got Unknown object obj = <>c.<>9__29_0; if (obj == null) { hook_FixedUpdate val = delegate(orig_FixedUpdate orig, GenericSkill self) { if (RunArtifactManager.instance.IsArtifactEnabled(rhythmArtifact)) { float rechargeStopwatch = self.rechargeStopwatch; orig.Invoke(self); if (self.rechargeStopwatch > rechargeStopwatch && self.rechargeStopwatch - rechargeStopwatch < 0.5f) { self.rechargeStopwatch = rechargeStopwatch; } } else { orig.Invoke(self); } }; <>c.<>9__29_0 = val; obj = (object)val; } GenericSkill.FixedUpdate += (hook_FixedUpdate)obj; object obj2 = <>c.<>9__29_1; if (obj2 == null) { hook_TakeDamage val2 = delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 orig.Invoke(self, damageInfo); if (RunArtifactManager.instance.IsArtifactEnabled(rhythmArtifact)) { if (Object.op_Implicit((Object)(object)damageInfo.attacker)) { CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && component.hasEffectiveAuthority) { GenericSkill[] allSkills = component.skillLocator.allSkills; foreach (GenericSkill val4 in allSkills) { if (val4.rechargeStopwatch < val4.finalRechargeInterval) { val4.rechargeStopwatch += damageInfo.damage * 0.02f; } } } } if (Object.op_Implicit((Object)(object)self.body) && self.body.hasEffectiveAuthority && (int)self.body.teamComponent.teamIndex == 1 && damageInfo.damage > 0f) { GenericSkill[] allSkills2 = self.body.skillLocator.allSkills; foreach (GenericSkill val5 in allSkills2) { if (val5.rechargeStopwatch < val5.finalRechargeInterval) { val5.rechargeStopwatch += 1.5f; } } } } }; <>c.<>9__29_1 = val2; obj2 = (object)val2; } HealthComponent.TakeDamage += (hook_TakeDamage)obj2; object obj3 = <>c.<>9__29_2; if (obj3 == null) { hook_FixedUpdate val3 = delegate(orig_FixedUpdate orig, CharacterMotor self) { orig.Invoke(self); if (RunArtifactManager.instance.IsArtifactEnabled(rhythmArtifact) && Object.op_Implicit((Object)(object)self.body) && self.body.hasEffectiveAuthority) { float magnitude = ((Vector3)(ref self.velocity)).magnitude; if (magnitude > 0.1f) { float num = magnitude * Time.fixedDeltaTime * 0.15f; if (!self.isGrounded) { num *= 2f; } GenericSkill[] allSkills = self.body.skillLocator.allSkills; foreach (GenericSkill val4 in allSkills) { if (val4.rechargeStopwatch < val4.finalRechargeInterval) { val4.rechargeStopwatch += num; } } } } }; <>c.<>9__29_2 = val3; obj3 = (object)val3; } CharacterMotor.FixedUpdate += (hook_FixedUpdate)obj3; } private void ApplyHivemindHooks() { //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_0020: Expected O, but got Unknown object obj = <>c.<>9__30_0; if (obj == null) { hook_OnCharacterDeath val = delegate(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //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) orig.Invoke(self, damageReport); if (NetworkServer.active && RunArtifactManager.instance.IsArtifactEnabled(hivemindArtifact) && (int)damageReport.victimTeamIndex == 2) { foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)2)) { if (Object.op_Implicit((Object)(object)teamMember.body) && (Object)(object)teamMember.body != (Object)(object)damageReport.victimBody && Vector3.Distance(teamMember.body.corePosition, damageReport.damageInfo.position) <= 30f) { teamMember.body.AddTimedBuff(Buffs.TeamWarCry, 5f); } } } }; <>c.<>9__30_0 = val; obj = (object)val; } GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)obj; } private void ApplyCapitalismHooks() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //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_0020: Expected O, but got Unknown object obj = <>c.<>9__31_0; if (obj == null) { hook_Awake val = delegate(orig_Awake orig, HoldoutZoneController self) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown orig.Invoke(self); ((Component)self).gameObject.AddComponent<CapitalismVisuals>(); object obj2 = <>c.<>9__31_2; if (obj2 == null) { CalcChargeRateDelegate val2 = delegate(ref float rate) { if (RunArtifactManager.instance.IsArtifactEnabled(capitalismArtifact)) { rate = 0f; } }; <>c.<>9__31_2 = val2; obj2 = (object)val2; } self.calcChargeRate += (CalcChargeRateDelegate)obj2; }; <>c.<>9__31_0 = val; obj = (object)val; } HoldoutZoneController.Awake += (hook_Awake)obj; HoldoutZoneController.Update += (hook_Update)delegate(orig_Update orig, HoldoutZoneController self) { //IL_00b2: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown orig.Invoke(self); if (NetworkServer.active && RunArtifactManager.instance.IsArtifactEnabled(capitalismArtifact)) { capitalismTimer += Time.deltaTime; if (capitalismTimer >= 1f) { capitalismTimer = 0f; uint num = (uint)Mathf.Max(1f, 15f * Run.instance.difficultyCoefficient); bool flag = false; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterBody body = instance.master.GetBody(); if (Object.op_Implicit((Object)(object)body) && Vector3.Distance(body.corePosition, ((Component)self).transform.position) <= self.currentRadius && instance.master.money >= num) { CharacterMaster master = instance.master; master.money -= num; flag = true; EffectManager.SpawnEffect(coinPrefab, new EffectData { origin = body.corePosition }, true); Util.PlaySound("Play_UI_coin", ((Component)body).gameObject); } } if (flag) { self.charge += 1f / Mathf.Max(1f, self.baseChargeDuration); } } } }; } private void ApplyRivalHooks() { //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_0020: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_003a: 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_0045: Expected O, but got Unknown object obj = <>c.<>9__32_0; if (obj == null) { hook_Start val = delegate(orig_Start orig, Run self) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown orig.Invoke(self); if (NetworkServer.active) { GameObject val3 = new GameObject("RivalMonsterInventory"); customMonsterInventory = val3.AddComponent<Inventory>(); NetworkServer.Spawn(val3); } }; <>c.<>9__32_0 = val; obj = (object)val; } Run.Start += (hook_Start)obj; object obj2 = <>c.<>9__32_1; if (obj2 == null) { hook_OnBodyStart val2 = delegate(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 orig.Invoke(self, body); if (NetworkServer.active && (int)self.teamIndex == 2 && RunArtifactManager.instance.IsArtifactEnabled(rivalArtifact) && Object.op_Implicit((Object)(object)customMonsterInventory)) { self.inventory.AddItemsFrom(customMonsterInventory); } }; <>c.<>9__32_1 = val2; obj2 = (object)val2; } CharacterMaster.OnBodyStart += (hook_OnBodyStart)obj2; ChestBehavior.ItemDrop += (hook_ItemDrop)delegate(orig_ItemDrop orig, ChestBehavior self) { //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) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00d0: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Invalid comparison between Unknown and I4 //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Invalid comparison between Unknown and I4 //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && RunArtifactManager.instance.IsArtifactEnabled(rivalArtifact)) { PickupIndex dropPickup = self.dropPickup; if (((PickupIndex)(ref dropPickup)).isValid) { PickupDef pickupDef = PickupCatalog.GetPickupDef(dropPickup); if (pickupDef != null && (int)pickupDef.itemIndex != -1 && (int)pickupDef.itemTier != 3) { Transform val3 = (Object.op_Implicit((Object)(object)self.dropTransform) ? self.dropTransform : ((Component)self).transform); GameObject val4 = Object.Instantiate<GameObject>(potentialPrefab, val3.position + Vector3.up * 1.5f, Quaternion.identity); PickupPickerController component = val4.GetComponent<PickupPickerController>(); List<Option> list = new List<Option>(); Option item = new Option { available = true }; ((Option)(ref item)).pickupIndex = dropPickup; list.Add(item); List<Option> options = list; List<PickupIndex> list2 = (((int)pickupDef.itemTier == 0) ? Run.instance.availableTier1DropList : (((int)pickupDef.itemTier == 1) ? Run.instance.availableTier2DropList : (((int)pickupDef.itemTier == 2) ? Run.instance.availableTier3DropList : Run.instance.availableBossDropList))); if (list2 != null && list2.Count > 0) { for (int i = 0; i < 2; i++) { List<Option> list3 = options; item = new Option { available = true }; ((Option)(ref item)).pickupIndex = list2[Random.Range(0, list2.Count)]; list3.Add(item); } } component.SetOptionsServer(options.ToArray()); ((UnityEvent<int>)(object)component.onPickupSelected).AddListener((UnityAction<int>)delegate(int sIdx) { //IL_001e: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_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) List<ItemIndex> list4 = new List<ItemIndex>(); for (int j = 0; j < options.Count; j++) { if (j != sIdx) { Option val5 = options[j]; list4.Add(PickupCatalog.GetPickupDef(((Option)(ref val5)).pickupIndex).itemIndex); } } if (list4.Count >= 2) { if (NetworkServer.active) { RivalItemSyncMessage rivalItemSyncMessage = default(RivalItemSyncMessage); rivalItemSyncMessage.item1 = list4[0]; rivalItemSyncMessage.item2 = list4[1]; rivalItemSyncMessage.OnReceived(); } else { NetMessageExtensions.Send((INetMessage)(object)new RivalItemSyncMessage { item1 = list4[0], item2 = list4[1] }, (NetworkDestination)2); } } }); NetworkServer.Spawn(val4); Rigidbody component2 = val4.GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component2)) { component2.velocity = Vector3.up * 20f + val3.forward * 2f; } return; } } } orig.Invoke(self); }; } private void ApplyLocksmithHooks() { //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_0020: Expected O, but got Unknown //IL_003a: 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_0045: Expected O, but got Unknown object obj = <>c.<>9__33_0; if (obj == null) { hook_RollItem val = delegate(orig_RollItem orig, ChestBehavior self) { if (RunArtifactManager.instance.IsArtifactEnabled(locksmithArtifact) && ((Object)((Component)self).gameObject).name.Contains("RustyChest")) { int num = 0; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance.master.inventory)) { num = Mathf.Max(num, instance.master.inventory.GetItemCountPermanent(Items.TreasureCache)); } } if (num > 0) { self.tier1Chance = 80f; self.tier2Chance = 20f * (float)num; self.tier3Chance = 1f * (float)(num * num); } } orig.Invoke(self); }; <>c.<>9__33_0 = val; obj = (object)val; } ChestBehavior.RollItem += (hook_RollItem)obj; object obj2 = <>c.<>9__33_1; if (obj2 == null) { hook_OnInteractionBegin val2 = delegate(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor interactor) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 int num = 0; Inventory val3 = null; if (RunArtifactManager.instance.IsArtifactEnabled(locksmithArtifact) && (int)self.costType == 12) { CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory)) { val3 = component.inventory; num = val3.GetItemCountPermanent(Items.TreasureCache); } } orig.Invoke(self, interactor); if ((Object)(object)val3 != (Object)null && num > 0) { int itemCountPermanent = val3.GetItemCountPermanent(Items.TreasureCache); if (itemCountPermanent < num) { val3.GiveItemPermanent(Items.TreasureCache, num - itemCountPermanent); } } }; <>c.<>9__33_1 = val2; obj2 = (object)val2; } PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj2; } private void ApplyInflationHooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown Stage.Start += (hook_Start)delegate(orig_Start orig, Stage self) { hasSavedGoldThisStage = false; return orig.Invoke(self); }; HoldoutZoneController.Update += (hook_Update)delegate(orig_Update orig, HoldoutZoneController self) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (NetworkServer.active && RunArtifactManager.instance.IsArtifactEnabled(inflationArtifact) && Object.op_Implicit((Object)(object)((Component)self).GetComponent<TeleporterInteraction>()) && self.charge >= 1f && !hasSavedGoldThisStage) { hasSavedGoldThisStage = true; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance.master)) { savedGold[((NetworkBehaviour)instance.master).netId] = instance.master.money; } } } }; CharacterMaster.OnServerStageBegin += (hook_OnServerStageBegin)delegate(orig_OnServerStageBegin orig, CharacterMaster self, Stage stage) { //IL_0029: 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_0061: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, stage); if (NetworkServer.active && RunArtifactManager.instance.IsArtifactEnabled(inflationArtifact) && savedGold.ContainsKey(((NetworkBehaviour)self).netId)) { self.money += savedGold[((NetworkBehaviour)self).netId]; savedGold.Remove(((NetworkBehaviour)self).netId); } }; object obj = <>c.<>9__34_3; if (obj == null) { hook_OnInteractionBegin val = delegate(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor interactor) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 orig.Invoke(self, interactor); if (NetworkServer.active && RunArtifactManager.instance.IsArtifactEnabled(inflationArtifact) && (int)self.costType == 1) { PurchaseInteraction[] array = Object.FindObjectsOfType<PurchaseInteraction>(); foreach (PurchaseInteraction val2 in array) { if ((Object)(object)val2 != (Object)(object)self && val2.available && (int)val2.costType == 1) { long num = (long)val2.cost * 2L; val2.Networkcost = (int)((num > int.MaxValue) ? int.MaxValue : num); } } } }; <>c.<>9__34_3 = val; obj = (object)val; } PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj; } } public class CapitalismVisuals : MonoBehaviour { private HoldoutZoneController zone; private Dictionary<CharacterBody, LineRenderer> tethers = new Dictionary<CharacterBody, LineRenderer>(); private Material tetherMat; private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) zone = ((Component)this).GetComponent<HoldoutZoneController>(); tetherMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matGlow1.mat").WaitForCompletion(); } private void Update() { //IL_0073: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: 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_00e3: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) if (!RunArtifactManager.instance.IsArtifactEnabled(ArcrinesArtifactsPlugin.capitalismArtifact)) { return; } uint num = (uint)Mathf.Max(1f, 15f * Run.instance.difficultyCoefficient); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterBody body = instance.master.GetBody(); if (!Object.op_Implicit((Object)(object)body)) { continue; } if (Vector3.Distance(body.corePosition, ((Component)zone).transform.position) <= zone.currentRadius && instance.master.money >= num) { if (!tethers.ContainsKey(body)) { GameObject val = new GameObject("CapitalismTether"); val.transform.SetParent(((Component)zone).transform); LineRenderer val2 = val.AddComponent<LineRenderer>(); ((Renderer)val2).material = tetherMat; val2.startColor = new Color(1f, 0.8f, 0.1f, 1f); val2.endColor = new Color(1f, 0.5f, 0f, 0.8f); val2.startWidth = 0.4f; val2.endWidth = 0.1f; val2.positionCount = 2; tethers[body] = val2; } ((Renderer)tethers[body]).enabled = true; tethers[body].SetPosition(0, body.corePosition); tethers[body].SetPosition(1, ((Component)zone).transform.position + Vector3.up * 1.5f); } else if (tethers.ContainsKey(body)) { ((Renderer)tethers[body]).enabled = false; } } List<CharacterBody> list = new List<CharacterBody>(); foreach (KeyValuePair<CharacterBody, LineRenderer> tether in tethers) { if ((Object)(object)tether.Key == (Object)null) { Object.Destroy((Object)(object)((Component)tether.Value).gameObject); list.Add(tether.Key); } } foreach (CharacterBody item in list) { tethers.Remove(item); } } } public class WakeFlashlightController : MonoBehaviour { private Light flashlight; private CameraRigController camRig; private float flareTimer = 0f; private float baseIntensity = 1.2f; private float flareIntensity = 12f; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) camRig = ((Component)this).GetComponent<CameraRigController>(); GameObject val = new GameObject("WakeFlashlight"); val.transform.SetParent(((Component)this).transform); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; flashlight = val.AddComponent<Light>(); flashlight.type = (LightType)0; flashlight.range = 80f; flashlight.spotAngle = 50f; flashlight.intensity = baseIntensity; flashlight.color = new Color(0.9f, 0.9f, 1f); } private void Update() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!RunArtifactManager.instance.IsArtifactEnabled(ArcrinesArtifactsPlugin.wakeArtifact)) { return; } if (Input.GetKeyDown(ArcrinesArtifactsPlugin.wakeFlashKey.Value) && Object.op_Implicit((Object)(object)camRig.target)) { CharacterBody component = camRig.target.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && component.hasEffectiveAuthority && Object.op_Implicit((Object)(object)component.master)) { uint num = (uint)Mathf.Max(15f, 25f * Run.instance.difficultyCoefficient); if (component.master.money >= num) { CharacterMaster master = component.master; master.money -= num; TriggerFlash(component); } } } if (flareTimer > 0f) { flareTimer -= Time.deltaTime; flashlight.intensity = Mathf.Lerp(baseIntensity, flareIntensity, flareTimer / 0.5f); } else { flashlight.intensity = baseIntensity; } } private void TriggerFlash(CharacterBody body) { //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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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) //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_0057: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) flareTimer = 0.5f; Util.PlaySound("Play_item_use_stunGrenade", ((Component)body).gameObject); new BlastAttack { attacker = ((Component)body).gameObject, inflictor = ((Component)body).gameObject, teamIndex = body.teamComponent.teamIndex, position = body.corePosition, radius = 40f, falloffModel = (FalloffModel)0, baseDamage = 0.1f, baseForce = 2000f, damageType = DamageTypeCombo.op_Implicit((DamageType)32) }.Fire(); } } public class WakeJumpscare : MonoBehaviour { private Image scareImage; private float timer; private float nextScare; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_007d: 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_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) GameObject val = new GameObject("ScareCanvas"); val.transform.SetParent(((Component)this).transform); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 9999; GameObject val3 = new GameObject("ScareImage"); val3.transform.SetParent(val.transform, false); scareImage = val3.AddComponent<Image>(); ((Graphic)scareImage).color = new Color(1f, 1f, 1f, 0f); RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; if (!Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent<AkGameObj>())) { ((Component)this).gameObject.AddComponent<AkGameObj>(); } SetNextScareTime(); ArcrinesArtifactsPlugin.OnJumpscareTriggered += ForceScare; } private void OnDestroy() { ArcrinesArtifactsPlugin.OnJumpscareTriggered -= ForceScare; } private void SetNextScareTime() { nextScare = (ArcrinesArtifactsPlugin.debugJumpscareTimer.Value ? 30f : Random.Range(480f, 900f)); } private void ForceScare() { ((MonoBehaviour)this).StartCoroutine(DoScare()); timer = 0f; SetNextScareTime(); } private void Update() { timer += Time.deltaTime; if (timer >= nextScare) { ForceScare(); } } private IEnumerator DoScare() { if (ArcrinesArtifactsPlugin.scareAnimations.Count == 0) { yield break; } List<Sprite> anim = ArcrinesArtifactsPlugin.scareAnimations[Random.Range(0, ArcrinesArtifactsPlugin.scareAnimations.Count)]; Util.PlaySound("Play_char_glass_death", ((Component)this).gameObject); Util.PlaySound("Play_item_use_lunar_enigma", ((Component)this).gameObject); ((Graphic)scareImage).color = new Color(1f, 1f, 1f, 1f); foreach (Sprite frame in anim) { scareImage.sprite = frame; yield return (object)new WaitForSeconds(0.04f); } ((Graphic)scareImage).color = new Color(1f, 1f, 1f, 0f); } } }