Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of RandomEvents v1.1.3
RandomEvents.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.InfiniteTowerSafeWard; using EntityStates.JellyfishMonster; using HG; using HG.Reflection; using IL.RoR2; using InLobbyConfig; using InLobbyConfig.Fields; using ItemStringParser; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.InfiniteTowerSafeWard; using On.EntityStates.JellyfishMonster; using On.RoR2; using On.RoR2.Artifacts; using R2API.Utils; using RoR2; using RoR2.Items; using RoR2.Navigation; using RoR2.Orbs; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RandomEvents")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+072e0f560b5c275ab22e82908c9770ae0a524e3f")] [assembly: AssemblyProduct("RandomEvents")] [assembly: AssemblyTitle("RandomEvents")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RandomEvents { public abstract class AbstractEvent { public ConfigEntry<bool> Enabled; public ConfigEntry<float> Weight; public abstract string GetEventConfigName(); public abstract string GetAnnouncement(); public void SetupConfig(ConfigFile config) { string text = ""; if (Utility.IsNullOrWhiteSpace(GetConditionDescription())) { text = text + "\nCondition: " + GetConditionDescription(); } Enabled = config.Bind<bool>(GetEventConfigName(), "SectionEnabled", true, "Enable " + GetEventConfigName() + ": " + GetDescription() + text); Weight = config.Bind<float>(GetEventConfigName(), "Weight", 1f, "Weight for the event."); AddConfig(config); } protected abstract void AddConfig(ConfigFile config); public float GetWeight() { return Weight.Value; } public bool IsEnabled() { return Enabled.Value; } public bool IsActive() { return RandomEvents.instance.m_activeEvents.Contains(this); } public virtual bool LoadCondition() { return true; } public abstract bool Condition(List<AbstractEvent> activeOtherEvents); public abstract void Preload(); public abstract void Prepare(); public abstract void Start(List<AbstractEvent> activeOtherEvents); public abstract void Stop(); public abstract void Hook(); public abstract string GetDescription(); public abstract string GetConditionDescription(); } internal class ChatHelper { private static Random rand = new Random(); private const string GrayColor = "7e91af"; private const string RedColor = "ed4c40"; private const string LunarColor = "5cb1ed"; private static string GetPlayerColor(PlayerCharacterMasterController pc) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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) pc.GetDisplayName(); SurvivorDef val = SurvivorCatalog.FindSurvivorDefFromBody(pc.master?.bodyPrefab); if ((Object)(object)val != (Object)null) { _ = val.primaryColor; return ColorUtility.ToHtmlStringRGB(val.primaryColor); } CharacterMaster master = pc.master; CharacterBody val2 = ((master != null) ? master.GetBody() : null); if ((Object)(object)val2 != (Object)null) { _ = val2.bodyColor; return ColorUtility.ToHtmlStringRGB(val2.bodyColor); } return "f27b0c"; } private static string GetColoredPlayerName(PlayerCharacterMasterController playerCharacterMasterController) { string playerColor = GetPlayerColor(playerCharacterMasterController); CharacterBody body = playerCharacterMasterController.master.GetBody(); return "<color=#" + playerColor + ">" + body.GetUserName() + "</color>"; } public static void LunarShopTerminalUsesLeft(PlayerCharacterMasterController playerCharacterMasterController, int usesLeft) { string coloredPlayerName = GetColoredPlayerName(playerCharacterMasterController); if (usesLeft > 1) { Send(string.Format("{0} <color=#{1}>can use a shop terminal</color> <color=#{2}>{3}</color> <color=#{4}>more times.</color>", coloredPlayerName, "7e91af", "ed4c40", usesLeft, "7e91af")); } else if (usesLeft == 1) { Send(string.Format("{0} <color=#{1}>can use a shop terminal</color> <color=#{2}>{3}</color> <color=#{4}>more time.</color>", coloredPlayerName, "7e91af", "ed4c40", usesLeft, "7e91af")); } else { Send(coloredPlayerName + " <color=#7e91af>can no longer use shop terminals.</color>"); } } public static void LunarRecyclerUsesLeft(int usesLeft) { if (usesLeft > 1) { Send(string.Format("The <color=#{0}>Lunar Recycler</color> <color=#{1}>can be used</color> <color=#{2}>{3}</color> <color=#{4}>more times.</color>", "5cb1ed", "7e91af", "ed4c40", usesLeft, "7e91af")); } else if (usesLeft == 1) { Send(string.Format("The <color=#{0}>Lunar Recycler</color> <color=#{1}>can be used</color> <color=#{2}>{3}</color> <color=#{4}>more time.</color>", "5cb1ed", "7e91af", "ed4c40", usesLeft, "7e91af")); } else { Send("The <color=#5cb1ed>Lunar Recycler</color> <color=#7e91af>can no longer be used.</color>"); } } public static string GetItemNames(PickupIndex[] pickupIndexes) { //IL_0083: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Invalid comparison between Unknown and I4 //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) Dictionary<PickupIndex, int> dictionary = (from x in pickupIndexes group x by x).ToDictionary((IGrouping<PickupIndex, PickupIndex> g) => g.Key, (IGrouping<PickupIndex, PickupIndex> g) => g.Count()); List<string> list = new List<string>(); foreach (KeyValuePair<PickupIndex, int> item in dictionary) { PickupIndex key = item.Key; int value = item.Value; PickupDef pickupDef = PickupCatalog.GetPickupDef(key); string text = pickupDef.internalName; ColorIndex val = (ColorIndex)14; if ((int)pickupDef.itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); text = Language.GetString(itemDef.nameToken); val = ItemTierCatalog.GetItemTierDef(itemDef.tier).colorIndex; } else if ((int)pickupDef.equipmentIndex != -1) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex); text = Language.GetString(equipmentDef.nameToken); val = equipmentDef.colorIndex; } string colorHexString = ColorCatalog.GetColorHexString(val); if (value > 1) { list.Add($"<color=#{colorHexString}>{text}</color> x {value}"); continue; } list.Add("<color=#" + colorHexString + ">" + text + "</color>"); } return string.Join(", ", list); } public static void AnnounceEvent() { int maxValue = 10; int num = rand.Next(maxValue); string stringFormatted = Language.GetStringFormatted($"ANNOUNCE_EVENT_{num}", Array.Empty<object>()); Send("<size=18px><style=cEvent>" + stringFormatted + "</color></size>"); } public static void AnnounceDoubleEvent() { int maxValue = 5; int num = rand.Next(maxValue); string stringFormatted = Language.GetStringFormatted($"ANNOUNCE_DOUBLE_EVENT_{num}", Array.Empty<object>()); Send("<size=22px><style=cEvent>" + stringFormatted + "</color></size>"); } public static void AnnounceTripleEvent() { int maxValue = 3; int num = rand.Next(maxValue); string stringFormatted = Language.GetStringFormatted($"ANNOUNCE_TRIPLE_EVENT_{num}", Array.Empty<object>()); Send("<size=26px><style=cEvent>" + stringFormatted + "</color></size>"); } public static void AnnounceEventConclusion() { int maxValue = 12; int num = rand.Next(maxValue); string stringFormatted = Language.GetStringFormatted($"ANNOUNCE_EVENT_CONCLUDE_{num}", Array.Empty<object>()); Send("<size=18px><style=cEvent>" + stringFormatted + "</color></size>"); } public static void SendToken(string token) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = Language.GetStringFormatted(token, Array.Empty<object>()) }); } public static void Send(string message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = message }); } } public class EventBulletHell : AbstractEvent { public class BulletHellComponent : MonoBehaviour { private TemporaryInventory inventory; private void OnEnable() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_0117: Unknown result type (might be due to invalid IL or missing references) CharacterBody component = ((Component)this).GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null && (Object)(object)component.inventory != (Object)null) { if ((Object)(object)inventory == (Object)null) { inventory = ((Component)this).gameObject.AddComponent<TemporaryInventory>(); } float num = 4f; int count = Mathf.RoundToInt(0f - Mathf.Log(num, 0.75f)); int num2 = Mathf.RoundToInt(Mathf.Log(0.1f) / Mathf.Log(0.95f)); inventory.GiveTemporaryItem(Items.TonicAffliction.itemIndex, num2); inventory.GiveTemporaryItem(Items.BoostHp.itemIndex, Mathf.RoundToInt(1f * (float)num2)); inventory.GiveTemporaryItem(Items.Hoof.itemIndex, Mathf.RoundToInt(1.4f * (float)num2)); inventory.GiveTemporaryItem(Items.BoostAttackSpeed.itemIndex, Mathf.RoundToInt(num * 10f * 0.1f * (float)num2)); if (!((Object)component).name.Equals("VoidJailerBody")) { inventory.GiveTemporaryItem(Items.AlienHead.itemIndex, count); } } } private void OnDisable() { Object.Destroy((Object)(object)inventory); } } public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { return true; } public override string GetEventConfigName() { return "BulletHell"; } public override string GetAnnouncement() { return Language.GetString("ANNOUNCE_EVENT_BULLET_HELL"); } public override string GetDescription() { return "Increases the fire rate of enemies but lowers their damage."; } public override string GetConditionDescription() { return ""; } protected override void AddConfig(ConfigFile config) { } public override void Preload() { } public override void Hook() { CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 if (ModConfig.Enabled.Value && NetworkServer.active && IsActive() && (int)body.teamComponent.teamIndex != 1) { UnityObjectExtensions.EnsureComponent<BulletHellComponent>(((Component)body).gameObject); } } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && (int)instances.teamComponent.teamIndex != 1) { UnityObjectExtensions.EnsureComponent<BulletHellComponent>(((Component)instances).gameObject); } } } public override void Stop() { BulletHellComponent bulletHellComponent = default(BulletHellComponent); foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && ((Component)instances).TryGetComponent<BulletHellComponent>(ref bulletHellComponent)) { Object.Destroy((Object)(object)bulletHellComponent); } } } } public class EventCasinoItem : AbstractEvent { public class CasinoItemComponent : MonoBehaviour { private TemporaryInventory inventory; private int timer; private int index; private List<ItemIndex> itemCandidates; private void FixedUpdate() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) timer++; if (timer <= 500) { return; } CharacterBody component = ((Component)this).GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null && (Object)(object)component.inventory != (Object)null) { if ((Object)(object)inventory == (Object)null) { inventory = ((Component)this).gameObject.AddComponent<TemporaryInventory>(); } ItemIndex itemIndex = itemCandidates[index]; inventory.RemoveTemporaryItem(itemIndex, 10); index = (index + 1) % itemCandidates.Count; ItemIndex val = itemCandidates[index]; inventory.GiveTemporaryItem(val, 10); PurchaseInteraction.CreateItemTakenOrb(component.transform.position, ((Component)component).gameObject, val); } timer = 0; } private void OnEnable() { //IL_0065: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0081: Invalid comparison between Unknown and I4 //IL_00a9: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) List<PickupIndex> list = new List<PickupIndex>(); list.AddRange(Run.instance.availableTier1DropList); list.AddRange(Run.instance.availableTier2DropList); list.AddRange(Run.instance.availableTier3DropList); list.AddRange(Run.instance.availableBossDropList); list.AddRange(Run.instance.availableLunarItemDropList); List<ItemIndex> list2 = new List<ItemIndex>(); foreach (PickupIndex item in list) { PickupDef pickupDef = PickupCatalog.GetPickupDef(item); if (pickupDef != null) { ItemIndex itemIndex = pickupDef.itemIndex; if ((int)ContagiousItemManager.GetTransformedItemIndex(itemIndex) == -1) { list2.Add(itemIndex); } } } list2.Remove(Items.ExtraStatsOnLevelUp.itemIndex); list2.Remove(Items.ExtraLife.itemIndex); list2.Remove(Items.FragileDamageBonus.itemIndex); list2.Remove(Items.HealingPotion.itemIndex); list2.Remove(Items.RegeneratingScrap.itemIndex); list2.Remove(Items.TeleportOnLowHealth.itemIndex); list2.Remove(Items.LowerPricedChests.itemIndex); list2.Remove(Items.BarrageOnBoss.itemIndex); list2.Remove(Items.OnLevelUpFreeUnlock.itemIndex); list2.Remove(Items.ItemDropChanceOnKill.itemIndex); list2.Remove(Items.RoboBallBuddy.itemIndex); list2.Remove(Items.BeetleGland.itemIndex); list2.Remove(Items.Clover.itemIndex); itemCandidates = list2.OrderBy((ItemIndex x) => Random.Range(0f, 1f)).ToList(); } private void OnDisable() { Object.Destroy((Object)(object)inventory); } } public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { return true; } public override string GetEventConfigName() { return "CasinoItem"; } public override string GetAnnouncement() { return Language.GetStringFormatted("ANNOUNCE_EVENT_CASINO_ITEM", Array.Empty<object>()); } public override string GetDescription() { return "Gives all players 10 items of random type. The type of the item changes every 10 seconds."; } public override string GetConditionDescription() { return ""; } protected override void AddConfig(ConfigFile config) { } public override void Preload() { } public override void Hook() { CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 if (ModConfig.Enabled.Value && NetworkServer.active && IsActive() && (int)body.teamComponent.teamIndex == 1 && body.isPlayerControlled) { UnityObjectExtensions.EnsureComponent<CasinoItemComponent>(((Component)body).gameObject); } } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1)) { if ((Object)(object)teamMember.body != (Object)null && teamMember.body.isPlayerControlled) { UnityObjectExtensions.EnsureComponent<CasinoItemComponent>(((Component)teamMember.body).gameObject); } } } public override void Stop() { CasinoItemComponent casinoItemComponent = default(CasinoItemComponent); foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && ((Component)instances).TryGetComponent<CasinoItemComponent>(ref casinoItemComponent)) { Object.Destroy((Object)(object)casinoItemComponent); } } } } public class EventEquipmentOnly : AbstractEvent { public class EquipmentOnlyComponent : MonoBehaviour { private TemporaryInventory inventory; private TemporaryEquipment equipment; private int timer; public void Setup(EquipmentDef equipmentDef) { //IL_0167: 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_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) CharacterBody component = ((Component)this).GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null && (Object)(object)component.inventory != (Object)null) { if ((Object)(object)inventory == (Object)null) { inventory = ((Component)this).gameObject.AddComponent<TemporaryInventory>(); equipment = ((Component)this).gameObject.AddComponent<TemporaryEquipment>(); } if ((Object)(object)equipmentDef == (Object)null) { WeightedSelection<EquipmentDef> obj = new WeightedSelection<EquipmentDef>(8); obj.AddChoice(Equipment.BFG, 1.5f); obj.AddChoice(Equipment.Molotov, 1f); obj.AddChoice(Equipment.CommandMissile, 1f); obj.AddChoice(Equipment.Lightning, 1f); obj.AddChoice(Equipment.Saw, 1f); equipmentDef = obj.Evaluate(Random.value); } if ((Object)(object)equipmentDef == (Object)(object)Equipment.BFG) { equipment.cooldownScale = 6f / Equipment.BFG.cooldown; } else if ((Object)(object)equipmentDef == (Object)(object)Equipment.Molotov) { equipment.cooldownScale = 1f / Equipment.Molotov.cooldown; } else if ((Object)(object)equipmentDef == (Object)(object)Equipment.Lightning) { equipment.cooldownScale = 0.5f / Equipment.Lightning.cooldown; } else { equipment.cooldownScale = 2f / equipmentDef.cooldown; } equipment.doNotDisableEquipment = true; equipment.SetTemporaryEquipment(equipmentDef.equipmentIndex); component.AddBuff(Buffs.DisableAllSkills); inventory.GiveTemporaryItem(Items.Feather.itemIndex, 3); PurchaseInteraction.CreateItemTakenOrb(component.transform.position, ((Component)component).gameObject, Items.Feather.itemIndex); component.inventory.RestockEquipmentCharges(component.inventory.activeEquipmentSlot, 1); } } private void OnDisable() { Object.Destroy((Object)(object)inventory); Object.Destroy((Object)(object)equipment); CharacterBody component = ((Component)this).GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null && (Object)(object)component.inventory != (Object)null) { component.RemoveBuff(Buffs.DisableAllSkills); } } private void FixedUpdate() { timer++; if (timer > 50) { CharacterBody component = ((Component)this).GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null) { _ = (Object)(object)component.skillLocator != (Object)null; } timer = 0; } } } private EquipmentDef commonEquipment; public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (((IEnumerable<ArtifactDef>)(object)RunArtifactManager.enabledArtifactsEnumerable).Any((ArtifactDef e) => (Object)(object)e == (Object)(object)Artifacts.Enigma)) { return false; } return !activeOtherEvents.Any((AbstractEvent e) => e.GetEventConfigName().Equals("SkillsOnly", StringComparison.InvariantCultureIgnoreCase) || e.GetEventConfigName().Equals("FuelArray", StringComparison.InvariantCultureIgnoreCase)); } public override string GetEventConfigName() { return "EquipmentOnly"; } public override string GetAnnouncement() { return Language.GetStringFormatted("ANNOUNCE_EVENT_EQUIPMENT_ONLY", Array.Empty<object>()); } public override string GetDescription() { return "Gives all players a random equipment temporarily with reduced cooldown but disables all skills."; } public override string GetConditionDescription() { return "Events \"SkillsOnly\", \"FuelArray\" inactive. Artifact of Enigma inactive."; } protected override void AddConfig(ConfigFile config) { } public override void Preload() { } public override void Hook() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; CharacterMaster.OnInventoryChanged += new Manipulator(CharacterMaster_OnInventoryChanged); } private void CharacterMaster_OnInventoryChanged(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.DefineLabel(); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCall<CharacterMaster>(x, "TransformBody") }); val.Remove(); val.EmitDelegate<Action<CharacterMaster, string>>((Action<CharacterMaster, string>)delegate(CharacterMaster self, string bodyName) { if (!ModConfig.Enabled.Value || !NetworkServer.active || !IsActive()) { self.TransformBody(bodyName); } }); } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 if (ModConfig.Enabled.Value && NetworkServer.active && IsActive() && (int)body.teamComponent.teamIndex == 1 && body.isPlayerControlled) { UnityObjectExtensions.EnsureComponent<EquipmentOnlyComponent>(((Component)body).gameObject).Setup(commonEquipment); } } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { WeightedSelection<EquipmentDef> val = new WeightedSelection<EquipmentDef>(8); val.AddChoice(Equipment.BFG, 3f); val.AddChoice(Equipment.Molotov, 2f); val.AddChoice(Equipment.CommandMissile, 1f); val.AddChoice(Equipment.Lightning, 1f); val.AddChoice(Equipment.Saw, 1f); val.AddChoice((EquipmentDef)null, 3f); commonEquipment = val.Evaluate(Random.value); foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1)) { if ((Object)(object)teamMember.body != (Object)null && teamMember.body.isPlayerControlled) { UnityObjectExtensions.EnsureComponent<EquipmentOnlyComponent>(((Component)teamMember.body).gameObject).Setup(commonEquipment); } } } public override void Stop() { EquipmentOnlyComponent equipmentOnlyComponent = default(EquipmentOnlyComponent); foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && ((Component)instances).TryGetComponent<EquipmentOnlyComponent>(ref equipmentOnlyComponent)) { Object.Destroy((Object)(object)equipmentOnlyComponent); } } } } public class EventExplodingCorpses : AbstractEvent { private AsyncOperationHandle<GameObject> FusionCellExplosion; private AsyncOperationHandle<GameObject> VFXScorchlingBreachExplosion; public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) bool flag = false; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (!instance.isConnected) { continue; } CharacterMaster master = instance.master; if (master != null && master.inventory.GetItemCount(Items.LunarPrimaryReplacement) >= 1) { continue; } CharacterMaster master2 = instance.master; if (master2 != null && master2.inventory.GetItemCount(Items.PrimarySkillShuriken) >= 8) { continue; } CharacterMaster master3 = instance.master; if (master3 != null && master3.inventory.GetItemCount(Items.SprintWisp) >= 2) { continue; } CharacterMaster master4 = instance.master; int? num = ((master4 != null) ? new int?(master4.inventory.GetTotalItemCountOfTier((ItemTier)0)) : null); CharacterMaster master5 = instance.master; int? num2 = num + ((master5 != null) ? new int?(master5.inventory.GetTotalItemCountOfTier((ItemTier)1) * 2) : null); CharacterMaster master6 = instance.master; int? num3 = num2 + ((master6 != null) ? new int?(master6.inventory.GetTotalItemCountOfTier((ItemTier)2) * 7) : null); CharacterMaster master7 = instance.master; int? num4 = num3 + ((master7 != null) ? new int?(master7.inventory.GetTotalItemCountOfTier((ItemTier)4) * 8) : null); CharacterMaster master8 = instance.master; int? num5 = num4 + ((master8 != null) ? new int?(master8.inventory.GetTotalItemCountOfTier((ItemTier)6) * 2) : null); CharacterMaster master9 = instance.master; int? num6 = num5 + ((master9 != null) ? new int?(master9.inventory.GetTotalItemCountOfTier((ItemTier)7) * 3) : null); CharacterMaster master10 = instance.master; if (num6 + ((master10 != null) ? new int?(master10.inventory.GetTotalItemCountOfTier((ItemTier)8) * 4) : null) >= 70) { continue; } SurvivorDef val = SurvivorCatalog.FindSurvivorDefFromBody(instance.master?.bodyPrefab); if ((Object)(object)val != (Object)null) { switch (val.cachedName) { case "Loader": case "Merc": case "FalseSon": flag = true; break; case "Toolbot": { CharacterBody component = instance.master.bodyPrefab.GetComponent<CharacterBody>(); SkillDef skillDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName("FireBuzzsaw")); bool flag2 = Helper.HasSkillVariantEnabled(instance.master.loadout, component.bodyIndex, Helper.FindSkillByFamilyName("ToolbotBodyPrimary1"), skillDef); Helper.HasSkillVariantEnabled(instance.master.loadout, component.bodyIndex, Helper.FindSkillByFamilyName("ToolbotBodyPrimary2"), skillDef); flag = flag || flag2; break; } } } else { flag = flag || true; } } return !flag; } public override string GetEventConfigName() { return "ExplodingCorpses"; } public override string GetAnnouncement() { return Language.GetStringFormatted("ANNOUNCE_EVENT_EXPLODING_CORPSES", Array.Empty<object>()); } public override string GetDescription() { return "All enemies explode upon death."; } public override string GetConditionDescription() { return "Players have sufficient means to do ranged damage."; } protected override void AddConfig(ConfigFile config) { } public override void Preload() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) FusionCellExplosion = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Scorchling/FusionCellExplosion.prefab"); VFXScorchlingBreachExplosion = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Scorchling/VFXScorchlingBreachExplosion.prefab"); } public override void Hook() { GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal; CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; } private void GlobalEventManager_onCharacterDeathGlobal(DamageReport damageReport) { if (ModConfig.Enabled.Value && NetworkServer.active && damageReport != null && (Object)(object)damageReport.victimBody != (Object)null && IsActive()) { Detonate(damageReport.victimBody, damageReport.attacker); } } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { if (ModConfig.Enabled.Value && NetworkServer.active && IsActive() && !body.HasBuff(Buffs.AttackSpeedOnCrit)) { body.AddBuff(Buffs.AttackSpeedOnCrit); } } private void Detonate(CharacterBody body, GameObject attacker) { //IL_0016: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0084: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00a6: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) float num = body.baseMaxHealth; if (num > 5000f) { num = 5000f; } Vector3 val = Vector3.Lerp(body.corePosition, body.footPosition, 0.5f); float num2 = num * 5f; float baseDamage = body.damage * 5f; float num3 = Mathf.Max(10f, Mathf.Sqrt(num) * 0.7f); EffectManager.SpawnEffect(VFXScorchlingBreachExplosion.WaitForCompletion(), new EffectData { origin = val, scale = num3 * 0.75f }, true); new BlastAttack { position = val, radius = num3, falloffModel = (FalloffModel)2, attacker = attacker, inflictor = null, damageColorIndex = (DamageColorIndex)0, baseDamage = baseDamage, baseForce = num2 * 3f, bonusForce = Vector3.zero, attackerFiltering = (AttackerFiltering)1, crit = false, procChainMask = default(ProcChainMask), procCoefficient = 0f, teamIndex = body.teamComponent.teamIndex }.Fire(); } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && !instances.HasBuff(Buffs.AttackSpeedOnCrit)) { instances.AddBuff(Buffs.AttackSpeedOnCrit); } } } public override void Stop() { foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && instances.HasBuff(Buffs.AttackSpeedOnCrit)) { instances.RemoveBuff(Buffs.AttackSpeedOnCrit); } } } } public class EventFallingEnemies : AbstractEvent { public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { return true; } public override string GetEventConfigName() { return "FallingEnemies"; } public override string GetAnnouncement() { return Language.GetStringFormatted("ANNOUNCE_EVENT_FALLING_ENEMIES", Array.Empty<object>()); } public override string GetDescription() { return "Enemies fall from the sky. Only walking enemies spawn."; } public override string GetConditionDescription() { return ""; } protected override void AddConfig(ConfigFile config) { } public override void Preload() { } public override void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown SpawnCard.DoSpawn += new hook_DoSpawn(SpawnCard_DoSpawn); } private SpawnResult SpawnCard_DoSpawn(orig_DoSpawn orig, SpawnCard self, Vector3 position, Quaternion rotation, DirectorSpawnRequest spawnRequest) { //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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) if (ModConfig.Enabled.Value && NetworkServer.active && IsActive() && (int)self.nodeGraphType == 0 && (Object)(object)self.prefab.GetComponent<CharacterMaster>() != (Object)null && (Object)(object)self.prefab.GetComponent<CharacterMaster>().bodyPrefab != (Object)null && (Object)(object)self.prefab.GetComponent<CharacterMaster>().bodyPrefab.GetComponent<CharacterBody>() != (Object)null && self.prefab.GetComponent<CharacterMaster>().bodyPrefab.GetComponent<CharacterBody>().baseMoveSpeed > 0f) { position.y += 5f; Vector3? val = Helper.RaycastToCeiling(position, 70f, lenient: true); position.y -= 5f; if (val.HasValue) { if (val.Value.y - 10f > position.y) { position.y = val.Value.y - 10f; } } else { position.y += 65f; } } return orig.Invoke(self, position, rotation, spawnRequest); } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0046: 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_00b8: 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) bool flag = false; WeightedSelection<DirectorCard> val = new WeightedSelection<DirectorCard>(8); ChoiceInfo<DirectorCard>[] choices = ClassicStageInfo.instance.monsterSelection.choices; for (int i = 0; i < choices.Length; i++) { ChoiceInfo<DirectorCard> val2 = choices[i]; if (!(val2.weight > 0f) || val2.value == null) { continue; } GameObject prefab = val2.value.spawnCard.prefab; if ((Object)(object)prefab != (Object)null && (Object)(object)prefab.GetComponent<CharacterMaster>() != (Object)null) { GameObject bodyPrefab = prefab.GetComponent<CharacterMaster>().bodyPrefab; if ((Object)(object)bodyPrefab != (Object)null && (Object)(object)bodyPrefab.GetComponent<CharacterBody>() != (Object)null && bodyPrefab.GetComponent<CharacterBody>().baseMoveSpeed > 0f && (int)val2.value.spawnCard.nodeGraphType == 0) { val.AddChoice(val2); flag = true; } } } if (flag) { ClassicStageInfo.instance.monsterSelection = val; } } public override void Stop() { if ((Object)(object)ClassicStageInfo.instance != (Object)null) { ClassicStageInfo.instance.RebuildCards((DirectorCardCategorySelection)null, (DirectorCardCategorySelection)null); } } } public class EventFuelArray : AbstractEvent { public class FuelArrayComponent : MonoBehaviour { private TemporaryEquipment equipment; private void OnEnable() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = default(CharacterBody); if (((Component)this).TryGetComponent<CharacterBody>(ref val)) { val.AddBuff(Buffs.ArmorBoost); equipment = ((Component)this).gameObject.AddComponent<TemporaryEquipment>(); equipment.SetTemporaryEquipment(Equipment.QuestVolatileBattery.equipmentIndex); } } private void OnDisable() { CharacterBody val = default(CharacterBody); if (((Component)this).TryGetComponent<CharacterBody>(ref val)) { val.RemoveBuff(Buffs.ArmorBoost); } if ((Object)(object)equipment != (Object)null) { Object.Destroy((Object)(object)equipment); } } } public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { return !activeOtherEvents.Any((AbstractEvent e) => e.GetEventConfigName().Equals("EquipmentOnly", StringComparison.InvariantCultureIgnoreCase)); } public override string GetEventConfigName() { return "FuelArray"; } public override string GetAnnouncement() { return Language.GetStringFormatted("ANNOUNCE_EVENT_FUEL_ARRAY", Array.Empty<object>()); } public override string GetDescription() { return "All players get a Fuel Array equipment temporarily but take reduced damage from all sources."; } public override string GetConditionDescription() { return "Event \"FuelArray\" inactive."; } protected override void AddConfig(ConfigFile config) { } public override void Preload() { } public override void Hook() { CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 if (ModConfig.Enabled.Value && NetworkServer.active && IsActive() && (int)body.teamComponent.teamIndex == 1 && body.isPlayerControlled) { UnityObjectExtensions.EnsureComponent<FuelArrayComponent>(((Component)body).gameObject); } } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1)) { if ((Object)(object)teamMember.body != (Object)null && teamMember.body.isPlayerControlled) { UnityObjectExtensions.EnsureComponent<FuelArrayComponent>(((Component)teamMember.body).gameObject); } } } public override void Stop() { FuelArrayComponent fuelArrayComponent = default(FuelArrayComponent); foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && ((Component)instances).TryGetComponent<FuelArrayComponent>(ref fuelArrayComponent)) { Object.Destroy((Object)(object)fuelArrayComponent); } } } } public class EventGhosts : AbstractEvent { public class GhostComponent : MonoBehaviour { private TemporaryInventory inventory; private void OnEnable() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) CharacterBody component = ((Component)this).GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null && (Object)(object)component.inventory != (Object)null) { if ((Object)(object)inventory == (Object)null) { inventory = ((Component)this).gameObject.AddComponent<TemporaryInventory>(); } inventory.GiveTemporaryItem(Items.Ghost.itemIndex); inventory.GiveTemporaryItem(Items.HealthDecay.itemIndex, Math.Max(10, Math.Min((int)Mathf.Sqrt(component.baseMaxHealth), 60))); } } private void OnDisable() { Object.Destroy((Object)(object)inventory); } } private ConfigEntry<float> GhostProbability; public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { Run instance = Run.instance; InfiniteTowerRun val = (InfiniteTowerRun)(object)((instance is InfiniteTowerRun) ? instance : null); if (val != null && (val.waveIndex + 1) % 5 == 0) { return false; } return true; } public override string GetEventConfigName() { return "Ghosts"; } public override string GetAnnouncement() { return Language.GetString("ANNOUNCE_EVENT_GHOSTS"); } public override string GetDescription() { return "Some enemies spawn as incorporeal ghosts. They disappear after some time."; } public override string GetConditionDescription() { return "Currently not a boss wave."; } protected override void AddConfig(ConfigFile config) { GhostProbability = config.Bind<float>(GetEventConfigName(), "Ghost Probability", 0.3f, "Probability for a monster to become a ghost."); } public override void Preload() { } public override void Hook() { CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 if (ModConfig.Enabled.Value && NetworkServer.active && IsActive() && (int)body.teamComponent.teamIndex != 1 && !body.isBoss) { CharacterMaster master = body.master; if ((Object)(object)((master != null) ? ((Component)master).gameObject.GetComponent<EventZombies.ZombieComponent>() : null) == (Object)null && Run.instance.runRNG.nextNormalizedFloat < GhostProbability.Value) { UnityObjectExtensions.EnsureComponent<GhostComponent>(((Component)body).gameObject); } } } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && (int)instances.teamComponent.teamIndex != 1 && !instances.isBoss) { CharacterMaster master = instances.master; if ((Object)(object)((master != null) ? ((Component)master).gameObject.GetComponent<EventZombies.ZombieComponent>() : null) == (Object)null && Run.instance.runRNG.nextNormalizedFloat < GhostProbability.Value) { UnityObjectExtensions.EnsureComponent<GhostComponent>(((Component)instances).gameObject); } } } } public override void Stop() { GhostComponent ghostComponent = default(GhostComponent); foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && ((Component)instances).TryGetComponent<GhostComponent>(ref ghostComponent)) { Object.Destroy((Object)(object)ghostComponent); } } } } public class EventHaste : AbstractEvent { public class HasteComponent : MonoBehaviour { private void OnEnable() { CharacterBody val = default(CharacterBody); if (((Component)this).TryGetComponent<CharacterBody>(ref val)) { val.AddBuff(Buffs.KillMoveSpeed); val.AddBuff(Buffs.KillMoveSpeed); val.AddBuff(Buffs.KillMoveSpeed); val.AddBuff(Buffs.KillMoveSpeed); val.AddBuff(Buffs.KillMoveSpeed); val.AddBuff(Buffs.KillMoveSpeed); } } private void OnDisable() { CharacterBody val = default(CharacterBody); if (((Component)this).TryGetComponent<CharacterBody>(ref val)) { val.RemoveBuff(Buffs.KillMoveSpeed); val.RemoveBuff(Buffs.KillMoveSpeed); val.RemoveBuff(Buffs.KillMoveSpeed); val.RemoveBuff(Buffs.KillMoveSpeed); val.RemoveBuff(Buffs.KillMoveSpeed); val.RemoveBuff(Buffs.KillMoveSpeed); } } } public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { return true; } public override string GetEventConfigName() { return "Haste"; } public override string GetAnnouncement() { return Language.GetStringFormatted("ANNOUNCE_EVENT_HASTE", Array.Empty<object>()); } public override string GetDescription() { return "All beings become faster."; } public override string GetConditionDescription() { return ""; } protected override void AddConfig(ConfigFile config) { } public override void Preload() { } public override void Hook() { CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { if (ModConfig.Enabled.Value && NetworkServer.active && IsActive()) { UnityObjectExtensions.EnsureComponent<HasteComponent>(((Component)body).gameObject); } } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null) { UnityObjectExtensions.EnsureComponent<HasteComponent>(((Component)instances).gameObject); } } } public override void Stop() { HasteComponent hasteComponent = default(HasteComponent); foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && ((Component)instances).TryGetComponent<HasteComponent>(ref hasteComponent)) { Object.Destroy((Object)(object)hasteComponent); } } } } public class EventItemZone : AbstractEvent { public class ItemZoneComponent : MonoBehaviour { private List<TemporaryInventory> inventories = new List<TemporaryInventory>(); private int timer; private ItemIndex itemIndex; private void FixedUpdate() { //IL_0023: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) timer++; if (timer % 10 == 0) { Helper.PlayersInRadiusResult playersInRadius = Helper.GetPlayersInRadius((HoldoutZoneShape)0, ((Component)this).transform.position, 4f, (TeamIndex)1); foreach (TeamComponent item in playersInRadius.playersInRadius) { TemporaryInventory temporaryInventory = TemporaryInventory.Find(((Component)item).gameObject, inventories); if ((Object)(object)temporaryInventory == (Object)null) { temporaryInventory = ((Component)item).gameObject.AddComponent<TemporaryInventory>(); inventories.Add(temporaryInventory); } temporaryInventory.GiveTemporaryItem(itemIndex); PurchaseInteraction.CreateItemTakenOrb(((Component)this).transform.position, ((Component)item).gameObject, itemIndex); } if (timer == 50) { foreach (TeamComponent item2 in playersInRadius.playersNotInRadius) { TemporaryInventory temporaryInventory2 = TemporaryInventory.Find(((Component)item2).gameObject, inventories); if ((Object)(object)temporaryInventory2 != (Object)null) { temporaryInventory2.RemoveTemporaryItem(itemIndex); } } } } if (timer > 50) { timer = 0; } } private void OnEnable() { //IL_0065: 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_0079: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) List<PickupIndex> list = new List<PickupIndex>(); list.AddRange(Run.instance.availableTier1DropList); list.AddRange(Run.instance.availableTier2DropList); list.AddRange(Run.instance.availableTier3DropList); list.AddRange(Run.instance.availableBossDropList); list.AddRange(Run.instance.availableLunarItemDropList); List<ItemIndex> list2 = new List<ItemIndex>(); foreach (PickupIndex item in list) { PickupDef pickupDef = PickupCatalog.GetPickupDef(item); if (pickupDef != null) { ItemIndex val = pickupDef.itemIndex; if ((int)ContagiousItemManager.GetTransformedItemIndex(val) == -1) { list2.Add(val); } } } list2.Remove(Items.ExtraStatsOnLevelUp.itemIndex); list2.Remove(Items.ExtraLife.itemIndex); list2.Remove(Items.FragileDamageBonus.itemIndex); list2.Remove(Items.HealingPotion.itemIndex); list2.Remove(Items.RegeneratingScrap.itemIndex); list2.Remove(Items.TeleportOnLowHealth.itemIndex); list2.Remove(Items.LowerPricedChests.itemIndex); list2.Remove(Items.LunarSun.itemIndex); list2.Remove(Items.BarrageOnBoss.itemIndex); list2.Remove(Items.OnLevelUpFreeUnlock.itemIndex); list2.Remove(Items.ItemDropChanceOnKill.itemIndex); list2.Remove(Items.RoboBallBuddy.itemIndex); list2.Remove(Items.BeetleGland.itemIndex); list2.Remove(Items.Clover.itemIndex); List<ItemIndex> source = list2.OrderBy((ItemIndex x) => Random.Range(0f, 1f)).ToList(); itemIndex = source.First(); } private void OnDisable() { inventories.ForEach(delegate(TemporaryInventory i) { Object.Destroy((Object)(object)i); }); } } private AsyncOperationHandle<GameObject> LowerPricedChestsGlow; private List<ItemZoneComponent> ItemZones = new List<ItemZoneComponent>(); public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { Run instance = Run.instance; InfiniteTowerRun val = (InfiniteTowerRun)(object)((instance is InfiniteTowerRun) ? instance : null); if (val != null) { return (Object)(object)val.safeWardController != (Object)null; } return false; } public override string GetEventConfigName() { return "ItemZone"; } public override string GetAnnouncement() { return Language.GetStringFormatted("ANNOUNCE_EVENT_ITEM_ZONE", Array.Empty<object>()); } public override string GetDescription() { return "Spawns item zones which grant players standing in them temporary items."; } public override string GetConditionDescription() { return "Simulacrum mode only"; } protected override void AddConfig(ConfigFile config) { } public override void Preload() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) LowerPricedChestsGlow = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Items/LowerPricedChests/LowerPricedChestsGlow.prefab"); } public override void Hook() { } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) ItemZones.Clear(); Run instance = Run.instance; InfiniteTowerRun val = (InfiniteTowerRun)(object)((instance is InfiniteTowerRun) ? instance : null); if (val == null) { return; } InfiniteTowerSafeWardController safeWardController = val.safeWardController; if ((Object)(object)safeWardController != (Object)null) { float baseRadius = safeWardController.holdoutZoneController.baseRadius; int amount = 4; Helper.ApproximatePlacement(LowerPricedChestsGlow.WaitForCompletion(), ((Component)safeWardController).gameObject.transform.position, 0f, baseRadius, amount, (GraphType)0, (HullClassification)0, occupyPosition: true, (NodeFlags)0, (NodeFlags)4).ForEach(delegate(GameObject obj) { ItemZones.Add(obj.AddComponent<ItemZoneComponent>()); }); } } public override void Stop() { ItemZones.ForEach(delegate(ItemZoneComponent zone) { Object.Destroy((Object)(object)((Component)zone).gameObject); }); ItemZones.Clear(); } } public class EventMonsterTransform : AbstractEvent { public class MonsterTransformComponent : MonoBehaviour { private TemporaryInventory temporaryInventory; private CharacterBody monster; private void FixedUpdate() { Check(); } private void Check() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Invalid comparison between Unknown and I4 //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_0160: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)monster == (Object)null) { return; } CharacterMaster component = ((Component)this).GetComponent<CharacterMaster>(); component.bodyPrefab = ((Component)monster).gameObject; CharacterBody body = component.GetBody(); if ((Object)(object)body == (Object)null || (Object)(object)component.playerCharacterMasterController == (Object)null) { return; } GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(component.playerCharacterMasterController.networkUser.bodyIndexPreference); if ((Object)(object)bodyPrefab == (Object)null || (Object)(object)bodyPrefab.GetComponent<CharacterBody>() == (Object)null || !((Object)(object)TemporaryInventory.Find(((Component)body).gameObject, temporaryInventory) == (Object)null)) { return; } if ((Object)(object)temporaryInventory != (Object)null) { Object.Destroy((Object)(object)temporaryInventory); temporaryInventory = null; } TeamManager.instance.GetTeamLevel(component.teamIndex); temporaryInventory = ((Component)body).gameObject.AddComponent<TemporaryInventory>(); Dictionary<PickupIndex, int> dictionary = new Dictionary<PickupIndex, int>(); ItemStringParser.ParseItemString(GetBodyBonusItemAllList(), dictionary, Log._logSource, false, -1); ItemStringParser.ParseItemString(GetBodyBonusItemList(body.bodyIndex), dictionary, Log._logSource, false, -1); foreach (KeyValuePair<PickupIndex, int> item in dictionary) { ItemIndex itemIndex = PickupCatalog.GetPickupDef(item.Key).itemIndex; int value = item.Value; if ((int)itemIndex == -1 || value <= 0) { continue; } ItemIndex itemIndex2 = Items.LunarPrimaryReplacement.itemIndex; if (itemIndex == itemIndex2 && body.inventory.GetItemCountPermanent(itemIndex2) > 0) { continue; } itemIndex2 = Items.LunarSecondaryReplacement.itemIndex; if (itemIndex == itemIndex2 && body.inventory.GetItemCountPermanent(itemIndex2) > 0) { continue; } itemIndex2 = Items.LunarUtilityReplacement.itemIndex; if (itemIndex != itemIndex2 || body.inventory.GetItemCountPermanent(itemIndex2) <= 0) { itemIndex2 = Items.LunarSpecialReplacement.itemIndex; if (itemIndex != itemIndex2 || body.inventory.GetItemCountPermanent(itemIndex2) <= 0) { temporaryInventory.GiveTemporaryItem(itemIndex, value); PurchaseInteraction.CreateItemTakenOrb(body.transform.position, ((Component)body).gameObject, itemIndex); } } } } public void SetMonster(CharacterBody monster) { this.monster = monster; Check(); } private void OnDisable() { CharacterMaster component = ((Component)this).GetComponent<CharacterMaster>(); if ((Object)(object)component.playerCharacterMasterController != (Object)null) { component.playerCharacterMasterController.SetBodyPrefabToPreference(); } if ((Object)(object)temporaryInventory != (Object)null) { Object.Destroy((Object)(object)temporaryInventory); } } } private static ConfigEntry<bool> CustomBodyListEnabled; private static ConfigEntry<string> CustomBodyList; private static ConfigEntry<bool> CustomBodyBonusItemsListsEnabled; private static ConfigEntry<string> CustomBodyBonusItemsAll; private static Dictionary<BodyIndex, ConfigEntry<string>> CustomBodyBonusItems = new Dictionary<BodyIndex, ConfigEntry<string>>(); private static ConfigEntry<bool> AllowFlyingMonsters; public List<CharacterBody> validBodyPrefabs = new List<CharacterBody>(); private static Dictionary<string, string> BodyBonusItemsDict = new Dictionary<string, string> { { "All", "" }, { "ClayBossBody", " 5xHoof & 5xAlienHead & 20xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & SiphonOnLowHealth" }, { "GravekeeperBody", " 5xHoof & 5xAlienHead & 40xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & SprintWisp" }, { "ImpBossBody", " 5xHoof & 5xAlienHead & 10xBoostDamage & 10xBoostAttackSpeed & 10xKnurl" }, { "MegaConstructBody", " 0xHoof & 5xAlienHead & 10xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & 10xBehemoth & MinorConstructOnKill" }, { "RoboBallBossBody", " 5xHoof & 5xAlienHead & 30xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & RoboBallBuddy" }, { "TitanBody", "10xHoof & 5xAlienHead & 90xBoostDamage & 10xBoostAttackSpeed & 20xKnurl" }, { "VagrantBody", "10xHoof & 2xAlienHead & 20xBoostDamage & 10xBoostAttackSpeed & 10xKnurl" }, { "VoidMegaCrabBody", " 5xHoof & 2xAlienHead & 10xBoostDamage & 10xBoostAttackSpeed & 10xKnurl" }, { "BeetleGuardBody", " 0xHoof & 5xAlienHead & 10xBoostDamage & 20xBoostAttackSpeed & 10xKnurl & SprintWisp & 3xFeather & 10xNearbyDamageBonus" }, { "BellBody", "10xHoof & 5xAlienHead & 40xBoostDamage & 20xBoostAttackSpeed & 10xKnurl" }, { "BisonBody", "10xHoof & 5xAlienHead & 10xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & SprintWisp & 15xSprintBonus & 10xBoostHp & 100xNearbyDamageBonus" }, { "ClayBruiserBody", " 5xHoof & 5xAlienHead & 10xBoostDamage & 10xBoostAttackSpeed & 10xKnurl" }, { "ClayGrenadierBody", " 5xHoof & 10xAlienHead & 10xBoostDamage & 20xBoostAttackSpeed & 10xKnurl" }, { "GolemBody", " 5xHoof & 10xAlienHead & 60xBoostDamage & 20xBoostAttackSpeed & 20xKnurl & 10xNearbyDamageBonus" }, { "GreaterWispBody", " 0xHoof & 5xAlienHead & 60xBoostDamage & 30xBoostAttackSpeed & 10xKnurl" }, { "GupBody", " 5xHoof & 5xAlienHead & 20xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & 10xNearbyDamageBonus & 4xFeather & FallBoots & DrizzlePlayerHelper" }, { "LemurianBruiserBody", " 5xHoof & 3xAlienHead & 10xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & 3xBehemoth" }, { "LunarGolemBody", " 0xHoof & 5xAlienHead & 10xBoostDamage & 30xBoostAttackSpeed & 10xKnurl & 2xBehemoth" }, { "LunarWispBody", " 0xHoof & 10xAlienHead & 60xBoostDamage & 20xBoostAttackSpeed & 10xKnurl & 10xBehemoth" }, { "NullifierBody", " 0xHoof & 5xAlienHead & 20xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & SprintWisp & ShockNearby" }, { "ParentBody", " 5xHoof & 5xAlienHead & 10xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & 20xNearbyDamageBonus & SprintWisp" }, { "VoidJailerBody", " 5xHoof & 5xAlienHead & 10xBoostDamage & 10xBoostAttackSpeed & 10xKnurl" }, { "HalcyoniteBody", " 5xHoof & 0xAlienHead & 40xBoostDamage & 10xBoostAttackSpeed & 20xKnurl" }, { "DefectiveUnitBody", " 3xHoof & 3xAlienHead & 20xBoostDamage & 20xBoostAttackSpeed & 10xKnurl & 4xBehemoth & LunarSecondaryReplacement" }, { "BeetleBody", "10xHoof & 5xAlienHead & 20xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & 50xNearbyDamageBonus & SprintWisp & 5xFeather & LunarSecondaryReplacement" }, { "FlyingVerminBody", "10xHoof & 5xAlienHead & 50xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & 10xBounceNearby" }, { "ImpBody", " 5xHoof & 5xAlienHead & 10xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & 10xNearbyDamageBonus & SprintWisp" }, { "JellyfishBody", "10xHoof & 0xAlienHead & 0xBoostDamage & 0xBoostAttackSpeed & 0xKnurl & 100xNearbyDamageBonus" }, { "LemurianBody", " 5xHoof & 5xAlienHead & 60xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & Feather & Behemoth & LunarSecondaryReplacement" }, { "WispBody", " 5xHoof & 10xAlienHead & 110xBoostDamage & 20xBoostAttackSpeed & 10xKnurl & 25xHoof & 3xBehemoth" }, { "LunarExploderBody", " 5xHoof & 10xAlienHead & 60xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & 5xChainLightning & Feather" }, { "MiniMushroomBody", " 5xHoof & 10xAlienHead & 30xBoostDamage & 40xBoostAttackSpeed & 10xKnurl & 10xMushroom & 3xFeather & SprintWisp & FireballsOnHit" }, { "RoboBallMiniBody", "15xHoof & 5xAlienHead & 60xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & 5xChainLightning & 4xBehemoth" }, { "VerminBody", " 5xHoof & 5xAlienHead & 10xBoostDamage & 10xBoostAttackSpeed & 10xKnurl & 30xNearbyDamageBonus & SprintWisp & 50xSeed" }, { "VultureBody", " 5xHoof & 5xAlienHead & 60xBoostDamage & 30xBoostAttackSpeed & 10xKnurl & LightningStrikeOnHit & ChainLightning" }, { "ChildBody", " 5xHoof & 5xAlienHead & 80xBoostDamage & 0xBoostAttackSpeed & 10xKnurl & PrimarySkillShuriken & 5xBehemoth & FireballsOnHit & Feather" }, { "TankerBody", " 5xHoof & 10xAlienHead & 10xBoostDamage & 10xBoostAttackSpeed & 10xKnurl" }, { "ITBrotherBody", " 0xHoof & 5xAlienHead & 10xBoostDamage & 0xBoostAttackSpeed & 10xKnurl" }, { "VultureHunterBody", " 0xHoof & 0xAlienHead & 10xBoostDamage & 0xBoostAttackSpeed & 10xKnurl" } }; public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { Run instance = Run.instance; InfiniteTowerRun val = (InfiniteTowerRun)(object)((instance is InfiniteTowerRun) ? instance : null); if (val != null && (val.waveIndex + 1) % 5 == 0) { return false; } return !activeOtherEvents.Any((AbstractEvent e) => e.GetEventConfigName().Equals("SkillsOnly", StringComparison.InvariantCultureIgnoreCase)); } public override string GetEventConfigName() { return "MonsterTransform"; } public override string GetAnnouncement() { return Language.GetString("ANNOUNCE_EVENT_MONSTER_TRANSFORM"); } public override string GetDescription() { return "Players transform into monsters."; } public override string GetConditionDescription() { return "Event \"SkillsOnly\" inactive and currently not a boss wave."; } private static List<string> CalculateDefaultBodyList() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); Category[] categories = Addressables.LoadAssetAsync<DirectorCardCategorySelection>((object)"RoR2/Base/MixEnemy/dccsMixEnemy.asset").WaitForCompletion().categories; CharacterMaster val = default(CharacterMaster); CharacterBody val2 = default(CharacterBody); for (int i = 0; i < categories.Length; i++) { DirectorCard[] cards = categories[i].cards; for (int j = 0; j < cards.Length; j++) { if (cards[j].spawnCard.prefab.TryGetComponent<CharacterMaster>(ref val) && (Object)(object)val.bodyPrefab.GetComponent<WormBodyPositionsDriver>() == (Object)null && val.bodyPrefab.TryGetComponent<CharacterBody>(ref val2) && val2.baseMoveSpeed > 0f && val2.baseDamage > 0f && val2.baseMaxHealth > 0f && val2.baseAttackSpeed > 0f) { list.Add(((Object)val.bodyPrefab).name); } } } list.Remove("AcidLarvaBody"); list.Remove("BeetleQueen2Body"); list.Remove("ScavBody"); list.Remove("ScorchlingBody"); list.Remove("ExtractorUnitBody"); list.Remove("IronHaulerBody"); list.Remove("SolusAmalgamatorBody"); list.Remove("WorkerUnitBody"); list.AddRange(new <>z__ReadOnlyArray<string>(new string[2] { "ITBrotherBody", "VultureHunterBody" })); return list; } private int TitanicKnurls(int level, CharacterBody preferredCharacterBody, CharacterBody transformedBody) { float num = preferredCharacterBody.baseMoveSpeed + preferredCharacterBody.levelMoveSpeed * (float)(level - 1); float num2 = transformedBody.baseMoveSpeed + transformedBody.levelMoveSpeed * (float)(level - 1); float num3 = 0.14f; if (num2 < num) { return (int)Math.Ceiling((num - num2) / num3); } return 0; } private static string GetBodyList() { if (CustomBodyListEnabled.Value) { return CustomBodyList.Value; } return string.Join(", ", CalculateDefaultBodyList()); } private static string GetBodyBonusItemAllList() { if (CustomBodyBonusItemsListsEnabled.Value) { return CustomBodyBonusItemsAll.Value; } return BodyBonusItemsDict["All"]; } private static string GetBodyBonusItemList(BodyIndex bodyIndex) { //IL_002a: 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_001e: Unknown result type (might be due to invalid IL or missing references) if (CustomBodyBonusItemsListsEnabled.Value) { if (CustomBodyBonusItems.ContainsKey(bodyIndex)) { return CustomBodyBonusItems[bodyIndex].Value; } } else { GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(bodyIndex); if ((Object)(object)bodyPrefab != (Object)null) { return BodyBonusItemsDict.GetValueOrDefault(((Object)bodyPrefab).name); } } return ""; } protected override void AddConfig(ConfigFile config) { //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_011e: Invalid comparison between Unknown and I4 //IL_0172: Unknown result type (might be due to invalid IL or missing references) CustomBodyListEnabled = config.Bind<bool>(GetEventConfigName(), "CustomBodyListEnabled", false, "Whether to use the custom body list or to use the default one."); CustomBodyList = config.Bind<string>(GetEventConfigName(), "CustomBodyList", string.Join(", ", CalculateDefaultBodyList()), "Comma-separated list of allowed body transforms (see README.md)"); AllowFlyingMonsters = config.Bind<bool>(GetEventConfigName(), "AllowFlyingMonsters", true, "Whether to allow players to transform into flying monsters."); CustomBodyListEnabled.SettingChanged += RecalculateValidBodyList; CustomBodyList.SettingChanged += RecalculateValidBodyList; AllowFlyingMonsters.SettingChanged += RecalculateValidBodyList; CustomBodyBonusItemsListsEnabled = config.Bind<bool>(GetEventConfigName(), "CustomBodyBonusItemsListsEnabled", false, "Whether to use the custom body bonus item lists or to use the default ones."); CustomBodyBonusItemsAll = config.Bind<string>(GetEventConfigName(), "CustomBodyBonusItems_All", BodyBonusItemsDict["All"], "Items gained temporarily when transformed into any monster. Comma-separated list in the format keyword=amount for rewarding multiple of the item, or just the keyword for single reward. Must be internal item names (see https://risk-of-thunder.github.io/R2Wiki/Mod-Creation/Developer-Reference/Items-and-Equipments-Data/)"); string[] array = CustomBodyList.Value.Split(","); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (!Utility.IsNullOrWhiteSpace(text)) { BodyIndex val = BodyCatalog.FindBodyIndex(text); if ((int)val == -1) { Log.LogError("Could not find body: " + text); } string value = null; if (BodyBonusItemsDict.TryGetValue(text, out value)) { ConfigEntry<string> value2 = config.Bind<string>(GetEventConfigName(), "CustomBodyBonusItems_" + text, value, "Items gained temporarily when transformed into " + text + ". Comma-separated list like above."); CustomBodyBonusItems.Add(val, value2); } } } } private void RecalculateValidBodyList(object sender = null, EventArgs e = null) { validBodyPrefabs.Clear(); string[] array = GetBodyList().Split(","); for (int i = 0; i < array.Length; i++) { GameObject val = BodyCatalog.FindBodyPrefab(array[i].Trim()); if ((Object)(object)val != (Object)null) { CharacterBody component = val.GetComponent<CharacterBody>(); if (AllowFlyingMonsters.Value || !component.isFlying) { validBodyPrefabs.Add(component); } } } } public override void Preload() { RecalculateValidBodyList(); } public override void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown JellyNova.Detonate += new hook_Detonate(JellyNova_Detonate); EnigmaArtifactManager.OnPlayerCharacterBodyStartServer += new hook_OnPlayerCharacterBodyStartServer(EnigmaArtifactManager_OnPlayerCharacterBodyStartServer); } private void JellyNova_Detonate(orig_Detonate orig, JellyNova self) { if ((Object)(object)((EntityState)self).characterBody != (Object)null && (Object)(object)((EntityState)self).characterBody.master != (Object)null && (Object)(object)((EntityState)self).characterBody.master.playerCharacterMasterController != (Object)null && ((EntityState)self).characterBody.master.playerCharacterMasterController.isConnected && IsActive()) { ((EntityState)self).characterBody.AddBuff(Buffs.ExtraLifeBuff); } orig.Invoke(self); } private void EnigmaArtifactManager_OnPlayerCharacterBodyStartServer(orig_OnPlayerCharacterBodyStartServer orig, CharacterBody characterBody) { if (!IsActive()) { orig.Invoke(characterBody); } } public CharacterBody GetRandomMonster() { return validBodyPrefabs[Random.RandomRangeInt(0, validBodyPrefabs.Count)]; } public void TransformIntoRandomMonster(PlayerCharacterMasterController pc) { TransformInto(pc, GetRandomMonster()); } public void TransformInto(PlayerCharacterMasterController pc, CharacterBody target) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) UnityObjectExtensions.EnsureComponent<MonsterTransformComponent>(((Component)pc.master).gameObject).SetMonster(target); CharacterBody body = pc.master.GetBody(); if ((Object)(object)body != (Object)null) { pc.master.Respawn(body.transform.position, body.transform.rotation, false); } } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.isConnected) { TransformIntoRandomMonster(instance); } } } public override void Stop() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) MonsterTransformComponent monsterTransformComponent = default(MonsterTransformComponent); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if ((Object)(object)instance.master != (Object)null && ((Component)instance.master).TryGetComponent<MonsterTransformComponent>(ref monsterTransformComponent)) { Object.Destroy((Object)(object)monsterTransformComponent); CharacterBody body = instance.master.GetBody(); if ((Object)(object)body != (Object)null) { instance.master.Respawn(body.transform.position, body.transform.rotation, false); } } } } } public class EventRandomArtifact : AbstractEvent { private List<ArtifactDef> artifacts = new List<ArtifactDef>(); public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) List<ArtifactDef> enabledArtifacts = ((IEnumerable<ArtifactDef>)(object)RunArtifactManager.enabledArtifactsEnumerable).ToList(); bool flag = false; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.isConnected) { CharacterMaster master = instance.master; if (master != null && master.inventory.GetItemCount(Items.AutoCastEquipment) > 0) { flag = true; break; } } } List<ArtifactDef> list = new List<ArtifactDef>(ArtifactCatalog.artifactDefs); bool flag2 = activeOtherEvents.Any((AbstractEvent e) => e.GetEventConfigName().Equals("EquipmentOnly", StringComparison.InvariantCultureIgnoreCase)); if (flag || flag2) { list.Remove(Artifacts.Enigma); } list.Remove(Artifacts.TeamDeath); list.Remove(Artifacts.ShadowClone); list.Remove(Artifacts.Sacrifice); list.Remove(Artifacts.RandomSurvivorOnRespawn); list.Remove(Artifacts.MonsterTeamGainsItems); list.Remove(Artifacts.Rebirth); list.Remove(Artifacts.Devotion); list.Remove(Artifacts.Delusion); list.Remove(Artifacts.Prestige); return list.Where((ArtifactDef def) => !enabledArtifacts.Any((ArtifactDef enabled) => enabled.artifactIndex == def.artifactIndex)).ToList().Count > 0; } public override string GetEventConfigName() { return "RandomArtifact"; } public override string GetAnnouncement() { if (artifacts.Count == 1) { return Language.GetStringFormatted("ANNOUNCE_EVENT_RANDOM_ARTIFACT", new object[1] { Language.GetString(artifacts[0].nameToken) }); } if (artifacts.Count == 2) { return Language.GetStringFormatted("ANNOUNCE_EVENT_RANDOM_DOUBLE_ARTIFACT", new object[2] { Language.GetString(artifacts[0].nameToken), Language.GetString(artifacts[1].nameToken) }); } if (artifacts.Count == 3) { return Language.GetStringFormatted("ANNOUNCE_EVENT_RANDOM_TRIPLE_ARTIFACT", new object[3] { Language.GetString(artifacts[0].nameToken), Language.GetString(artifacts[1].nameToken), Language.GetString(artifacts[2].nameToken) }); } return null; } public override string GetDescription() { return "Activates up to three random artifacts temporarily. The follwing artifacts are blacklisted: Death, Delusion, Devotion, Evolution, Metamorphosis, Rebirth, Sacrifice, Vengeance."; } public override string GetConditionDescription() { return "There is at least one artifact which can be enabled and is not blacklisted."; } protected override void AddConfig(ConfigFile config) { } public override void Preload() { } public override void Hook() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown InfiniteTowerRun.AdvanceWave += new hook_AdvanceWave(InfiniteTowerRun_AdvanceWave); } private void InfiniteTowerRun_AdvanceWave(orig_AdvanceWave orig, InfiniteTowerRun self) { orig.Invoke(self); } public override void Prepare() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) List<ArtifactDef> enabledArtifacts = ((IEnumerable<ArtifactDef>)(object)RunArtifactManager.enabledArtifactsEnumerable).ToList(); bool flag = false; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.isConnected) { CharacterMaster master = instance.master; if (master != null && master.inventory.GetItemCount(Items.AutoCastEquipment) > 0) { flag = true; break; } } } List<ArtifactDef> list = new List<ArtifactDef>(ArtifactCatalog.artifactDefs); if (flag) { list.Remove(Artifacts.Enigma); } list.Remove(Artifacts.TeamDeath); list.Remove(Artifacts.ShadowClone); list.Remove(Artifacts.Sacrifice); list.Remove(Artifacts.RandomSurvivorOnRespawn); list.Remove(Artifacts.MonsterTeamGainsItems); list.Remove(Artifacts.Rebirth); list.Remove(Artifacts.Devotion); list.Remove(Artifacts.Delusion); List<ArtifactDef> source = (from x in list.Where((ArtifactDef def) => !enabledArtifacts.Any((ArtifactDef enabled) => enabled.artifactIndex == def.artifactIndex)).ToList() orderby Random.Range(0f, 1f) select x).ToList(); artifacts = source.Take(Random.RandomRangeInt(1, 4)).ToList(); } public override void Start(List<AbstractEvent> activeOtherEvents) { artifacts.ForEach(delegate(ArtifactDef artifact) { RunArtifactManager.instance.SetArtifactEnabled(artifact, true); }); } public override void Stop() { artifacts.ForEach(delegate(ArtifactDef artifact) { RunArtifactManager.instance.SetArtifactEnabled(artifact, false); }); artifacts.Clear(); } } public class EventRandomTeams : AbstractEvent { private Dictionary<GameObject, TeamIndex> originalTeam = new Dictionary<GameObject, TeamIndex>(); public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { return true; } public override string GetEventConfigName() { return "RandomTeams"; } public override string GetAnnouncement() { return Language.GetString("ANNOUNCE_EVENT_RANDOM_TEAMS"); } public override string GetDescription() { return "Makes some enemies fight each other as well as the players."; } public override string GetConditionDescription() { return ""; } protected override void AddConfig(ConfigFile config) { } public override void Preload() { } public override void Hook() { CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_0055: 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) if (ModConfig.Enabled.Value && NetworkServer.active && IsActive() && (int)body.teamComponent.teamIndex != 1) { List<TeamIndex> list = new List<TeamIndex>(); list.Add((TeamIndex)4); list.Add((TeamIndex)2); originalTeam.Add(((Component)body).gameObject, body.teamComponent.teamIndex); body.teamComponent.teamIndex = list.OrderBy((TeamIndex x) => Random.Range(0f, 1f)).ToList().First(); } } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Invalid comparison between Unknown and I4 //IL_009c: 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) originalTeam.Clear(); Run instance = Run.instance; InfiniteTowerRun val = (InfiniteTowerRun)(object)((instance is InfiniteTowerRun) ? instance : null); if (val != null) { InfiniteTowerWaveController waveController = val.waveController; waveController.totalWaveCredits *= 1.5f; InfiniteTowerWaveController waveController2 = val.waveController; waveController2.creditsPerSecond *= 1.5f; } foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && (int)instances.teamComponent.teamIndex != 1) { List<TeamIndex> list = new List<TeamIndex>(); list.Add((TeamIndex)4); list.Add((TeamIndex)2); originalTeam.Add(((Component)instances).gameObject, instances.teamComponent.teamIndex); instances.teamComponent.teamIndex = list.OrderBy((TeamIndex x) => Random.Range(0f, 1f)).ToList().First(); } } } public override void Stop() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && originalTeam.ContainsKey(((Component)instances).gameObject)) { instances.teamComponent.teamIndex = originalTeam[((Component)instances).gameObject]; } } } } public class EventSkillsOnly : AbstractEvent { public class SkillsOnlyComponent : MonoBehaviour { [CompilerGenerated] private sealed class <DelayGivePrimaryReplacement>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SkillsOnlyComponent <>4__this; public CharacterBody body; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayGivePrimaryReplacement>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; SkillsOnlyComponent skillsOnlyComponent = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: <>1__state = -1; skillsOnlyComponent.inventory.GiveTemporaryItem(Items.LunarPrimaryReplacement.itemIndex, 9000); PurchaseInteraction.CreateItemTakenOrb(body.transform.position, ((Component)body).gameObject, Items.LunarPrimaryReplacement.itemIndex); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private TemporaryInventory inventory; private TemporaryEquipment equipment; private int timer; private void OnEnable() { //IL_004e: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) CharacterBody component = ((Component)this).GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null && (Object)(object)component.inventory != (Object)null) { if ((Object)(object)inventory == (Object)null) { inventory = ((Component)this).gameObject.AddComponent<TemporaryInventory>(); } inventory.GiveTemporaryItem(Items.SecondarySkillMagazine.itemIndex, 3); PurchaseInteraction.CreateItemTakenOrb(component.transform.position, ((Component)component).gameObject, Items.SecondarySkillMagazine.itemIndex); inventory.GiveTemporaryItem(Items.UtilitySkillMagazine.itemIndex); PurchaseInteraction.CreateItemTakenOrb(component.transform.position, ((Component)component).gameObject, Items.UtilitySkillMagazine.itemIndex); inventory.GiveTemporaryItem(Items.AlienHead.itemIndex, 10); PurchaseInteraction.CreateItemTakenOrb(component.transform.position, ((Component)component).gameObject, Items.AlienHead.itemIndex); ((MonoBehaviour)RandomEvents.instance).StartCoroutine(DelayGivePrimaryReplacement(component)); } } [IteratorStateMachine(typeof(<DelayGivePrimaryReplacement>d__4))] private IEnumerator DelayGivePrimaryReplacement(CharacterBody body) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayGivePrimaryReplacement>d__4(0) { <>4__this = this, body = body }; } public void SetupEquipment() { CharacterBody component = ((Component)this).GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null && (Object)(object)component.inventory != (Object)null && (Object)(object)equipment == (Object)null) { equipment = ((Component)this).gameObject.AddComponent<TemporaryEquipment>(); equipment.SetTemporaryEquipment((EquipmentIndex)(-1)); } } private void OnDisable() { Object.Destroy((Object)(object)inventory); if ((Object)(object)equipment != (Object)null) { Object.Destroy((Object)(object)equipment); } } private void FixedUpdate() { timer++; if (timer > 50) { CharacterBody component = ((Component)this).GetComponent<CharacterBody>(); if ((Object)(object)component != (Object)null && (Object)(object)component.skillLocator != (Object)null) { component.skillLocator.DeductCooldownFromAllSkillsServer(1f); } timer = 0; } } } public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { bool flag = activeOtherEvents.Any((AbstractEvent e) => e.GetEventConfigName().Equals("EquipmentOnly", StringComparison.InvariantCultureIgnoreCase) || e.GetEventConfigName().Equals("MonsterTransform", StringComparison.InvariantCultureIgnoreCase)); bool flag2 = false; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.isConnected) { CharacterMaster master = instance.master; if (master != null && master.inventory.GetItemCount(Items.Bandolier) >= 1) { flag2 = true; break; } } } if (!flag) { return !flag2; } return false; } public override string GetEventConfigName() { return "SkillsOnly"; } public override string GetAnnouncement() { return Language.GetStringFormatted("ANNOUNCE_EVENT_SKILLS_ONLY", Array.Empty<object>()); } public override string GetDescription() { return "Makes players unable to use primary skills but other skills have reduced cooldown."; } public override string GetConditionDescription() { return "Events \"EquipmentOnly\", \"MonsterTransform\" inactive and none of the players have a bandolier in their inventories (workaround to make it work server-side only)."; } protected override void AddConfig(ConfigFile config) { } public override void Preload() { } public override void Hook() { CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; } private void CharacterBody_onBodyStartGlobal(CharacterBody body) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 if (ModConfig.Enabled.Value && NetworkServer.active && IsActive() && (int)body.teamComponent.teamIndex == 1 && body.isPlayerControlled) { UnityObjectExtensions.EnsureComponent<SkillsOnlyComponent>(((Component)body).gameObject); } } public override void Prepare() { } public override void Start(List<AbstractEvent> activeOtherEvents) { foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1)) { if ((Object)(object)teamMember.body != (Object)null && teamMember.body.isPlayerControlled) { SkillsOnlyComponent skillsOnlyComponent = UnityObjectExtensions.EnsureComponent<SkillsOnlyComponent>(((Component)teamMember.body).gameObject); if (!activeOtherEvents.Any((AbstractEvent e) => e.GetEventConfigName().Equals("FuelArray", StringComparison.InvariantCultureIgnoreCase))) { skillsOnlyComponent.SetupEquipment(); } } } } public override void Stop() { SkillsOnlyComponent skillsOnlyComponent = default(SkillsOnlyComponent); foreach (CharacterBody instances in CharacterBody.instancesList) { if ((Object)(object)instances != (Object)null && ((Component)instances).TryGetComponent<SkillsOnlyComponent>(ref skillsOnlyComponent)) { Object.Destroy((Object)(object)skillsOnlyComponent); } } } } public class EventSmallArena : AbstractEvent { public override bool LoadCondition() { return true; } public override bool Condition(List<AbstractEvent> activeOtherEvents) { Run instance = Run.instance; InfiniteTowerRun val = (InfiniteTowerRun)(object)((instance is InfiniteTowerRun) ? instance : null); if (val != null) { return (Object)(object)val.safeWardController != (Object)null; } return false; } public override string GetEventConfigName() { return "SmallArena"; } public override string GetAnnouncement() { return Language.GetStringFormatted("ANNOUNCE_EVENT_SMALL_ARENA", Array.Empty<object>()); } public override string GetDescription() { return "Halves the battle zone radius but makes the wave also easier."; } public override string GetConditionDescription() { ret