Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Cyphers Artifact Pack v2.0.0
Cypher Artifact Pack.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using ArtifactPackMod.Artifacts; using BepInEx; using BepInEx.Configuration; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using On.RoR2.CharacterAI; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using RoR2.Artifacts; using RoR2.CharacterAI; using RoR2.Navigation; using RoR2.UI; using TMPro; 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.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Cypher Artifact Pack")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Cypher Artifact Pack")] [assembly: AssemblyTitle("Cypher Artifact Pack")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace ArtifactPackMod { public abstract class ArtifactBase { public ArtifactDef ArtifactDef; public abstract string ArtifactName { get; } public abstract string ArtifactLangTokenName { get; } public abstract string ArtifactDescription { get; } public abstract string ArtifactIconName { get; } public void Initialize() { CreateArtifactDef(); Hooks(); } private void CreateArtifactDef() { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) ArtifactDef = ScriptableObject.CreateInstance<ArtifactDef>(); ArtifactDef.cachedName = ArtifactLangTokenName; ArtifactDef.nameToken = ArtifactLangTokenName; ArtifactDef.descriptionToken = ArtifactLangTokenName + "_DESC"; Sprite val = LoadSprite(ArtifactIconName); string text = ArtifactIconName.Replace(".png", "Disabled.png"); Sprite val2 = LoadSprite(text); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2)) { ArtifactDef.smallIconSelectedSprite = val; ArtifactDef.smallIconDeselectedSprite = val2; } else { Debug.LogError((object)("[ArtifactBase] Could not load icons for " + ArtifactName + ". Looking for: " + ArtifactIconName + " and " + text)); Texture2D val3 = new Texture2D(128, 128); Color[] array = (Color[])(object)new Color[16384]; for (int i = 0; i < array.Length; i++) { array[i] = Color.red; } val3.SetPixels(array); val3.Apply(); Texture2D val4 = new Texture2D(128, 128); Color[] array2 = (Color[])(object)new Color[16384]; for (int j = 0; j < array2.Length; j++) { array2[j] = Color.gray; } val4.SetPixels(array2); val4.Apply(); ArtifactDef.smallIconSelectedSprite = Sprite.Create(val3, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f)); ArtifactDef.smallIconDeselectedSprite = Sprite.Create(val4, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f)); } ContentAddition.AddArtifactDef(ArtifactDef); LanguageAPI.Add(ArtifactLangTokenName, ArtifactName); LanguageAPI.Add(ArtifactLangTokenName + "_DESC", ArtifactDescription); } public abstract void Hooks(); private Sprite LoadSprite(string fileName) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_009c: 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) Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2.EndsWith(fileName, StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (string.IsNullOrEmpty(text)) { return null; } using (Stream stream = executingAssembly.GetManifestResourceStream(text)) { if (stream == null) { return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2); if (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)); } } return null; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Cyphers.Artifact.Pack", "My Artifact Pack", "1.2.0")] public class ArtifactPackPlugin : BaseUnityPlugin { public static ArtifactPackPlugin Instance { get; private set; } public void Awake() { Instance = this; new AnarchyArtifact().Initialize(); new KinshipArtifact().Initialize(); new TempestArtifact().Initialize(); new StasisArtifact().Initialize(); new RouletteArtifact().Initialize(); new CrescentArtifact().Initialize(); new DesecratedArtifact().Initialize(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Artifact Pack Loaded Successfully!"); } } } namespace ArtifactPackMod.Artifacts { public class AnarchyArtifact : ArtifactBase { public static ConfigEntry<float> ConfigTimeLimit; public static ConfigEntry<float> ConfigRefundPercentage; public static ConfigEntry<float> ConfigLinearScaling; public static ConfigEntry<int> ConfigBatchSize; private static FieldInfo _spawnCountField; private static FieldInfo _currentMonsterCardField; public override string ArtifactName => "Artifact of Anarchy"; public override string ArtifactLangTokenName => "ARTIFACT_ANARCHY"; public override string ArtifactDescription => "Violence is inevitable. Difficulty scales linearly. After a delay, monsters refund credits on death and spawn in swarms with high diversity."; public override string ArtifactIconName => "Anarchy.png"; public override void Hooks() { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown ConfigTimeLimit = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Anarchy", "Violence Timer", 60f, "Seconds before the violence begins."); ConfigRefundPercentage = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Anarchy", "Credit Refund %", 65f, "Percentage of monster cost refunded to the Director on death during Violence."); ConfigLinearScaling = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Anarchy", "Linear Scaling Factor", 0.2f, "Adds (1 + Factor * StageCount) to difficulty scaling. Makes looping harder."); ConfigBatchSize = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Anarchy", "Spawn Batch Size", 2, "How many monsters of the same type can spawn before forcing a switch."); _spawnCountField = typeof(CombatDirector).GetField("spawnCountInCurrentWave", BindingFlags.Instance | BindingFlags.NonPublic); _currentMonsterCardField = typeof(CombatDirector).GetField("currentMonsterCard", BindingFlags.Instance | BindingFlags.NonPublic); Run.onRunStartGlobal += OnRunStart; Run.onRunDestroyGlobal += OnRunDestroy; Run.OnServerTeleporterPlaced += new hook_OnServerTeleporterPlaced(OnTeleporterPlaced); TeleporterInteraction.OnInteractionBegin += new hook_OnInteractionBegin(OnTeleporterInteract); CombatDirector.Simulate += new hook_Simulate(ApplyDirectorTweaks); CombatDirector.Awake += new hook_Awake(SetupCreditRefund); CombatDirector.PrepareNewMonsterWave += new hook_PrepareNewMonsterWave(ApplySwarmsDiscount); Run.RecalculateDifficultyCoefficentInternal += new Manipulator(HookLinearScaling); BaseAI.UpdateBodyInputs += new hook_UpdateBodyInputs(ForceSphereTargeting); BaseAI.OnBodyStart += new hook_OnBodyStart(AddTracker); TeamManager.IsTeamEnemy += new hook_IsTeamEnemy(ForceMonsterHostility); FriendlyFireManager.ShouldDirectHitProceed += new hook_ShouldDirectHitProceed(AllowMonsterCivilWar_Direct); FriendlyFireManager.ShouldSplashHitProceed += new hook_ShouldSplashHitProceed(AllowMonsterCivilWar_Splash); FriendlyFireManager.ShouldSeekingProceed += new hook_ShouldSeekingProceed(AllowMonsterCivilWar_Seeking); } private void OnRunStart(Run run) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (NetworkServer.active) { GameObject val = new GameObject("AnarchyController"); val.AddComponent<NetworkIdentity>(); val.AddComponent<AnarchyRunController>(); NetworkServer.Spawn(val); } } private void OnRunDestroy(Run run) { if (Object.op_Implicit((Object)(object)AnarchyRunController.Instance)) { Object.Destroy((Object)(object)((Component)AnarchyRunController.Instance).gameObject); } } private void OnTeleporterPlaced(orig_OnServerTeleporterPlaced orig, Run self, SceneDirector sceneDirector, GameObject teleporter) { orig.Invoke(self, sceneDirector, teleporter); if (NetworkServer.active && Object.op_Implicit((Object)(object)AnarchyRunController.Instance) && RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef)) { float deadline = Run.instance.fixedTime + ConfigTimeLimit.Value; AnarchyRunController.Instance.StartTimer(deadline); } } private void OnTeleporterInteract(orig_OnInteractionBegin orig, TeleporterInteraction self, Interactor interactor) { orig.Invoke(self, interactor); if (NetworkServer.active && Object.op_Implicit((Object)(object)AnarchyRunController.Instance)) { AnarchyRunController.Instance.StopTimer(); } } private void SetupCreditRefund(orig_Awake orig, CombatDirector self) { CombatDirector self2 = self; orig.Invoke(self2); if (!NetworkServer.active) { return; } ((UnityEvent<GameObject>)(object)self2.onSpawnedServer).AddListener((UnityAction<GameObject>)delegate(GameObject masterObject) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Invalid comparison between Unknown and I4 if (RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef)) { CharacterMaster component = masterObject.GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component)) { CharacterBody body = component.GetBody(); if (Object.op_Implicit((Object)(object)body) && !body.isBoss && !body.isChampion && (int)body.teamComponent.teamIndex == 2) { component.onBodyDestroyed += delegate(CharacterBody destroyedBody) { if (Object.op_Implicit((Object)(object)AnarchyRunController.Instance) && AnarchyRunController.Instance.ViolenceActive && Object.op_Implicit((Object)(object)self2) && ((Behaviour)self2).enabled && self2.monsterCredit > 0f) { float num = destroyedBody.cost * (ConfigRefundPercentage.Value / 100f); CombatDirector obj = self2; obj.monsterCredit += num; } }; } } } }); } private void ApplySwarmsDiscount(orig_PrepareNewMonsterWave orig, CombatDirector self, DirectorCard monsterCard) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown orig.Invoke(self, monsterCard); if (!NetworkServer.active || !Object.op_Implicit((Object)(object)AnarchyRunController.Instance) || !AnarchyRunController.Instance.ViolenceActive || !RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef)) { return; } DirectorCard val = null; if (_currentMonsterCardField != null) { val = (DirectorCard)_currentMonsterCardField.GetValue(self); } if (val != null && (Object)(object)val.spawnCard != (Object)null) { SpawnCard val2 = Object.Instantiate<SpawnCard>(val.spawnCard); ((Object)val2).name = ((Object)val.spawnCard).name + "_AnarchyDiscount"; val2.directorCreditCost = Mathf.Max(1, val.spawnCard.directorCreditCost / 2); DirectorCard value = new DirectorCard { spawnCard = val2, selectionWeight = val.selectionWeight, spawnDistance = val.spawnDistance, preventOverhead = val.preventOverhead, minimumStageCompletions = val.minimumStageCompletions, requiredUnlockable = val.requiredUnlockable, forbiddenUnlockable = val.forbiddenUnlockable }; if (_currentMonsterCardField != null) { _currentMonsterCardField.SetValue(self, value); } } } private void ApplyDirectorTweaks(orig_Simulate orig, CombatDirector self, float deltaTime) { if (NetworkServer.active && Object.op_Implicit((Object)(object)AnarchyRunController.Instance) && AnarchyRunController.Instance.ViolenceActive && RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef)) { self.minRerollSpawnInterval = 1f; self.maxRerollSpawnInterval = 2f; self.skipSpawnIfTooCheap = false; self.maximumNumberToSpawnBeforeSkipping = ConfigBatchSize.Value * 2; int num = 0; if (_spawnCountField != null) { num = (int)_spawnCountField.GetValue(self); } if (num >= self.maximumNumberToSpawnBeforeSkipping) { if (_spawnCountField != null) { _spawnCountField.SetValue(self, 0); } if (_currentMonsterCardField != null) { _currentMonsterCardField.SetValue(self, null); } } } orig.Invoke(self, deltaTime); } private void HookLinearScaling(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<Run>(x, "stageClearCount"), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Mathf>(x, "Pow") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, Run, float>>((Func<float, Run, float>)delegate(float currentScaling, Run runInstance) { if (RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef)) { float num = 1f + ConfigLinearScaling.Value * (float)runInstance.stageClearCount; return Mathf.Max(currentScaling, num); } return currentScaling; }); } else { Debug.LogError((object)"AnarchyArtifact: Failed to hook Linear Scaling IL."); } } private void AddTracker(orig_OnBodyStart orig, BaseAI self, CharacterBody body) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 orig.Invoke(self, body); if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef) && (int)body.teamComponent.teamIndex == 2) { if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<AnarchySphereTracker>())) { ((Component)self).gameObject.AddComponent<AnarchySphereTracker>(); } self.neverRetaliateFriendlies = false; } } private void ForceSphereTargeting(orig_UpdateBodyInputs orig, BaseAI self) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 orig.Invoke(self); if (!NetworkServer.active || !RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef) || !Object.op_Implicit((Object)(object)self.body) || (int)self.body.teamComponent.teamIndex != 2) { return; } AnarchySphereTracker component = ((Component)self).GetComponent<AnarchySphereTracker>(); if (Object.op_Implicit((Object)(object)component)) { CharacterBody val = FindBestTarget(self, component); if (Object.op_Implicit((Object)(object)val)) { self.currentEnemy.gameObject = ((Component)val).gameObject; self.currentEnemy.bestHurtBox = val.mainHurtBox; self.customTarget.gameObject = null; component.ResetRadius(); } else { HandleWandering(self, component); } } } private CharacterBody FindBestTarget(BaseAI self, AnarchySphereTracker tracker) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Invalid comparison between Unknown and I4 Vector3 val; if (Object.op_Implicit((Object)(object)self.currentEnemy.gameObject)) { CharacterBody characterBody = self.currentEnemy.characterBody; if (Object.op_Implicit((Object)(object)characterBody) && characterBody.healthComponent.alive) { val = characterBody.corePosition - self.body.corePosition; if (((Vector3)(ref val)).magnitude <= tracker.currentRadius && CheckLoS(self.body.inputBank.aimOrigin, characterBody)) { return characterBody; } } } CharacterBody result = null; float num = float.PositiveInfinity; Vector3 corePosition = self.body.corePosition; Vector3 aimOrigin = self.body.inputBank.aimOrigin; float engagementRange = GetEngagementRange(self.body.baseNameToken); float num2 = Mathf.Min(tracker.currentRadius, engagementRange); num2 *= num2; foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances == (Object)(object)self.body || !readOnlyInstances.healthComponent.alive || !TeamManager.IsTeamEnemy((TeamIndex)2, readOnlyInstances.teamComponent.teamIndex)) { continue; } val = readOnlyInstances.corePosition - corePosition; float num3 = ((Vector3)(ref val)).sqrMagnitude; if (!(num3 > num2) && CheckLoS(aimOrigin, readOnlyInstances)) { if ((int)readOnlyInstances.teamComponent.teamIndex == 1) { num3 *= 0.7f; } if (num3 < num) { num = num3; result = readOnlyInstances; } } } return result; } private float GetEngagementRange(string nameToken) { return nameToken switch { "BEETLE_BODY_NAME" => 45f, "IMP_BODY_NAME" => 45f, "LEMURIAN_BODY_NAME" => 70f, "GOLEM_BODY_NAME" => 70f, "WISP_BODY_NAME" => 90f, "GREATER_WISP_BODY_NAME" => 90f, _ => 60f, }; } private void HandleWandering(BaseAI self, AnarchySphereTracker tracker) { if (!((Object)(object)self.customTarget.gameObject != (Object)null)) { tracker.ExpandRadius(); } } private bool CheckLoS(Vector3 origin, CharacterBody target) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)target.mainHurtBox)) { return false; } Vector3 position = ((Component)target.mainHurtBox).transform.position; Vector3 val = position - origin; Vector3 val2 = position - origin; float magnitude = ((Vector3)(ref val2)).magnitude; LayerIndex world = LayerIndex.world; RaycastHit val3 = default(RaycastHit); return !Physics.Raycast(origin, val, ref val3, magnitude, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask)); } private bool ForceMonsterHostility(orig_IsTeamEnemy orig, TeamIndex teamA, TeamIndex teamB) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef) && (int)teamA == 2 && (int)teamB == 2) { return true; } return orig.Invoke(teamA, teamB); } private bool AllowMonsterCivilWar_Direct(orig_ShouldDirectHitProceed orig, HealthComponent victim, TeamIndex attackerTeamIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 if (orig.Invoke(victim, attackerTeamIndex)) { return true; } if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef) && (int)attackerTeamIndex == 2 && (int)victim.body.teamComponent.teamIndex == 2) { return true; } return false; } private bool AllowMonsterCivilWar_Splash(orig_ShouldSplashHitProceed orig, HealthComponent victim, TeamIndex attackerTeamIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 if (orig.Invoke(victim, attackerTeamIndex)) { return true; } if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef) && (int)attackerTeamIndex == 2 && (int)victim.body.teamComponent.teamIndex == 2) { return true; } return false; } private bool AllowMonsterCivilWar_Seeking(orig_ShouldSeekingProceed orig, HealthComponent victim, TeamIndex attackerTeamIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 if (orig.Invoke(victim, attackerTeamIndex)) { return true; } if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef) && (int)attackerTeamIndex == 2 && (int)victim.body.teamComponent.teamIndex == 2) { return true; } return false; } } public class AnarchyRunController : NetworkBehaviour { public static AnarchyRunController Instance; [SyncVar] public bool ViolenceActive; [SyncVar] public float Deadline; [SyncVar] public bool TimerRunning; public void Awake() { Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } public void StartTimer(float deadline) { Deadline = deadline; TimerRunning = true; ViolenceActive = false; } public void StopTimer() { TimerRunning = false; ViolenceActive = false; } public void FixedUpdate() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown if (NetworkServer.active && TimerRunning && Run.instance.fixedTime >= Deadline && !ViolenceActive) { ViolenceActive = true; Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cDeath>'...And then they called for violence...'</style>" }); } } } public class AnarchySphereTracker : MonoBehaviour { public float minRadius = 15f; public float maxRadius = 300f; public float currentRadius; public float growthRate = 15f; public void Awake() { ResetRadius(); } public void FixedUpdate() { if (currentRadius < maxRadius) { currentRadius += growthRate * Time.fixedDeltaTime; } } public void ResetRadius() { currentRadius = minRadius; } public void ExpandRadius() { if (currentRadius < maxRadius) { currentRadius += 10f; } } } public class CrescentArtifact : ArtifactBase { private static InteractableSpawnCard lunarPodCard; private static PickupIndex lunarCoinPickupIndex; public override string ArtifactName => "Artifact of the Crescent"; public override string ArtifactLangTokenName => "ARTIFACT_CRESCENT"; public override string ArtifactDescription => "Teleporter bosses drop Lunar Coins instead of items. Lunar Pods spawn on every stage."; public override string ArtifactIconName => "Crescent.png"; public override void Hooks() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown lunarPodCard = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/LunarChest/iscLunarChest.asset").WaitForCompletion(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)MiscPickups.LunarCoin)) { lunarCoinPickupIndex = PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex); } }); BossGroup.DropRewards += new hook_DropRewards(OverrideBossDrops); SceneDirector.PopulateScene += new hook_PopulateScene(GuaranteeLunarPod); } private void OverrideBossDrops(orig_DropRewards orig, BossGroup self) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Invalid comparison between Unknown and I4 //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Invalid comparison between Unknown and I4 //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Invalid comparison between Unknown and I4 //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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) if (!NetworkServer.active) { orig.Invoke(self); return; } if (!RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef)) { orig.Invoke(self); return; } if (!Object.op_Implicit((Object)(object)self.dropPosition)) { Debug.LogWarning((object)"Crescent Artifact: BossGroup has no drop position."); return; } Xoroshiro128Plus treasureRng = Run.instance.treasureRng; int num = (1 + self.bonusRewardCount) * Run.instance.participatingPlayerCount; int bonusRewardCount = self.bonusRewardCount; Transform dropPosition = self.dropPosition; for (int i = 0; i < num; i++) { PickupIndex val = PickupIndex.none; try { if (Object.op_Implicit((Object)(object)self.dropTable)) { val = self.dropTable.GenerateDrop(treasureRng); } else { List<PickupIndex> availableTier2DropList = Run.instance.availableTier2DropList; if (availableTier2DropList.Count > 0) { val = availableTier2DropList[treasureRng.RangeInt(0, availableTier2DropList.Count)]; } } } catch (Exception) { List<PickupIndex> availableTier2DropList2 = Run.instance.availableTier2DropList; if (availableTier2DropList2.Count > 0) { val = availableTier2DropList2[treasureRng.RangeInt(0, availableTier2DropList2.Count)]; } } int num2 = 5; if (val != PickupIndex.none) { PickupDef pickupDef = PickupCatalog.GetPickupDef(val); if (pickupDef != null) { num2 = (((int)pickupDef.itemTier == 1) ? 5 : (((int)pickupDef.itemTier == 4) ? 7 : (((int)pickupDef.itemTier != 2) ? 5 : 10))); } } num2 += bonusRewardCount; if (lunarCoinPickupIndex != PickupIndex.none && num2 > 0) { for (int j = 0; j < num2; j++) { Vector3 val2 = Vector3.up * 20f + Random.insideUnitSphere * 5f; PickupDropletController.CreatePickupDroplet(lunarCoinPickupIndex, dropPosition.position, val2); } } } } private void GuaranteeLunarPod(orig_PopulateScene orig, SceneDirector self) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_0045: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Invalid comparison between Unknown and I4 orig.Invoke(self); if (!NetworkServer.active || !RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef)) { return; } SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene(); if (!Object.op_Implicit((Object)(object)sceneDefForCurrentScene) || (int)sceneDefForCurrentScene.sceneType != 1 || !Object.op_Implicit((Object)(object)lunarPodCard)) { return; } DirectorPlacementRule val = new DirectorPlacementRule { placementMode = (PlacementMode)4 }; GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)lunarPodCard, val, Run.instance.stageRng)); if (Object.op_Implicit((Object)(object)val2)) { PurchaseInteraction component = val2.GetComponent<PurchaseInteraction>(); if (Object.op_Implicit((Object)(object)component) && (int)component.costType == 1) { component.Networkcost = Run.instance.GetDifficultyScaledCost(component.cost); } } } } public class DesecratedArtifact : ArtifactBase { public static ConfigEntry<int> ConfigMaxActiveGhosts; public static ConfigEntry<float> ConfigSpawnInterval; public static ConfigEntry<string> ConfigGhostColorHexA; public static ConfigEntry<string> ConfigGhostColorHexB; public static ConfigEntry<string> ConfigUIColorTop; public static ConfigEntry<string> ConfigUIColorBottom; public static ConfigEntry<float> ConfigGlowIntensity; public override string ArtifactName => "Artifact of the Desecrated"; public override string ArtifactLangTokenName => "ARTIFACT_DESECRATED"; public override string ArtifactDescription => "Enemies killed before the Teleporter event are resurrected as vengeful ghosts. Normal spawns are disabled during Teleporter charge."; public override string ArtifactIconName => "Desecrated.png"; public override void Hooks() { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown ConfigMaxActiveGhosts = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Desecrated - Gameplay", "Max Active Ghosts", 20, "The maximum number of resurrected ghosts allowed to exist at the same time. Lower this if you experience lag."); ConfigSpawnInterval = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Desecrated - Gameplay", "Ghost Respawn Delay", 4f, "The time (in seconds) between ghost spawns during the Teleporter event."); ConfigGhostColorHexA = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<string>("Artifact: Desecrated - Visuals", "Ghost Pulse Color A", "#73C2FB", "The starting color of the ghost's pulsing animation. Format: Hex Code (e.g., #FF0000 for Red, #00FF00 for Green)."); ConfigGhostColorHexB = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<string>("Artifact: Desecrated - Visuals", "Ghost Pulse Color B", "#8EEDFF", "The ending color of the ghost's pulsing animation. The ghost will fade back and forth between Color A and Color B."); ConfigUIColorTop = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<string>("Artifact: Desecrated - Visuals", "UI Text Top Color", "#73C2FB", "The color used for the TOP half of the warning text gradient."); ConfigUIColorBottom = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<string>("Artifact: Desecrated - Visuals", "UI Text Bottom Color", "##3B084D", "The color used for the BOTTOM half of the warning text gradient."); ConfigGlowIntensity = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Desecrated - Visuals", "Glow Intensity", 3f, "How bright the ghosts glow. Values above 1.0 create a Bloom effect. Set higher (e.g., 5.0) for blinding neon, or lower (e.g., 1.0) for flat colors."); Run.onRunStartGlobal += delegate(Run run) { if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef) && !Object.op_Implicit((Object)(object)((Component)run).gameObject.GetComponent<DesecratedController>())) { ((Component)run).gameObject.AddComponent<DesecratedController>(); } }; RunArtifactManager.onArtifactEnabledGlobal += (ArtifactStateChangeDelegate)delegate(RunArtifactManager run, ArtifactDef artifactDef) { if ((Object)(object)artifactDef == (Object)(object)ArtifactDef && !Object.op_Implicit((Object)(object)((Component)run).gameObject.GetComponent<DesecratedController>())) { ((Component)run).gameObject.AddComponent<DesecratedController>(); } }; RunArtifactManager.onArtifactDisabledGlobal += (ArtifactStateChangeDelegate)delegate(RunArtifactManager run, ArtifactDef artifactDef) { if ((Object)(object)artifactDef == (Object)(object)ArtifactDef) { DesecratedController component = ((Component)run).gameObject.GetComponent<DesecratedController>(); if (Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)component); } } }; CombatDirector.AttemptSpawnOnTarget += new hook_AttemptSpawnOnTarget(CombatDirector_AttemptSpawnOnTarget); CharacterBody.Start += new hook_Start(CharacterBody_Start); } public static Color ParseColor(string hex, float intensityMultiplier = 1f) { //IL_0012: 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) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); if (ColorUtility.TryParseHtmlString(hex, ref val)) { return val * intensityMultiplier; } return Color.white * intensityMultiplier; } private bool CombatDirector_AttemptSpawnOnTarget(orig_AttemptSpawnOnTarget orig, CombatDirector self, Transform spawnTarget, PlacementMode placementMode) { //IL_002d: 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) if (!RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef) || !Object.op_Implicit((Object)(object)TeleporterInteraction.instance) || !TeleporterInteraction.instance.isCharging) { return orig.Invoke(self, spawnTarget, placementMode); } if ((Object)(object)TeleporterInteraction.instance.bossDirector == (Object)(object)self) { return orig.Invoke(self, spawnTarget, placementMode); } return false; } private void CharacterBody_Start(orig_Start orig, CharacterBody self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self.master) && Object.op_Implicit((Object)(object)((Component)self.master).GetComponent<DesecratedGhostMarker>()) && !Object.op_Implicit((Object)(object)((Component)self).GetComponent<DesecratedGhostVisuals>())) { ((Component)self).gameObject.AddComponent<DesecratedGhostVisuals>(); } } } public class DesecratedGhostVisuals : MonoBehaviour { private CharacterBody body; private TemporaryOverlay overlay; private static Material ghostMaterial; private Color colorA; private Color colorB; private const float AnimationSpeed = 2f; private void Start() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_008e: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown body = ((Component)this).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.modelLocator) || !Object.op_Implicit((Object)(object)body.modelLocator.modelTransform)) { return; } float value = DesecratedArtifact.ConfigGlowIntensity.Value; colorA = DesecratedArtifact.ParseColor(DesecratedArtifact.ConfigGhostColorHexA.Value, value); colorB = DesecratedArtifact.ParseColor(DesecratedArtifact.ConfigGhostColorHexB.Value, value); if (!Object.op_Implicit((Object)(object)ghostMaterial)) { Material val = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matGhostEffect.mat").WaitForCompletion(); if (!Object.op_Implicit((Object)(object)val)) { return; } ghostMaterial = new Material(val); if (ghostMaterial.HasProperty("_AlphaBoost")) { ghostMaterial.SetFloat("_AlphaBoost", 1.5f); } if (ghostMaterial.HasProperty("_Boost")) { ghostMaterial.SetFloat("_Boost", 1.2f); } if (ghostMaterial.HasProperty("_FresnelPower")) { ghostMaterial.SetFloat("_FresnelPower", 1f); } } GameObject gameObject = ((Component)body.modelLocator.modelTransform).gameObject; CharacterModel component = gameObject.GetComponent<CharacterModel>(); if (Object.op_Implicit((Object)(object)component)) { component.isGhost = true; overlay = gameObject.AddComponent<TemporaryOverlay>(); overlay.duration = float.PositiveInfinity; overlay.destroyComponentOnEnd = true; overlay.originalMaterial = ghostMaterial; overlay.inspectorCharacterModel = component; overlay.alphaCurve = AnimationCurve.Constant(0f, 1f, 1f); overlay.animateShaderAlpha = true; } } private void Update() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)ghostMaterial)) { float num = Mathf.PingPong(Time.time * 2f, 1f); Color val = Color.Lerp(colorA, colorB, num); if (ghostMaterial.HasProperty("_TintColor")) { ghostMaterial.SetColor("_TintColor", val); } else if (ghostMaterial.HasProperty("_Color")) { ghostMaterial.SetColor("_Color", val); } } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)overlay)) { Object.Destroy((Object)(object)overlay); } } } public class DesecratedUIManager : MonoBehaviour { public static void ShowArtifactMessage(string messageText) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0032: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("DesecratedMessageUI"); Canvas obj = val.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 100; val.AddComponent<CanvasScaler>(); val.AddComponent<GraphicRaycaster>(); GameObject val2 = new GameObject("MessageText"); val2.transform.SetParent(val.transform, false); TextMeshProUGUI val3 = val2.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val3).text = messageText; ((TMP_Text)val3).font = HGTextMeshProUGUI.defaultLanguageFont; ((TMP_Text)val3).fontSize = 60f; ((TMP_Text)val3).alignment = (TextAlignmentOptions)514; ((TMP_Text)val3).enableWordWrapping = false; Color val4 = DesecratedArtifact.ParseColor(DesecratedArtifact.ConfigUIColorTop.Value); Color val5 = DesecratedArtifact.ParseColor(DesecratedArtifact.ConfigUIColorBottom.Value); VertexGradient colorGradient = default(VertexGradient); ((VertexGradient)(ref colorGradient))..ctor(val4, val4, val5, val5); ((TMP_Text)val3).colorGradient = colorGradient; ((TMP_Text)val3).enableVertexGradient = true; val.AddComponent<DesecratedUIAnimation>().targetText = val3; } } public class DesecratedUIAnimation : MonoBehaviour { public TextMeshProUGUI targetText; private float duration = 5f; private float timer; private void Start() { if (Object.op_Implicit((Object)(object)targetText)) { ((TMP_Text)targetText).alpha = 0f; ((TMP_Text)targetText).characterSpacing = 0f; } } private void Update() { timer += Time.deltaTime; float num = Mathf.Clamp01(timer / duration); if (Object.op_Implicit((Object)(object)targetText)) { if (num < 0.2f) { ((TMP_Text)targetText).alpha = num / 0.2f; } else if (num > 0.8f) { ((TMP_Text)targetText).alpha = 1f - (num - 0.8f) / 0.2f; } else { ((TMP_Text)targetText).alpha = 1f; } ((TMP_Text)targetText).characterSpacing = Mathf.Lerp(0f, 25f, num); } if (timer >= duration) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class DesecratedController : MonoBehaviour { private struct GhostEntry { public MasterIndex masterIndex; public EquipmentIndex eliteEquipmentIndex; } private List<GhostEntry> enemyGraveyard = new List<GhostEntry>(); private List<GhostEntry> currentSpawnDeck = new List<GhostEntry>(); private Xoroshiro128Plus rng; private float spawnTimer; private bool messageShown; public void Awake() { GlobalEventManager.onCharacterDeathGlobal += OnDeath; TeleporterInteraction.onTeleporterBeginChargingGlobal += OnTeleporterStart; TeleporterInteraction.onTeleporterChargedGlobal += OnTeleporterFinish; SceneCatalog.onMostRecentSceneDefChanged += OnSceneChanged; } public void OnDestroy() { GlobalEventManager.onCharacterDeathGlobal -= OnDeath; TeleporterInteraction.onTeleporterBeginChargingGlobal -= OnTeleporterStart; TeleporterInteraction.onTeleporterChargedGlobal -= OnTeleporterFinish; SceneCatalog.onMostRecentSceneDefChanged -= OnSceneChanged; } private void OnSceneChanged(SceneDef sceneDef) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown enemyGraveyard.Clear(); currentSpawnDeck.Clear(); messageShown = false; rng = new Xoroshiro128Plus(Run.instance.stageRng.nextUlong); } private void OnDeath(DamageReport report) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Invalid comparison between Unknown and I4 //IL_008b: 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_00ca: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && (!Object.op_Implicit((Object)(object)TeleporterInteraction.instance) || !TeleporterInteraction.instance.isCharging) && Object.op_Implicit((Object)(object)report.victimMaster) && report.victimMaster.masterIndex != MasterIndex.none && (int)report.victimTeamIndex == 2 && (!Object.op_Implicit((Object)(object)report.victimBody) || !Object.op_Implicit((Object)(object)((Component)report.victimBody).GetComponent<DesecratedGhostMarker>())) && !Object.op_Implicit((Object)(object)((Component)report.victimMaster).GetComponent<DesecratedGhostMarker>())) { EquipmentIndex eliteEquipmentIndex = (EquipmentIndex)(-1); if (Object.op_Implicit((Object)(object)report.victimMaster.inventory)) { eliteEquipmentIndex = report.victimMaster.inventory.GetEquipmentIndex(); } enemyGraveyard.Add(new GhostEntry { masterIndex = report.victimMaster.masterIndex, eliteEquipmentIndex = eliteEquipmentIndex }); } } private void OnTeleporterStart(TeleporterInteraction tp) { if (NetworkServer.active && !messageShown) { if (enemyGraveyard.Count > 0) { DesecratedUIManager.ShowArtifactMessage("You stirred the dead..."); RefillDeck(); } else { DesecratedUIManager.ShowArtifactMessage("They rest for now..."); } messageShown = true; } } private void OnTeleporterFinish(TeleporterInteraction tp) { currentSpawnDeck.Clear(); } private void RefillDeck() { if (enemyGraveyard.Count != 0) { currentSpawnDeck = new List<GhostEntry>(enemyGraveyard); Util.ShuffleList<GhostEntry>(currentSpawnDeck, rng); } } public void FixedUpdate() { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)Run.instance) || !Object.op_Implicit((Object)(object)TeleporterInteraction.instance) || !TeleporterInteraction.instance.isCharging) { return; } int num = 0; foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)((Component)readOnlyInstances).GetComponent<DesecratedGhostMarker>())) { num++; } } if (num < DesecratedArtifact.ConfigMaxActiveGhosts.Value && num < enemyGraveyard.Count) { spawnTimer -= Time.fixedDeltaTime; if (spawnTimer <= 0f) { SpawnNextGhost(); spawnTimer = DesecratedArtifact.ConfigSpawnInterval.Value; } } } private void SpawnNextGhost() { if (enemyGraveyard.Count != 0) { if (currentSpawnDeck.Count == 0) { RefillDeck(); } GhostEntry entry = currentSpawnDeck[0]; currentSpawnDeck.RemoveAt(0); SpawnGhost(entry); } } private void SpawnGhost(GhostEntry entry) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Invalid comparison between Unknown and I4 //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) GameObject masterPrefab = MasterCatalog.GetMasterPrefab(entry.masterIndex); if (!Object.op_Implicit((Object)(object)masterPrefab)) { return; } Vector3 val = ((Component)TeleporterInteraction.instance).transform.position; NodeGraph nodeGraph = SceneInfo.instance.GetNodeGraph((GraphType)0); if (Object.op_Implicit((Object)(object)nodeGraph)) { List<NodeIndex> list = nodeGraph.FindNodesInRange(val, 20f, 100f, (HullMask)1); if (list.Count > 0) { NodeIndex val2 = list[rng.RangeInt(0, list.Count)]; Vector3 val3 = default(Vector3); if (nodeGraph.GetNodePosition(val2, ref val3)) { val = val3; } } } CharacterMaster val4 = new MasterSummon { masterPrefab = masterPrefab, position = val, rotation = Quaternion.identity, teamIndexOverride = (TeamIndex)2, ignoreTeamMemberLimit = true, useAmbientLevel = true }.Perform(); if (Object.op_Implicit((Object)(object)val4)) { ((Component)val4).gameObject.AddComponent<DesecratedGhostMarker>(); if ((int)entry.eliteEquipmentIndex != -1 && Object.op_Implicit((Object)(object)val4.inventory)) { val4.inventory.SetEquipmentIndex(entry.eliteEquipmentIndex); } } } } public class DesecratedGhostMarker : MonoBehaviour { } public class KinshipArtifact : ArtifactBase { public static float CurrentStageMultiplier = 1f; public override string ArtifactName => "Artifact of Kinship"; public override string ArtifactLangTokenName => "ARTIFACT_KINSHIP"; public override string ArtifactDescription => "Every stage has a random Monster Family event active."; public override string ArtifactIconName => "Kinship.png"; public override void Hooks() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ClassicStageInfo.RebuildCards += new hook_RebuildCards(ForceFamilyEvent); CombatDirector.Simulate += new hook_Simulate(ApplyDynamicDirectorBudget); } private void ApplyDynamicDirectorBudget(orig_Simulate orig, CombatDirector self, float deltaTime) { if (Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef)) { orig.Invoke(self, deltaTime * CurrentStageMultiplier); } else { orig.Invoke(self, deltaTime); } } private void ForceFamilyEvent(orig_RebuildCards orig, ClassicStageInfo self, DirectorCardCategorySelection forcedMonsterCategory, DirectorCardCategorySelection forcedInteractableCategory) { //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown CurrentStageMultiplier = 1f; if (!Object.op_Implicit((Object)(object)RunArtifactManager.instance) || !RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef)) { orig.Invoke(self, forcedMonsterCategory, forcedInteractableCategory); return; } DirectorCardCategorySelection val = null; string text = null; try { FieldInfo field = typeof(ClassicStageInfo).GetField("monsterDccsPool", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(self); if (value != null) { FieldInfo field2 = value.GetType().GetField("poolCategories", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { Array obj = (Array)field2.GetValue(value); List<DirectorCardCategorySelection> list = new List<DirectorCardCategorySelection>(); foreach (object item in obj) { FieldInfo[] array = (from f in item.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) where f.FieldType.IsArray select f).ToArray(); for (int i = 0; i < array.Length; i++) { Array array2 = (Array)array[i].GetValue(item); if (array2 == null) { continue; } foreach (object item2 in array2) { FieldInfo field3 = item2.GetType().GetField("dccs", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field3 != null) { DirectorCardCategorySelection val2 = (DirectorCardCategorySelection)field3.GetValue(item2); if ((Object)(object)val2 != (Object)null && ((Object)val2).name.IndexOf("Family", StringComparison.OrdinalIgnoreCase) >= 0) { list.Add(val2); } } } } } if (list.Count > 0) { val = list[Run.instance.stageRng.RangeInt(0, list.Count)]; text = GetMessageForFamily(((Object)val).name); CurrentStageMultiplier = CalculateMultiplier(((Object)val).name); } } } } } catch (Exception ex) { Debug.LogWarning((object)("[Kinship] Reflection Error: " + ex.Message)); } if ((Object)(object)val != (Object)null) { forcedMonsterCategory = val; Debug.Log((object)$"[Kinship] Success! Family Enforced: {((Object)val).name}. Director Multiplier set to: {CurrentStageMultiplier}x"); if (!string.IsNullOrEmpty(text)) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = text }); } } else { SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene(); Debug.LogWarning((object)("[Kinship] No specific Family Events found for this stage (" + ((sceneDefForCurrentScene != null) ? sceneDefForCurrentScene.baseSceneName : null) + ").")); } orig.Invoke(self, forcedMonsterCategory, forcedInteractableCategory); } private float CalculateMultiplier(string dccsName) { string text = dccsName.ToLower(); if (text.Contains("void")) { return 4f; } if (text.Contains("parent")) { return 4f; } if (text.Contains("lunar")) { return 4f; } if (text.Contains("alloy")) { return 3.5f; } if (text.Contains("construct")) { return 3.5f; } if (text.Contains("imp")) { return 2f; } if (text.Contains("golem")) { return 2f; } if (text.Contains("mushroom")) { return 2f; } if (text.Contains("gup")) { return 2.5f; } if (text.Contains("solus")) { return 2f; } if (text.Contains("beetle")) { return 1f; } if (text.Contains("wisp")) { return 1f; } if (text.Contains("lemurian")) { return 1f; } if (text.Contains("jellyfish")) { return 1f; } text.Contains("vermin"); return 1f; } private string GetMessageForFamily(string dccsName) { string text = dccsName.ToLower(); if (text.Contains("wisp")) { return "The air begins to burn.."; } if (text.Contains("lemurian")) { return "The ground's temperature begins to rise.."; } if (text.Contains("imp")) { return "A tear in the fabric of the universe.."; } if (text.Contains("beetle")) { return "The ground begins to shift beneath you.."; } if (text.Contains("golem")) { return "The earth rumbles and groans with mysterious energies.."; } if (text.Contains("parent")) { return "The earth shifts and changes.."; } if (text.Contains("mushroom")) { return "The ground grows sickly.."; } if (text.Contains("construct")) { return "You have tripped an ancient alarm.."; } if (text.Contains("void")) { return "The Void has become curious.."; } if (text.Contains("lunar")) { return "The bulwark begins to falter.."; } if (text.Contains("jellyfish")) { return "The air crackles and arcs.."; } if (text.Contains("solus")) { return "The Collective is converging.."; } if (text.Contains("alloy")) { return "A committee swarms above.."; } if (text.Contains("gup")) { return "The air smells of sweet strawberries.."; } return "WARNING_FAMILY_EVENT"; } } public class RouletteArtifact : ArtifactBase { public class SyncRouletteEvent : INetMessage, ISerializableObject { private int eventId; private float duration; public SyncRouletteEvent() { } public SyncRouletteEvent(int id, float dur) { eventId = id; duration = dur; } public void Serialize(NetworkWriter writer) { writer.Write(eventId); writer.Write(duration); } public void Deserialize(NetworkReader reader) { eventId = reader.ReadInt32(); duration = reader.ReadSingle(); } public void OnReceived() { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Invalid comparison between Unknown and I4 //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Invalid comparison between Unknown and I4 if (NetworkServer.active) { return; } switch (eventId) { case 0: EliteEventActive = true; EliteEventTimer = duration; Chat.AddMessage($"[Roulette] <color=#FF8800>DANGER! All spawns are Elite for {duration} seconds!</color>"); break; case 1: BigHeadActive = true; BigHeadTimer = duration; Chat.AddMessage("[Roulette] <style=cIsUtility>BIG HEAD MODE!</style> All heads enlarged!"); { foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances) && !Object.op_Implicit((Object)(object)((Component)readOnlyInstances).GetComponent<RouletteBigHeadBehavior>())) { ((Component)readOnlyInstances).gameObject.AddComponent<RouletteBigHeadBehavior>(); } } break; } case 2: MiniEnemiesActive = true; GiantEnemiesActive = false; SizeEventTimer = duration; Chat.AddMessage("[Roulette] <style=cIsUtility>MINI MONSTERS!</style>"); { foreach (CharacterBody readOnlyInstances2 in CharacterBody.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances2) && Object.op_Implicit((Object)(object)readOnlyInstances2.teamComponent) && (int)readOnlyInstances2.teamComponent.teamIndex == 2 && !Object.op_Implicit((Object)(object)((Component)readOnlyInstances2).GetComponent<RouletteSizeBehavior>())) { ((Component)readOnlyInstances2).gameObject.AddComponent<RouletteSizeBehavior>().targetScale = 0.5f; } } break; } case 3: GiantEnemiesActive = true; MiniEnemiesActive = false; SizeEventTimer = duration; Chat.AddMessage("[Roulette] <style=cIsDamage>GIANT MONSTERS!</style>"); { foreach (CharacterBody readOnlyInstances3 in CharacterBody.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances3) && Object.op_Implicit((Object)(object)readOnlyInstances3.teamComponent) && (int)readOnlyInstances3.teamComponent.teamIndex == 2 && !Object.op_Implicit((Object)(object)((Component)readOnlyInstances3).GetComponent<RouletteSizeBehavior>())) { ((Component)readOnlyInstances3).gameObject.AddComponent<RouletteSizeBehavior>().targetScale = 2f; } } break; } } } } public class SyncTinyPlayer : INetMessage, ISerializableObject { private NetworkInstanceId netId; public SyncTinyPlayer() { } public SyncTinyPlayer(NetworkInstanceId id) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) netId = id; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(netId); } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) netId = reader.ReadNetworkId(); } public void OnReceived() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { return; } GameObject val = ClientScene.FindLocalObject(netId); if (Object.op_Implicit((Object)(object)val)) { CharacterBody component = val.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && !Object.op_Implicit((Object)(object)((Component)component).GetComponent<RouletteSizeBehavior>())) { ((Component)component).gameObject.AddComponent<RouletteSizeBehavior>().targetScale = 0.5f; Chat.AddMessage("[Roulette] A player has been Downsized!"); } } } } public class SyncFrailty : INetMessage, ISerializableObject { private NetworkInstanceId netId; public SyncFrailty() { } public SyncFrailty(NetworkInstanceId id) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) netId = id; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(netId); } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) netId = reader.ReadNetworkId(); } public void OnReceived() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { return; } GameObject val = ClientScene.FindLocalObject(netId); if (Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)val.GetComponent<RouletteFrailtyBehavior>())) { val.AddComponent<RouletteFrailtyBehavior>(); CharacterBody component = val.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { component.RecalculateStats(); } } } } public static ConfigEntry<int> ConfigMinItems; public static ConfigEntry<int> ConfigMaxItems; public static ConfigEntry<int> ConfigMinGold; public static ConfigEntry<int> ConfigMaxGold; public static ConfigEntry<float> ConfigEliteEventDuration; public static ConfigEntry<int> ConfigAllyMin; public static ConfigEntry<int> ConfigAllyMax; public static ConfigEntry<int> ConfigMinScrap; public static ConfigEntry<int> ConfigMaxScrap; public static ConfigEntry<int> ConfigHighRollerMin; public static ConfigEntry<int> ConfigHighRollerMax; public static ConfigEntry<float> WeightItems; public static ConfigEntry<float> WeightEliteHorde; public static ConfigEntry<float> WeightGoldSteal; public static ConfigEntry<float> WeightGoldGift; public static ConfigEntry<float> WeightBossSpawn; public static ConfigEntry<float> WeightRandomArtifact; public static ConfigEntry<float> WeightEliteEvent; public static ConfigEntry<float> WeightItemScramble; public static ConfigEntry<float> WeightRandomShrine; public static ConfigEntry<float> WeightSpawnAlly; public static ConfigEntry<float> WeightCurseFrailty; public static ConfigEntry<float> WeightActStrength; public static ConfigEntry<float> WeightBigHead; public static ConfigEntry<float> WeightTinyPlayer; public static ConfigEntry<float> WeightMiniEnemies; public static ConfigEntry<float> WeightGiantEnemies; public static ConfigEntry<float> WeightScrapFountain; public static ConfigEntry<float> WeightHighRoller; public static ConfigEntry<float> WeightFightThySelf; public static ConfigEntry<float> WeightMazelTov; public static ConfigEntry<float> WeightMithrix; private static GameObject shrineUseEffect; private static GameObject coinImpactEffect; private static GameObject shadowCloneEncounterPrefab; private static GameObject mithrixMasterPrefab; private static SpawnCard lemurianCard; private static List<SpawnCard> t1BossCards = new List<SpawnCard>(); private static List<SpawnCard> t2BossCards = new List<SpawnCard>(); private static List<SpawnCard> t3BossCards = new List<SpawnCard>(); private static List<SpawnCard> scavCards = new List<SpawnCard>(); private static List<GameObject> allyMasterPrefabs = new List<GameObject>(); private static List<BuffDef> eliteBuffs = new List<BuffDef>(); public static bool EliteEventActive = false; public static float EliteEventTimer = 0f; public static bool BigHeadActive = false; public static float BigHeadTimer = 0f; public static bool MiniEnemiesActive = false; public static bool GiantEnemiesActive = false; public static float SizeEventTimer = 0f; private static bool suppressMessages = false; public override string ArtifactName => "Artifact of Roulette"; public override string ArtifactLangTokenName => "ARTIFACT_ROULETTE"; public override string ArtifactDescription => "Chest interactables become a Roulette. Outcomes range from items, gold, and hordes to scrambling inventory or activating random artifacts."; public override string ArtifactIconName => "Roulette.png"; public override void Hooks() { //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Expected O, but got Unknown //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Expected O, but got Unknown //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Expected O, but got Unknown //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Expected O, but got Unknown //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Expected O, but got Unknown ConfigMinItems = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Roulette", "Min Items Drop", 1, "Minimum items dropped."); ConfigMaxItems = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Roulette", "Max Items Drop", 3, "Maximum items dropped."); ConfigMinGold = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Roulette", "Min Gold Gift", 50, "Minimum gold gift base amount."); ConfigMaxGold = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Roulette", "Max Gold Gift", 500, "Maximum gold gift base amount."); ConfigEliteEventDuration = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Elite Event Duration", 60f, "Duration in seconds for the forced Elite spawn event."); ConfigAllyMin = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Roulette", "Ally Spawn Min", 1, "Minimum number of allies to spawn."); ConfigAllyMax = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Roulette", "Ally Spawn Max", 6, "Maximum number of allies to spawn."); ConfigMinScrap = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Roulette", "Min Scrap Drop", 7, "Minimum scrap dropped in the fountain."); ConfigMaxScrap = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Roulette", "Max Scrap Drop", 10, "Maximum scrap dropped in the fountain."); ConfigHighRollerMin = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Roulette", "High Roller Min", 3, "Minimum items for High Roller."); ConfigHighRollerMax = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<int>("Artifact: Roulette", "High Roller Max", 10, "Maximum items for High Roller."); WeightItems = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Items", 50f, "Chance for Items."); WeightEliteHorde = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Elite Horde", 10f, "Chance for Elite Horde."); WeightGoldSteal = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Gold Steal", 10f, "Chance for Gold Loss."); WeightGoldGift = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Gold Gift", 10f, "Chance for Gold Gift."); WeightBossSpawn = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Boss Spawn", 5f, "Chance for Boss."); WeightRandomArtifact = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Random Artifact", 2f, "Chance to permanently activate a random Artifact."); WeightEliteEvent = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Elite Event", 5f, "Chance to force all spawns to be Elite for a duration."); WeightItemScramble = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Item Scramble", 3f, "Chance to re-roll the player's inventory."); WeightRandomShrine = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Random Shrine Effect", 5f, "Chance to mimic a random shrine (Mountain, Chance, Order, Combat)."); WeightSpawnAlly = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Spawn Allies", 8f, "Chance to spawn drones or monster allies."); WeightCurseFrailty = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Curse of Frailty", 4f, "Chance to halve HP but increase Damage for the stage."); WeightActStrength = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Act of Strength", 4f, "Chance to grant random Elite powers to the team temporarily."); WeightBigHead = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Big Head Mode", 5f, "Chance to enlarge heads by 75% for 60 seconds."); WeightTinyPlayer = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Tiny Player", 5f, "Chance to make the player tiny (0.5x) for 60 seconds."); WeightMiniEnemies = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Mini Enemies", 5f, "Chance to make all enemies tiny (0.5x) for 60 seconds."); WeightGiantEnemies = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Giant Enemies", 5f, "Chance to make all enemies giant (2.0x) for 60 seconds."); WeightScrapFountain = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Scrap Fountain", 10f, "Chance to spawn a fountain of scrap."); WeightHighRoller = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: High Roller", 7f, "Chance for tiered item fountain."); WeightFightThySelf = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Fight Thy Self", 4f, "Chance to spawn a doppelganger."); WeightMazelTov = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Mazel Tov", 1f, "Chance to activate nearly ALL effects at once."); WeightMithrix = ((BaseUnityPlugin)ArtifactPackPlugin.Instance).Config.Bind<float>("Artifact: Roulette", "Weight: Command Thee Kneel", 1f, "Tiny chance to spawn Mithrix."); NetworkingAPI.RegisterMessageType<SyncRouletteEvent>(); NetworkingAPI.RegisterMessageType<SyncTinyPlayer>(); NetworkingAPI.RegisterMessageType<SyncFrailty>(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(LoadAssets)); Run.onRunStartGlobal += ResetRouletteState; Run.onRunDestroyGlobal += ResetRouletteState; PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(InterceptInteraction); CombatDirector.IsEliteOnlyArtifactActive += new hook_IsEliteOnlyArtifactActive(ForceEliteOnlyIfEventActive); Run.FixedUpdate += new hook_FixedUpdate(Run_FixedUpdate); CharacterBody.Start += new hook_Start(CharacterBody_Start); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); } private void ResetRouletteState(Run run) { EliteEventActive = false; BigHeadActive = false; MiniEnemiesActive = false; GiantEnemiesActive = false; EliteEventTimer = 0f; BigHeadTimer = 0f; SizeEventTimer = 0f; suppressMessages = false; } private void LoadAssets() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) shrineUseEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/ShrineUseEffect.prefab").WaitForCompletion(); coinImpactEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/CoinImpact.prefab").WaitForCompletion(); shadowCloneEncounterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ShadowClone/ShadowCloneEncounter.prefab").WaitForCompletion(); mithrixMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/BrotherMaster.prefab").WaitForCompletion(); lemurianCard = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Lemurian/cscLemurian.asset").WaitForCompletion(); t1BossCards.Clear(); t1BossCards.Add(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Beetle/cscBeetleQueen.asset").WaitForCompletion()); t1BossCards.Add(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Vagrant/cscVagrant.asset").WaitForCompletion()); t1BossCards.Add(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Titan/cscTitanGolemPlains.asset").WaitForCompletion()); t1BossCards.Add(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/ClayBoss/cscClayBoss.asset").WaitForCompletion()); t2BossCards.Clear(); t2BossCards.Add(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Gravekeeper/cscGravekeeper.asset").WaitForCompletion()); t2BossCards.Add(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/RoboBallBoss/cscRoboBallBoss.asset").WaitForCompletion()); t2BossCards.Add(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/ImpBoss/cscImpBoss.asset").WaitForCompletion()); t2BossCards.Add(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/MagmaWorm/cscMagmaWorm.asset").WaitForCompletion()); t3BossCards.Clear(); t3BossCards.Add(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Grandparent/cscGrandparent.asset").WaitForCompletion()); scavCards.Clear(); scavCards.Add(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Scav/cscScav.asset").WaitForCompletion()); allyMasterPrefabs.Clear(); allyMasterPrefabs.Add(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Drones/Drone1Master.prefab").WaitForCompletion()); allyMasterPrefabs.Add(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Drones/Drone2Master.prefab").WaitForCompletion()); allyMasterPrefabs.Add(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Drones/MissileDroneMaster.prefab").WaitForCompletion()); allyMasterPrefabs.Add(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Drones/FlameDroneMaster.prefab").WaitForCompletion()); allyMasterPrefabs.Add(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Drones/EmergencyDroneMaster.prefab").WaitForCompletion()); allyMasterPrefabs.Add(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/LemurianMaster.prefab").WaitForCompletion()); allyMasterPrefabs.Add(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Beetle/BeetleMaster.prefab").WaitForCompletion()); allyMasterPrefabs.Add(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Imp/ImpMaster.prefab").WaitForCompletion()); allyMasterPrefabs.Add(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Wisp/WispMaster.prefab").WaitForCompletion()); eliteBuffs.Clear(); if (Object.op_Implicit((Object)(object)Buffs.AffixRed)) { eliteBuffs.Add(Buffs.AffixRed); } if (Object.op_Implicit((Object)(object)Buffs.AffixBlue)) { eliteBuffs.Add(Buffs.AffixBlue); } if (Object.op_Implicit((Object)(object)Buffs.AffixWhite)) { eliteBuffs.Add(Buffs.AffixWhite); } if (Object.op_Implicit((Object)(object)Buffs.AffixPoison)) { eliteBuffs.Add(Buffs.AffixPoison); } if (Object.op_Implicit((Object)(object)Buffs.AffixHaunted)) { eliteBuffs.Add(Buffs.AffixHaunted); } } private void Run_FixedUpdate(orig_FixedUpdate orig, Run self) { orig.Invoke(self); if (EliteEventActive) { EliteEventTimer -= Time.fixedDeltaTime; if (EliteEventTimer <= 0f) { EliteEventActive = false; BroadcastChat("<style=cIsHealth>[Roulette] The air calms down. Elite spawning returns to normal.</style>"); } } if (BigHeadActive) { BigHeadTimer -= Time.fixedDeltaTime; if (BigHeadTimer <= 0f) { BigHeadActive = false; BroadcastChat("<style=cIsHealth>[Roulette] Heads return to normal size.</style>"); } } if (MiniEnemiesActive || GiantEnemiesActive) { SizeEventTimer -= Time.fixedDeltaTime; if (SizeEventTimer <= 0f) { MiniEnemiesActive = false; GiantEnemiesActive = false; BroadcastChat("<style=cIsHealth>[Roulette] The strange size magic fades...</style>"); } } } private void CharacterBody_Start(orig_Start orig, CharacterBody self) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 orig.Invoke(self); if (BigHeadActive && !Object.op_Implicit((Object)(object)((Component)self).GetComponent<RouletteBigHeadBehavior>())) { ((Component)self).gameObject.AddComponent<RouletteBigHeadBehavior>(); } if (Object.op_Implicit((Object)(object)self.teamComponent) && (int)self.teamComponent.teamIndex == 2) { if (MiniEnemiesActive) { ApplySizeModifier(self, 0.5f); } else if (GiantEnemiesActive) { ApplySizeModifier(self, 2f); } } } private void ApplySizeModifier(CharacterBody body, float scaleMultiplier) { if (!Object.op_Implicit((Object)(object)((Component)body).GetComponent<RouletteSizeBehavior>())) { ((Component)body).gameObject.AddComponent<RouletteSizeBehavior>().targetScale = scaleMultiplier; } } private bool ForceEliteOnlyIfEventActive(orig_IsEliteOnlyArtifactActive orig) { if (EliteEventActive) { return true; } return orig.Invoke(); } private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)((Component)sender).GetComponent<RouletteFrailtyBehavior>())) { args.damageMultAdd += 0.5f; args.healthMultAdd -= 0.5f; } } private void InterceptInteraction(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown if (!NetworkServer.active || !Object.op_Implicit((Object)(object)RunArtifactManager.instance) || !RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef)) { orig.Invoke(self, activator); return; } if (!IsRouletteTarget(self)) { orig.Invoke(self, activator); return; } if (!self.available) { orig.Invoke(self, activator); return; } if (!self.CanBeAffordedByInteractor(activator)) { orig.Invoke(self, activator); return; } orig.Invoke(self, activator); CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { RunRouletteLogic(component, ((Component)self).transform.position, ((Component)self).gameObject); if (Object.op_Implicit((Object)(object)shrineUseEffect)) { EffectManager.SpawnEffect(shrineUseEffect, new EffectData { origin = ((Component)self).transform.position, rotation = Quaternion.identity, scale = 1f, color = Color32.op_Implicit(Color.magenta) }, true); } } } private bool IsRouletteTarget(PurchaseInteraction interaction) { GameObject gameObject = ((Component)interaction).gameObject; string name = ((Object)gameObject).name; if (name.Contains("Duplicator")) { return false; } if (name.Contains("VoidChest")) { return false; } if (name.Contains("LockboxVoid")) { return false; } if (Object.op_Implicit((Object)(object)gameObject.GetComponent<OptionChestBehavior>())) { return false; } if (name.Contains("LunarChest")) { return false; } if (name.Contains("Teleporter")) { return false; } if (name.Contains("Portal")) { return false; } if (name.Contains("Scrapper")) { return false; } if (Object.op_Implicit((Object)(object)gameObject.GetComponent<ChestBehavior>())) { return true; } if (Object.op_Implicit((Object)(object)gameObject.GetComponent<ShopTerminalBehavior>())) { return true; } if (Object.op_Implicit((Object)(object)gameObject.GetComponent<ShrineChanceBehavior>())) { return true; } return false; } private void RunRouletteLogic(CharacterBody player, Vector3 origin, GameObject sourceObject) { //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) suppressMessages = false; float num = WeightItems.Value + WeightEliteHorde.Value + WeightGoldSteal.Value + WeightGoldGift.Value + WeightBossSpawn.Value + WeightRandomArtifact.Value + WeightEliteEvent.Value + WeightItemScramble.Value + WeightRandomShrine.Value + WeightSpawnAlly.Value + WeightCurseFrailty.Value + WeightActStrength.Value + WeightBigHead.Value + WeightTinyPlayer.Value + WeightMiniEnemies.Value + WeightGiantEnemies.Value + WeightScrapFountain.Value + WeightHighRoller.Value + WeightFightThySelf.Value + WeightMazelTov.Value + WeightMithrix.Value; float num2 = Random.Range(0f, num); if (num2 < WeightItems.Value) { SpawnRandomItems(origin, sourceObject); return; } num2 -= WeightItems.Value; if (num2 < WeightEliteHorde.Value) { SpawnEliteHorde(player); return; } num2 -= WeightEliteHorde.Value; if (num2 < WeightGoldSteal.Value) { StealGold(player); return; } num2 -= WeightGoldSteal.Value; if (num2 < WeightGoldGift.Value) { GiftGoldAndItem(player, origin, sourceObject); return; } num2 -= WeightGoldGift.Value; if (num2 < WeightBossSpawn.Value) { SpawnBoss(player); return; } num2 -= WeightBossSpawn.Value; if (num2 < WeightRandomArtifact.Value) { ActivateRandomArtifact(); return; } num2 -= WeightRandomArtifact.Value; if (num2 < WeightEliteEvent.Value) { ActivateEliteEvent(); NetMessageExtensions.Send((INetMessage)(object)new SyncRouletteEvent(0, ConfigEliteEventDuration.Value), (NetworkDestination)1); return; } num2 -= WeightEliteEvent.Value; if (num2 < WeightItemScramble.Value) { ScrambleItems(player); return; } num2 -= WeightItemScramble.Value; if (num2 < WeightRandomShrine.Value) { ActivateRandomShrineEffect(player, origin, sourceObject); return; } num2 -= WeightRandomShrine.Value; if (num2 < WeightSpawnAlly.Value) { SpawnAllies(player, origin); return; } num2 -= WeightSpawnAlly.Value; if (num2 < WeightCurseFrailty.Value) { ApplyCurseOfFrailty(player); return; } num2 -= WeightCurseFrailty.Value; if (num2 < WeightActStrength.Value) { ActivateActOfStrength(player); return; } num2 -= WeightActStrength.Value; if (num2 < WeightBigHead.Value) { ActivateBigHeadMode(); NetMessageExtensions.Send((INetMessage)(object)new SyncRouletteEvent(1, 60f), (NetworkDestination)1); return; } num2 -= WeightBigHead.Value; if (num2 < WeightTinyPlayer.Value) { ActivateTinyPlayer(player); if (Object.op_Implicit((Object)(object)player.networkIdentity)) { NetMessageExtensions.Send((INetMessage)(object)new SyncTinyPlayer(player.networkIdentity.netId), (NetworkDestination)1); } return; } num2 -= WeightTinyPlayer.Value; if (num2 < WeightM