Decompiled source of RogueRemix v1.2.20
RogueRemix.dll
Decompiled 7 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BTD_Mod_Helper; using BTD_Mod_Helper.Api; using BTD_Mod_Helper.Api.Components; using BTD_Mod_Helper.Api.Data; using BTD_Mod_Helper.Api.Helpers; using BTD_Mod_Helper.Api.Legends; using BTD_Mod_Helper.Api.ModOptions; using BTD_Mod_Helper.Extensions; using HarmonyLib; using Il2Cpp; using Il2CppAssets.Scripts.Data; using Il2CppAssets.Scripts.Data.Artifacts; using Il2CppAssets.Scripts.Data.Legends; using Il2CppAssets.Scripts.Models; using Il2CppAssets.Scripts.Models.Artifacts; using Il2CppAssets.Scripts.Models.Artifacts.Behaviors; using Il2CppAssets.Scripts.Models.Bloons; using Il2CppAssets.Scripts.Models.Bloons.Behaviors; using Il2CppAssets.Scripts.Models.Effects; using Il2CppAssets.Scripts.Models.Entities; using Il2CppAssets.Scripts.Models.Gameplay.Mods; using Il2CppAssets.Scripts.Models.GenericBehaviors; using Il2CppAssets.Scripts.Models.Profile; using Il2CppAssets.Scripts.Models.ServerEvents; using Il2CppAssets.Scripts.Models.SimulationBehaviors; using Il2CppAssets.Scripts.Models.TowerSets; using Il2CppAssets.Scripts.Models.Towers; using Il2CppAssets.Scripts.Models.Towers.Behaviors; using Il2CppAssets.Scripts.Models.Towers.Behaviors.Abilities.Behaviors; using Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack; using Il2CppAssets.Scripts.Models.Towers.Behaviors.Attack.Behaviors; using Il2CppAssets.Scripts.Models.Towers.Behaviors.Emissions; using Il2CppAssets.Scripts.Models.Towers.Behaviors.Emissions.Behaviors; using Il2CppAssets.Scripts.Models.Towers.Filters; using Il2CppAssets.Scripts.Models.Towers.Projectiles; using Il2CppAssets.Scripts.Models.Towers.Projectiles.Behaviors; using Il2CppAssets.Scripts.Models.Towers.TowerFilters; using Il2CppAssets.Scripts.Models.Towers.Upgrades; using Il2CppAssets.Scripts.Models.Towers.Weapons; using Il2CppAssets.Scripts.Models.Towers.Weapons.Behaviors; using Il2CppAssets.Scripts.Simulation; using Il2CppAssets.Scripts.Simulation.Artifacts; using Il2CppAssets.Scripts.Simulation.Artifacts.Behaviors; using Il2CppAssets.Scripts.Simulation.Objects; using Il2CppAssets.Scripts.Simulation.SMath; using Il2CppAssets.Scripts.Simulation.Towers; using Il2CppAssets.Scripts.Simulation.Towers.Behaviors; using Il2CppAssets.Scripts.Unity; using Il2CppAssets.Scripts.Unity.Analytics; using Il2CppAssets.Scripts.Unity.Bridge; using Il2CppAssets.Scripts.Unity.UI_New.GameOver; using Il2CppAssets.Scripts.Unity.UI_New.InGame; using Il2CppAssets.Scripts.Unity.UI_New.InGame.StoreMenu; using Il2CppAssets.Scripts.Unity.UI_New.Legends; using Il2CppAssets.Scripts.Unity.UI_New.Main.HeroSelect; using Il2CppAssets.Scripts.Unity.UI_New.Main.PowersSelect; using Il2CppAssets.Scripts.Unity.UI_New.Popups; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppNinjaKiwi.Common; using Il2CppNinjaKiwi.Common.ResourceUtils; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.IO; using Il2CppSystem.Linq; using Il2CppSystem.Reflection; using MelonLoader; using Microsoft.CodeAnalysis; using Newtonsoft.Json.Linq; using RogueRemix; using RogueRemix.NewArtifacts; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem.Utilities; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(RogueRemixMod), "Rogue Remix", "1.2.20", "doombubbles", null)] [assembly: MelonGame("Ninja Kiwi", "BloonsTD6")] [assembly: MelonGame("Ninja Kiwi", "BloonsTD6-Epic")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("RogueRemix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+b0cccfb8ef693d2b70d9346adf347640a7bfa1ab")] [assembly: AssemblyProduct("RogueRemix")] [assembly: AssemblyTitle("RogueRemix")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object? IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object? value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object? value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object? value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object? value) { throw new NotSupportedException(); } void IList.Remove(object? value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [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 RogueRemix { public static class Animations { [HarmonyPatch(typeof(RogueMonkeyMovement), "UpdateMovement")] internal static class RogueMonkeyMovement_Update { [HarmonyPrefix] internal static void Prefix(RogueMonkeyMovement __instance) { __instance.movementSpeed = 1f / ModSettingDouble.op_Implicit((ModSettingDouble)(object)RogueRemixMod.RogueMapAnimationSpeed); } [HarmonyPostfix] internal static void Postfix(RogueMonkeyMovement __instance) { __instance.movementSpeed = 1f / ModSettingDouble.op_Implicit((ModSettingDouble)(object)RogueRemixMod.RogueMapAnimationSpeed); } } [HarmonyPatch(typeof(RogueMap), "Update")] internal static class RogueMap_Update { [HarmonyPostfix] internal static void Postfix(RogueMap __instance) { __instance.tileInteractDelay = 1f / ModSettingDouble.op_Implicit((ModSettingDouble)(object)RogueRemixMod.RogueMapAnimationSpeed); __instance.bossDeathAnimTime = 7f / ModSettingDouble.op_Implicit((ModSettingDouble)(object)RogueRemixMod.RogueMapAnimationSpeed); __instance.smallPopupTime = 2f / ModSettingDouble.op_Implicit((ModSettingDouble)(object)RogueRemixMod.RogueMapAnimationSpeed); } } [HarmonyPatch(typeof(RogueMapScreen), "Open")] internal static class RogueMapScreen_Open { [HarmonyPostfix] internal static void Postfix() { Time.timeScale = ModSettingDouble.op_Implicit((ModSettingDouble)(object)RogueRemixMod.RogueMapAnimationSpeed); } } [HarmonyPatch(typeof(RogueMapScreen), "Close")] internal static class RogueMapScreen_Close { [HarmonyPostfix] internal static void Postfix() { Time.timeScale = 1f; } } } public static class ArtifactSelling { [HarmonyPatch(typeof(DisplayArtifactsPanel), "PopulateArtifacts")] internal static class DisplayArtifactsPanel_PopulateArtifacts { [HarmonyPrefix] internal static void Prefix(DisplayArtifactsPanel __instance) { TransformExtensions.DestroyAllChildren(__instance.artifactsInventoryContainer.transform); __instance.activeArtifactIcons.Clear(); } } [HarmonyPatch(typeof(DisplayArtifactsPanel), "OpenShowInventory")] internal static class DisplayArtifactsPanel_OpenShowInventory { [HarmonyPostfix] internal static void Postfix(DisplayArtifactsPanel __instance) { int count = __instance.activeArtifactIcons.Count; RogueArtifactDisplayIcon val = Il2CppGenerics.FirstOrDefault<RogueArtifactDisplayIcon>(__instance.activeArtifactIcons, (Func<RogueArtifactDisplayIcon, bool>)((RogueArtifactDisplayIcon icon) => icon.artifactModel.baseId == "Token")); List<RogueArtifactDisplayIcon> val2 = Il2CppGenerics.Where<RogueArtifactDisplayIcon>(__instance.activeArtifactIcons, (Func<RogueArtifactDisplayIcon, bool>)((RogueArtifactDisplayIcon icon) => !icon.artifactModel.IsBoost)); List<RogueArtifactDisplayIcon> val3 = Il2CppGenerics.Where<RogueArtifactDisplayIcon>(__instance.activeArtifactIcons, (Func<RogueArtifactDisplayIcon, bool>)((RogueArtifactDisplayIcon icon) => icon.artifactModel.IsBoost)); if ((Object)(object)val != (Object)null && ((Behaviour)val).isActiveAndEnabled) { ((Component)val).transform.SetSiblingIndex(0); } Enumerator<RogueArtifactDisplayIcon> enumerator = val3.GetEnumerator(); while (enumerator.MoveNext()) { RogueArtifactDisplayIcon current = enumerator.Current; ((Component)current).transform.SetSiblingIndex(count - 1); } if ((Object)(object)val != (Object)null && ((Behaviour)val).isActiveAndEnabled) { ((Component)val).transform.SetSiblingIndex(val2.Count - 1); while (((Component)val).transform.GetSiblingIndex() % 8 > 0) { AddSpacer(__instance.artifactsInventoryContainer.transform, val2.Count - 1); } } } } [HarmonyPatch(typeof(DisplayArtifactsPanel), "DiscardClicked")] internal static class DisplayArtifactsPanel_DiscardClicked { [HarmonyPrefix] internal static bool Prefix(DisplayArtifactsPanel __instance) { if (!ModSettingBool.op_Implicit(RogueRemixMod.SellingReplacesDiscarding)) { return true; } PopupScreen.instance.ShowPopup((Placement)0, StringExt.Localize(SellArtifact), StringExt.Localize(SellArtifactDescription), ReturnCallback.op_Implicit((Action)__instance.DiscardArtifact), StringExt.Localize("OK"), (ReturnCallback)null, StringExt.Localize("Cancel"), (TransitionAnim)1, (BackGround)1, false, false); return false; } } [HarmonyPatch(typeof(DisplayArtifactsPanel), "DiscardArtifact")] internal static class DisplayArtifactsPanel_DiscardArtifact { [HarmonyPrefix] internal static bool Prefix(DisplayArtifactsPanel __instance) { if (!ModSettingBool.op_Implicit(RogueRemixMod.SellingReplacesDiscarding)) { return true; } if ((Object)(object)__instance.selectedIcon == (Object)null || !((Component)__instance.selectedIcon).gameObject.active) { return false; } ArtifactModelBase artifactModel = __instance.selectedIcon.artifactModel; if (artifactModel.baseId == "Token") { return true; } TokenChanges.RewardTokens(artifactModel.ArtifactPower); return true; } } [HarmonyPatch(typeof(DisplayArtifactsPanel), "OpenDelete")] internal static class DisplayArtifactsPanel_OpenDelete { [HarmonyPostfix] internal static void Postfix(DisplayArtifactsPanel __instance) { Enumerator<RogueArtifactDisplayIcon> enumerator = __instance.activeArtifactIcons.GetEnumerator(); while (enumerator.MoveNext()) { RogueArtifactDisplayIcon current = enumerator.Current; if (((Il2CppArrayBase<string>)(object)RogueData.ignoreCountArtifacts).Contains(current.artifactModel.ArtifactName)) { ((Component)current).gameObject.SetActive(false); } } } } private const int ArtifactsPerRow = 8; private static readonly string SellArtifact = ModContent.Localize<RogueRemixMod>("SellArtifact", "Sell Artifact"); private static readonly string SellArtifactDescription = ModContent.Localize<RogueRemixMod>("SellArtifactDescription", "This Artifact will be removed from your inventory, and you will gain its value in Tokens. Are you sure you want to sell it?"); public static int TokenCount(this RogueGameSaveData saveData) { return Il2CppGenerics.Where<ArtifactLoot>(saveData.artifactsInventory, (Func<ArtifactLoot, bool>)((ArtifactLoot loot) => loot.baseId == "Token")).Count; } private static void AddSpacer(Transform parent, int index) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Spacer", (Type[])(object)new Type[1] { Il2CppType.Of<RectTransform>() }); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).SetParent(parent); component.sizeDelta = ((Component)parent).GetComponent<GridLayoutGroup>().cellSize; ((Transform)component).SetSiblingIndex(index); } } public static class ArtifactUpgrading { [HarmonyPatch(typeof(RogueLegendsManager), "CheckIfArtifactOwned")] internal static class RogueLegendsManager_CheckIfArtifactOwned { [HarmonyPrefix] internal static void Prefix(ref int tier) { if (ModSettingBool.op_Implicit(RogueRemixMod.ArtifactUpgrading)) { tier++; if (tier > 2) { tier = 2; } } } } [HarmonyPatch(typeof(RogueGameSaveData), "AddArtifactToInventory")] internal static class RogueGameSaveData_AddArtifactToInventory { [HarmonyPrefix] internal static void Prefix(RogueGameSaveData __instance, ArtifactLoot artifact, ref bool allowStacking) { if (!ModSettingBool.op_Implicit(RogueRemixMod.ArtifactUpgrading)) { return; } ArtifactModelBase val = default(ArtifactModelBase); if (Il2CppGenerics.Any<ArtifactLoot>(__instance.artifactsInventory, (Func<ArtifactLoot, bool>)((ArtifactLoot loot) => loot.artifactName == artifact.artifactName)) && Il2CppSystemObjectExt.Is<ArtifactModelBase>((from data in Il2CppSystemDictionaryExt.Values<string, ArtifactDataBase>(GameData.Instance.artifactsData.artifactDatas) select ((Il2CppObjectBase)data.ArtifactModel()).Cast<ArtifactModelBase>()).FirstOrDefault((Func<ArtifactModelBase, bool>)((ArtifactModelBase m) => !m.IsBoost && m.baseId == artifact.baseId && m.tier == artifact.tier + 1)), ref val)) { __instance.RemoveArtifactFromInventory(artifact.artifactName); ArtifactLoot obj = artifact; int tier = obj.tier; obj.tier = tier + 1; artifact.artifactName = ((Model)val).name; } if (artifact.artifactName.Contains("BoostArtifact") || artifact.artifactName.StartsWith("Token")) { allowStacking = true; } else if (!allowStacking) { Enumerator<ArtifactLoot> enumerator = Il2CppGenerics.Where<ArtifactLoot>(__instance.artifactsInventory, (Func<ArtifactLoot, bool>)((ArtifactLoot loot) => loot.baseId == artifact.baseId)).GetEnumerator(); while (enumerator.MoveNext()) { ArtifactLoot current = enumerator.Current; TokenChanges.RewardTokens(current.ArtifactPower()); } } } } [HarmonyPatch(typeof(DisplayArtifactsPanel), "PopulateArtifacts")] internal static class DisplayArtifactsPanel_PopulateArtifacts { [HarmonyPrefix] internal static void Prefix(DisplayArtifactsPanel __instance) { PopulatingOwned = true; } [HarmonyPostfix] internal static void Postfix(DisplayArtifactsPanel __instance) { PopulatingOwned = false; } } [HarmonyPatch(typeof(RogueArtifactDisplayIcon), "Bind")] internal static class RogueArtifactDisplayIcon_Bind { [HarmonyPostfix] internal static void Postfix(RogueArtifactDisplayIcon __instance, ArtifactModelBase artifactModel, ArtifactSelected? onAddCallback, ArtifactSelected? onRemoveCallback) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown if (MerchantChanges.IsPopulatingShop) { HandleUpgradeIcon(__instance, artifactModel.ArtifactName); } RogueMerchantPanel panel = default(RogueMerchantPanel); if (!artifactModel.baseId.StartsWith("Token") || !Il2CppSystemObjectExt.Is<RogueMerchantPanel>(((Component)__instance).GetComponentInParent<RogueMerchantPanel>(), ref panel)) { return; } AudioClipReference sound = GameData.Instance.rogueData.rogueUIAudio.selectSound; if ((Delegate)(object)onAddCallback != (Delegate)null) { Button componentOrAdd = GameObjectExtensions.GetComponentOrAdd<Button>(__instance.stackCountObj); ((Selectable)componentOrAdd).targetGraphic = (Graphic)(object)__instance.stackCountObj.GetComponentInChildren<Image>(); ButtonExt.SetOnClick(componentOrAdd, (Function)delegate { int stackCount = __instance.StackCount; int totalPower = panel.GetTotalPower(panel.selectedInventoryArtifactIcons, false); int totalPower2 = panel.GetTotalPower(panel.selectedMerchantArtifactIcons, true); if (totalPower2 > totalPower && artifactModel.baseId == "Token") { for (int i = 0; i < Math.Min(totalPower2 - totalPower, stackCount); i++) { onAddCallback.Invoke(__instance); } } else { for (int j = 0; j < stackCount; j++) { onAddCallback.Invoke(__instance); } } Game.instance.audioFactory.PlaySound(sound, "LegendsArtifactSelectSounds", 1, 1f, 0f, false, (string)null, false, false, true, (AudioType)0); }); } if (!((Delegate)(object)onRemoveCallback != (Delegate)null)) { return; } Button componentOrAdd2 = GameObjectExtensions.GetComponentOrAdd<Button>(__instance.stackCountObj); ((Selectable)componentOrAdd2).targetGraphic = (Graphic)(object)__instance.stackCountObj.GetComponentInChildren<Image>(); ButtonExt.SetOnClick(componentOrAdd2, (Function)delegate { int stackCount = __instance.StackCount; int totalPower = panel.GetTotalPower(panel.selectedInventoryArtifactIcons, false); int totalPower2 = panel.GetTotalPower(panel.selectedMerchantArtifactIcons, true); if (totalPower > totalPower2 && artifactModel.baseId == "Token") { for (int i = 0; i < Math.Min(totalPower - totalPower2, stackCount); i++) { onRemoveCallback.Invoke(__instance); } } else { for (int j = 0; j < stackCount; j++) { onRemoveCallback.Invoke(__instance); } } Game.instance.audioFactory.PlaySound(sound, "LegendsArtifactSelectSounds", 1, 1f, 0f, false, (string)null, false, false, true, (AudioType)0); }); } } public static bool PopulatingOwned { get; private set; } public static void HandleUpgradeIcon(RogueArtifactDisplayIcon icon, string artifactName) { //IL_00be: 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_00e0: Unknown result type (might be due to invalid IL or missing references) if (!ModSettingBool.op_Implicit(RogueRemixMod.ArtifactUpgrading)) { return; } RogueLegendsManager instance = RogueLegendsManager.instance; if (((instance != null) ? instance.RogueSaveData : null) != null && !artifactName.Contains("BoostArtifact") && !artifactName.StartsWith("Token")) { ModHelperImage val = ((IEnumerable<ModHelperImage>)((Component)icon).GetComponentsInChildren<ModHelperImage>(true)).FirstOrDefault((Func<ModHelperImage, bool>)((ModHelperImage image) => ((Object)image).name == "Upgrade")); if ((Object)(object)val == (Object)null) { GameObject gameObject = ((Component)icon).gameObject; Info val2 = default(Info); ((Info)(ref val2))..ctor("Upgrade"); ((Info)(ref val2)).set_Size(110f); ((Info)(ref val2)).set_Pivot(new Vector2(0f, 1f)); ((Info)(ref val2)).set_Anchor(new Vector2(0f, 1f)); val = GameObjectExt.AddModHelperComponent<ModHelperImage>(gameObject, ModHelperImage.Create(val2, "IngameUi[UpgradeBtn]")); } ((ModHelperComponent)val).SetActive(!PopulatingOwned && artifactName != "Token" && Il2CppGenerics.Any<ArtifactLoot>(RogueLegendsManager.instance.RogueSaveData.artifactsInventory, (Func<ArtifactLoot, bool>)((ArtifactLoot loot) => loot.artifactName == artifactName))); } } } public static class BoostChanges { [HarmonyPatch(typeof(RogueArtifactPopup), "OpenShowInventory")] internal static class RogueArtifactPopup_OpenShowInventory { [HarmonyPostfix] internal static void Postfix(RogueArtifactPopup __instance) { if (!ModSettingBool.op_Implicit(RogueRemixMod.BoostsInShop)) { return; } ComponentExt.GetComponentFromChildrenByName<NK_TextMeshProUGUI>((Component)(object)((Component)__instance).transform, "TitleLeft").OverrideText("Boosts"); ComponentExt.GetComponentFromChildrenByName<NK_TextMeshProUGUI>((Component)(object)((Component)__instance).transform, "TitleRight").OverrideText("Artifacts"); foreach (RogueArtifactDisplayIcon item in __instance.activeArtifactIcons.ToArray()) { if (item.artifactModel.IsBoost) { ((Component)item).transform.SetParent(__instance.boostInventoryContainer.transform); } else if (item.artifactModel.baseId == "Token") { ((Component)item).gameObject.SetActive(false); __instance.activeArtifactIcons.Remove(item); } } } } [HarmonyPatch(typeof(SpreadBoostMutator), "Mutate")] internal static class SpreadBoostMutator_Mutate { [HarmonyPrefix] internal static void Prefix(Model model, ref Dictionary<ArcEmissionModel, float> __state) { __state = ((IEnumerable<ArcEmissionModel>)Enumerable.ToArray<ArcEmissionModel>(model.GetDescendants<ArcEmissionModel>())).Where((ArcEmissionModel emissionModel) => emissionModel.angle >= 180f).ToDictionary((ArcEmissionModel emissionModel) => emissionModel, (ArcEmissionModel emissionModel) => emissionModel.angle); } [HarmonyPostfix] internal static void Postfix(Model model, ref Dictionary<ArcEmissionModel, float> __state) { foreach (var (val2, angle) in __state) { val2.angle = angle; } } } [HarmonyPatch(typeof(OverrideCamoDetection), "FirstUpdate")] internal static class OverrideCamoDetection_FirstUpdate { [HarmonyPrefix] internal static void Prefix(OverrideCamoDetection __instance) { ((BehaviorMutator)__instance.mutator).isArtifactMutator = true; } } } public static class CampfireChanges { [HarmonyPatch(typeof(RogueMentorPanel), "InventoryIconClicked")] internal static class RogueMentorPanel_InventoryIconClicked { [HarmonyPostfix] internal static void Postfix(RogueMentorPanel __instance, InstaTowerDisplay instaTowerDisplay) { for (int i = 0; i < ((Il2CppArrayBase<InstaTowerDisplay>)(object)__instance.upgradeInstaDisplays).Count; i++) { InstaTowerDisplay val = ((Il2CppArrayBase<InstaTowerDisplay>)(object)__instance.upgradeInstaDisplays)[i]; if (!((Object)(object)val == (Object)null) && !((Component)val).gameObject.active && ((Il2CppArrayBase<int>)(object)instaTowerDisplay.tiers)[i] <= 0) { List<int> list = ((IEnumerable<int>)instaTowerDisplay.tiers).ToList(); int[] array = ((IEnumerable<int>)instaTowerDisplay.tiers).OrderByDescending((int result) => result).ToArray(); list[list.IndexOf(array[1])] = 0; list[i] = array[1]; ((Component)val).gameObject.SetActive(true); val.DisplayRogueInsta(instaTowerDisplay.towerBaseId, Il2CppStructArray<int>.op_Implicit(list.ToArray()), OnInstaButtonSelected.op_Implicit((Action<InstaTowerDisplay>)__instance.InstaUpgradeClicked)); } } } } [HarmonyPatch(typeof(RogueMentorPanel), "ConfirmClicked")] internal static class RogueMentorPanel_ConfirmClicked { [HarmonyPrefix] internal static void Prefix(RogueMentorPanel __instance, ref int __state) { if (!((Object)(object)__instance.selectedUpgrade == (Object)null)) { __state = Il2CppGenerics.FindIndex<RogueInstaMonkey>(__instance.RogueSaveData.instasInventory, (Func<RogueInstaMonkey, bool>)((RogueInstaMonkey monkey) => monkey.baseId == __instance.selectedInstaDisplay.towerBaseId && ((IEnumerable<int>)monkey.tiers).SequenceEqual((IEnumerable<int>)__instance.selectedInstaDisplay.tiers))); } } [HarmonyPostfix] internal static void Postfix(RogueMentorPanel __instance, ref int __state) { if (!((Object)(object)__instance.selectedUpgrade == (Object)null)) { List<RogueInstaMonkey> instasInventory = __instance.RogueSaveData.instasInventory; RogueInstaMonkey val = Il2CppGenerics.Last<RogueInstaMonkey>(instasInventory); instasInventory.Remove(val); instasInventory.Insert(__state, val); } } } } public static class Completionism { [HarmonyPatch(typeof(RogueLegendsManager), "IncreaseRogueStage")] internal static class RogueLegendsManager_IncreaseRogueStage { [HarmonyPostfix] internal static void Postfix(RogueLegendsManager __instance) { if (!ModSettingBool.op_Implicit(RogueRemixMod.TrackHeroLoadoutCompletions)) { return; } RogueGameSaveData rogueSaveData = __instance.RogueSaveData; RogueRemixStats[rogueSaveData.selectedHeroSkin + "Bronze"] = true; if (rogueSaveData.stage >= 2) { RogueRemixStats[rogueSaveData.selectedHeroSkin + "Silver"] = true; } if (rogueSaveData.stage >= 4) { RogueRemixStats[rogueSaveData.selectedHeroSkin + "Gold"] = true; if (rogueSaveData.isChimps) { RogueRemixStats[rogueSaveData.selectedHeroSkin + "Black"] = true; } } ((BloonsMod)ModContent.GetInstance<RogueRemixMod>()).SaveModSettings(); } } [HarmonyPatch(typeof(HeroUpgradeDetails), "DisplayRogueStarterKit")] internal static class HeroUpgradeDetails_DisplayRogueStarterKit { [HarmonyPostfix] internal static void Postfix(HeroUpgradeDetails __instance, string heroId) { //IL_0033: 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 (ModSettingBool.op_Implicit(RogueRemixMod.TrackHeroLoadoutCompletions)) { Image component = __instance.rogueLoadoutObj.GetComponent<Image>(); ((Graphic)component).color = new Color(1f, 1f, 1f); if (RogueRemixStats.GetValueOrDefault(heroId + "Black")) { ImageExt.SetSprite(component, "Ui[MainBgPanelHematite]"); return; } if (RogueRemixStats.GetValueOrDefault(heroId + "Gold")) { ImageExt.SetSprite(component, "Ui[MainBGPanelGold]"); return; } if (RogueRemixStats.GetValueOrDefault(heroId + "Silver")) { ImageExt.SetSprite(component, "Ui[MainBGPanelSilver]"); return; } if (RogueRemixStats.GetValueOrDefault(heroId + "Bronze")) { ImageExt.SetSprite(component, "Ui[MainBGPanelBronze]"); return; } ((Graphic)component).color = new Color(0.706f, 0.663f, 0.588f); ImageExt.SetSprite(component, "Ui[InsertPanelWhiteRound]"); } } } public static readonly Dictionary<string, bool> RogueRemixStats = new Dictionary<string, bool>(); } public static class Extensions { public static bool IsArtifact<T>(this RogueLoot loot) where T : ModArtifact { ArtifactLoot val = default(ArtifactLoot); return Il2CppSystemObjectExt.Is<ArtifactLoot>((Il2CppObjectBase)(object)loot, ref val) && val.baseId == ((ModContent)(object)ModContent.GetInstance<T>()).Id; } public static bool IsArtifact<T>(this ArtifactModelBase model) where T : ModArtifact { return model.baseId == ((ModContent)(object)ModContent.GetInstance<T>()).Id; } public static bool IsArtifact<T>(this ArtifactBase artifactBase) where T : ModArtifact { return artifactBase.artifactBaseModel.IsArtifact<T>(); } public static bool HasArtifact<T>(this RogueGameSaveData saveData, int tier = -1) where T : ModArtifact { return Il2CppGenerics.Any<ArtifactLoot>(saveData.artifactsInventory, (Func<ArtifactLoot, bool>)((ArtifactLoot loot) => loot.baseId == ((ModContent)(object)ModContent.GetInstance<T>()).Id && (tier == -1 || loot.tier == tier))); } public static int ArtifactPower(this ArtifactLoot loot) { return ((Il2CppObjectBase)GameData.Instance.artifactsData.GetArtifactData(loot.artifactName).ArtifactModel()).Cast<ArtifactModelBase>().ArtifactPower; } public static bool HasArtifact<T>(this RogueGameSaveData saveData, out int tier) where T : ModArtifact { ArtifactLoot val = Il2CppGenerics.FirstOrDefault<ArtifactLoot>(saveData.artifactsInventory, (Func<ArtifactLoot, bool>)((ArtifactLoot loot) => loot.baseId == ((ModContent)(object)ModContent.GetInstance<T>()).Id)); tier = ((val != null) ? val.tier : (-1)); return val != null; } public static void OverrideText(this NK_TextMeshProUGUI textMeshProUGUI, string text) { if (textMeshProUGUI.AutoLocalize) { textMeshProUGUI.localizeKey = text; textMeshProUGUI.UpdateText(StringExt.Localize(text)); } else { textMeshProUGUI.UpdateText(text); } } public static string ToOrdinal(this int number) { string text = number.ToString(); int num = number % 100; string text2; if (num >= 11 && num <= 13) { text2 = "th"; } else { int num2 = number % 10; if (1 == 0) { } string text3 = num2 switch { 1 => "st", 2 => "nd", 3 => "rd", _ => "th", }; if (1 == 0) { } text2 = text3; } return text + text2; } } public interface IArtifactSynergy { private static readonly Dictionary<string, object> Defaults = new Dictionary<string, object>(); void ModifyOtherArtifacts(List<ArtifactModelBase> artifacts, int tier); static T RestoreStore<T>(T currentOrDefault, string id) { if (Defaults.TryGetValue(id, out object value)) { return (T)value; } Defaults[id] = currentOrDefault; return currentOrDefault; } } public static class MerchantChanges { [HarmonyPatch(typeof(RogueMerchantPanel), "Open")] internal static class RogueMerchantPanel_Open { [HarmonyPrefix] internal static void Prefix(RogueMerchantPanel __instance, RogueTile merchantTile) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, string> tileMetaData = __instance.RogueSaveData.tileMetaData; currentRerolls = (int.TryParse(MiscHelpers.GetValueOrDefault<string, string>(tileMetaData, merchantTile.RerollsKey()), out var result) ? result : 0); if ((Object)(object)TransformExtensions.FindChildWithName(((Component)__instance.tradeBtn).transform.parent, "Reroll") == (Object)null) { Vector2Int coords = ((LegendsTile)merchantTile).coords; Vector2Int? lastTile = MerchantChanges.lastTile; if (lastTile.HasValue && coords == lastTile.GetValueOrDefault()) { ((LegendsTile)merchantTile).seed = ((LegendsTile)merchantTile).seed + currentRerolls; } } MerchantChanges.lastTile = ((LegendsTile)merchantTile).coords; Enumerator<RogueArtifactDisplayIcon> enumerator = __instance.selectedInventoryArtifactIcons.GetEnumerator(); while (enumerator.MoveNext()) { RogueArtifactDisplayIcon current = enumerator.Current; __instance.RemoveInventoryIconFromOffer(current); } Enumerator<RogueArtifactDisplayIcon> enumerator2 = __instance.selectedMerchantArtifactIcons.GetEnumerator(); while (enumerator2.MoveNext()) { RogueArtifactDisplayIcon current2 = enumerator2.Current; __instance.RemoveMerchantIconFromOffer(current2); } } [HarmonyPostfix] internal static void Postfix(RogueMerchantPanel __instance) { //IL_00c1: 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_00e2: 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_0132: Expected O, but got Unknown if ((Object)(object)TransformExtensions.FindChildWithName(((Component)__instance.tradeBtn).transform.parent, "Reroll") == (Object)null) { GameObject val = Object.Instantiate<GameObject>(((Component)__instance.tradeBtn).gameObject, ((Component)__instance.tradeBtn).transform.parent); ((Object)val).name = "Reroll"; GameObject val2 = Object.Instantiate<GameObject>(__instance.artifactDisplayPrefab, val.transform); ((Object)val2).name = "TokenDisplay"; val2.SetActive(true); GameObjectExt.RemoveComponent<Button>(val2); RectTransform component = val2.GetComponent<RectTransform>(); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(1f, 0.5f); component.anchorMax = val3; component.anchorMin = val3; ((Transform)component).localScale = new Vector3(0.75f, 0.75f, 0.75f); RogueArtifactDisplayIcon component2 = val2.GetComponent<RogueArtifactDisplayIcon>(); component2.Bind(GameData.Instance.artifactsData.GetBaseArtifactModel("Token"), (ArtifactSelected)null, false, (ArtifactSelected)null, (ArtifactSelected)null, false, 0); Button component3 = val.GetComponent<Button>(); ButtonExt.SetOnClick(component3, (Function)delegate { Reroll(__instance); }); ((Selectable)component3).interactable = true; ImageExt.SetSprite(val.GetComponent<Image>(), "Ui[BlueBtnLong]"); val.GetComponentInChildren<NK_TextMeshProUGUI>().OverrideText("Reroll"); __instance.RefreshUIs(); } } } [HarmonyPatch(typeof(RogueMerchantPanel), "RefreshUIs")] internal static class RogueMerchantPanel_RefreshUIs { [HarmonyPostfix] internal static void Postfix(RogueMerchantPanel __instance) { Button val = default(Button); if (Il2CppSystemObjectExt.Is<Button>(ComponentExt.GetComponentFromChildrenByName<Button>((Component)(object)__instance, "Reroll"), ref val)) { ((Selectable)val).interactable = __instance.RogueSaveData.TokenCount() >= RerollCost; RogueArtifactDisplayIcon val2 = default(RogueArtifactDisplayIcon); if (Il2CppSystemObjectExt.Is<RogueArtifactDisplayIcon>(ComponentExt.GetComponentFromChildrenByName<RogueArtifactDisplayIcon>((Component)(object)val, "TokenDisplay"), ref val2)) { val2.StackCount = RerollCost; } } bool flag = ((IEnumerable<RogueArtifactDisplayIcon>)__instance.artifactsMerchantOffersContainer.GetComponentsInChildren<RogueArtifactDisplayIcon>()).Any((RogueArtifactDisplayIcon icon) => icon.artifactModel.IsBoost); Enumerator<RogueArtifactDisplayIcon> enumerator = Il2CppGenerics.Where<RogueArtifactDisplayIcon>(__instance.activeMerchantIcons, (Func<RogueArtifactDisplayIcon, bool>)((RogueArtifactDisplayIcon icon) => icon.artifactModel.IsBoost)).GetEnumerator(); while (enumerator.MoveNext()) { RogueArtifactDisplayIcon current = enumerator.Current; current.ToggleAddButtonInteractable(!flag); } } } [HarmonyPatch(typeof(RogueMerchantPanel), "PopulateMerchantArtifacts")] internal static class RogueMerchantPanel_PopulateMerchantArtifacts { [HarmonyPrefix] internal static void Prefix(RogueMerchantPanel __instance) { IsPopulatingShop = true; ShouldAddBoosts = !__instance.RogueSaveData.tileMetaData.ContainsKey(__instance.merchantTile.BoostPurchaedKey()); } [HarmonyPostfix] internal static void Postfix(RogueMerchantPanel __instance) { IsPopulatingShop = false; ShouldAddBoosts = false; } } [HarmonyPatch(typeof(RogueMerchantPanel), "MakeTrade")] internal static class RogueMerchantPanel_MakeTrade { [HarmonyPrefix] internal static void Prefix(RogueMerchantPanel __instance) { Enumerator<RogueArtifactDisplayIcon> enumerator = __instance.selectedMerchantArtifactIcons.GetEnumerator(); while (enumerator.MoveNext()) { RogueArtifactDisplayIcon current = enumerator.Current; if (!((Component)current).gameObject.activeSelf || !current.artifactModel.IsBoost) { continue; } Dictionary<string, string> tileMetaData = __instance.RogueSaveData.tileMetaData; tileMetaData[__instance.merchantTile.BoostPurchaedKey()] = "true"; string[] array = Il2CppSystemDictionaryExt.Keys<string, string>(tileMetaData).ToArray(); foreach (string text in array) { if (text.StartsWith("MerchantInventoryItem") && tileMetaData[text].StartsWith("BoostArtifact")) { tileMetaData.Remove(text); } } break; } } } private static readonly string RerollConfirm = ModContent.Localize<RogueRemixMod>("RerollConfirm", "Are you sure you want to reroll? This will cancel the current trade offer."); public static Vector2Int? lastTile; public static int currentRerolls; public static bool IsPopulatingShop { get; private set; } public static bool ShouldAddBoosts { get; private set; } public static int RerollCost => (currentRerolls + 1) * 3; private static string RerollsKey(this RogueTile rogueTile) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(32, 2); defaultInterpolatedStringHandler.AppendLiteral("MerchantInventoryRerollCount("); Vector2Int coords = ((LegendsTile)rogueTile).coords; defaultInterpolatedStringHandler.AppendFormatted(((Vector2Int)(ref coords)).x); defaultInterpolatedStringHandler.AppendLiteral(", "); coords = ((LegendsTile)rogueTile).coords; defaultInterpolatedStringHandler.AppendFormatted(((Vector2Int)(ref coords)).y); defaultInterpolatedStringHandler.AppendLiteral(")"); return defaultInterpolatedStringHandler.ToStringAndClear(); } private static string BoostPurchaedKey(this RogueTile rogueTile) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(26, 2); defaultInterpolatedStringHandler.AppendLiteral("MerchantBoostPurchased("); Vector2Int coords = ((LegendsTile)rogueTile).coords; defaultInterpolatedStringHandler.AppendFormatted(((Vector2Int)(ref coords)).x); defaultInterpolatedStringHandler.AppendLiteral(", "); coords = ((LegendsTile)rogueTile).coords; defaultInterpolatedStringHandler.AppendFormatted(((Vector2Int)(ref coords)).y); defaultInterpolatedStringHandler.AppendLiteral(")"); return defaultInterpolatedStringHandler.ToStringAndClear(); } public static void Reroll(RogueMerchantPanel merchantPanel, bool bypassPopup = false) { if (!bypassPopup && ((IEnumerable<RogueArtifactDisplayIcon>)merchantPanel.artifactsMerchantOffersContainer.GetComponentsInChildren<RogueArtifactDisplayIcon>()).Any()) { PopupScreen.instance.ShowPopup((Placement)0, StringExt.Localize("Reroll"), StringExt.Localize(RerollConfirm), ReturnCallback.op_Implicit((Action)delegate { Reroll(merchantPanel, bypassPopup: true); }), StringExt.Localize("OK"), (ReturnCallback)null, StringExt.Localize("Cancel"), (TransitionAnim)1, (BackGround)1, false, false); return; } for (int num = 0; num < RerollCost; num++) { merchantPanel.RogueSaveData.RemoveArtifactFromInventory("Token"); } RogueTile merchantTile = merchantPanel.merchantTile; int seed = ((LegendsTile)merchantTile).seed; ((LegendsTile)merchantTile).seed = seed + 1; currentRerolls++; merchantPanel.RogueSaveData.tileMetaData[merchantPanel.merchantTile.RerollsKey()] = $"{currentRerolls}"; Dictionary<string, string> tileMetaData = merchantPanel.RogueSaveData.tileMetaData; string[] array = Il2CppSystemDictionaryExt.Keys<string, string>(tileMetaData).ToArray(); foreach (string text in array) { if (text.StartsWith("MerchantInventoryItem") || text.StartsWith("MerchantInventoryCount")) { tileMetaData.Remove(text); } } merchantPanel.Open(merchantPanel.merchantTile); } } public static class MinigameChanges { [HarmonyPatch(typeof(RogueHexGrid), "CreateTileData", new Type[] { typeof(LegendsTileSaveData) })] internal static class RogueHexGrid_CreateTileData { [HarmonyPostfix] internal static void Postfix(RogueHexGrid __instance, LegendsTileData __result) { if (ModSettingBool.op_Implicit(RogueRemixMod.NoRaces)) { RogueGameModeRules rogueGameModeRules = GameData.Instance.rogueData.rogueGameModeRules; RogueTileData val = default(RogueTileData); if (Il2CppSystemObjectExt.Is<RogueTileData>((Il2CppObjectBase)(object)__result, ref val) && ((LegendsTileData)val).tileType == 9) { val.minigameData.miniGameType = (RogueMiniGameType)2; val.minigameData.goal = rogueGameModeRules.GetLeashCashGoal(RogueMapScreen.GetTotalCashForTile(__instance.RogueSaveData, rogueGameModeRules)); } } } } } public static class ModHelperData { public const string WorksOnVersion = "55.0"; public const string Version = "1.2.20"; public const string Name = "Rogue Remix"; public const string Description = "An alternate take on the Rogue Legends mode\r\n- Many artifacts buffed, 30+ new artifacts added\r\n- Reroll shops using tokens\r\n- Upgrade Artifacts by finding duplicate copies of them\r\n- Achieve Black Borders for your Hero Loadouts!"; public const string RepoOwner = "doombubbles"; public const string PrevRepoName = "rogue-remix"; public const string RepoName = "RogueRemix"; public const bool SquareIcon = true; } public abstract class ModVanillaArtifact : NamedModContent { [HarmonyPatch(typeof(ArtifactModelBase), "GetTitle")] internal static class ArtifactModelBase_GetTitle { [HarmonyPostfix] internal static void Postfix(ArtifactModelBase __instance, ref string __result) { if (Cache.TryGetValue(__instance.baseId, out ModVanillaArtifact value)) { string text = value.DisplayName(__result); if (text != null) { __result = text; } } } } [HarmonyPatch(typeof(ArtifactModelBase), "GetDescription")] internal static class ArtifactModelBase_GetDescription { [HarmonyPostfix] internal static void Postfix(ArtifactModelBase __instance, ref string __result) { if (Cache.TryGetValue(__instance.baseId, out ModVanillaArtifact value)) { string text = value.Description(__result, __instance.tier); if (text != null) { __result = text; } } } } internal static readonly Dictionary<string, ModVanillaArtifact> Cache = new Dictionary<string, ModVanillaArtifact>(); protected const int Common = 0; protected const int Rare = 1; protected const int Legendary = 2; public virtual string BaseId => ((ModContent)this).Name; public virtual string? Description1 => null; public virtual string? Description2 => null; public virtual string? Description3 => null; public virtual string? DescriptionX => null; public abstract string? MetaDescription { get; } public string BaseDisplayName => ((NamedModContent)this).DisplayName; public virtual string? Description(string description, int tier) { if (1 == 0) { } string result = tier switch { 0 => Description1, 1 => Description2, 2 => Description3, _ => DescriptionX, }; if (1 == 0) { } return result; } public virtual string? DisplayName(string name) { return null; } public sealed override void Register() { if (((ModContent)this).mod.ModSettings.TryGetValue(((ModContent)this).Name, out var value)) { ModSettingBool val = (ModSettingBool)(object)((value is ModSettingBool) ? value : null); if (val != null && !ModSettingBool.op_Implicit(val)) { return; } } ArtifactsData artifactsData = GameData.Instance.artifactsData; int num = 0; foreach (ArtifactDataBase item in Il2CppSystemDictionaryExt.Values<string, ArtifactDataBase>(artifactsData.artifactDatas)) { ArtifactModelBase val2 = ((Il2CppObjectBase)item.ArtifactModel()).Cast<ArtifactModelBase>(); if (val2.ArtifactName.StartsWith(BaseId)) { ModifyArtifact(val2); num++; } } if (num == 0) { ModHelper.Error<RogueRemixMod>((object)("No artifacts with baseId " + BaseId)); } Cache[BaseId] = this; } public void ModifyArtifact(ArtifactModelBase artifact) { ItemArtifactModel artifact2 = default(ItemArtifactModel); MapArtifactModel artifact3 = default(MapArtifactModel); BoostArtifactModel artifact4 = default(BoostArtifactModel); if (Il2CppSystemObjectExt.Is<ItemArtifactModel>((Il2CppObjectBase)(object)artifact, ref artifact2)) { ModifyArtifact(artifact2); } else if (Il2CppSystemObjectExt.Is<MapArtifactModel>((Il2CppObjectBase)(object)artifact, ref artifact3)) { ModifyArtifact(artifact3); } else if (Il2CppSystemObjectExt.Is<BoostArtifactModel>((Il2CppObjectBase)(object)artifact, ref artifact4)) { ModifyArtifact(artifact4); } } public virtual void ModifyArtifact(ItemArtifactModel artifact) { } public virtual void ModifyArtifact(MapArtifactModel artifact) { } public virtual void ModifyArtifact(BoostArtifactModel artifact) { } } public class RogueRemixMod : BloonsTD6Mod { [HarmonyPatch(typeof(ArtifactManager), "GetModifiedPlacementTowerModel")] internal static class ArtifactManager_GetModifiedPlacementTowerModel { [HarmonyPrefix] internal static bool Prefix(TowerModel towerModel, ref TowerModel __result, ref TowerModel? __state) { if (ArtifactPlacementTowerCache.TryGetValue(towerModel, out TowerModel value)) { __result = value; return false; } __state = towerModel; return true; } [HarmonyPostfix] internal static void Postfix(ArtifactManager __instance, TowerModel? __state, TowerModel __result) { if (__state != null && __state != __result) { ArtifactPlacementTowerCache.TryAdd(__state, __result); } } } public static readonly ModSettingFloat RogueMapAnimationSpeed; public static readonly ModSettingBool DamageBoostsAffectModifiers; public static readonly ModSettingBool AlwaysStockXpAndMM; public static readonly ModSettingBool DisableCritPopups; public static readonly ModSettingBool SellingReplacesDiscarding; public static readonly ModSettingBool ArtifactUpgrading; public static readonly ModSettingBool NoRaces; public static readonly ModSettingBool TrainingSandboxMode; public static readonly ModSettingBool BoostsInShop; public static readonly ModSettingBool BloonEncounterRewardsRemix; public static readonly ModSettingBool SkippingRemix; public static readonly ModSettingBool TrackHeroLoadoutCompletions; public static readonly ModSettingButton ClearHeroCompletionData; private static readonly Dictionary<TowerModel, TowerModel> ArtifactPlacementTowerCache; public override bool UsesArtifactDependants => true; public override void OnTitleScreen() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown RogueData rogueData = GameData.Instance.rogueData; RulesChanges.ModifyRules(rogueData); if (!ModSettingBool.op_Implicit(DisableCritPopups)) { return; } GiveCritChanceBoostBehaviorModel val = default(GiveCritChanceBoostBehaviorModel); foreach (ArtifactModelBase item in from artifact in Il2CppSystemDictionaryExt.Values<string, ArtifactDataBase>(GameData.Instance.artifactsData.artifactDatas) select ((Il2CppObjectBase)artifact.ArtifactModel()).Cast<ArtifactModelBase>()) { if (ModelExt.HasDescendant<GiveCritChanceBoostBehaviorModel>((Model)(object)item, ref val)) { val.critTextPrefab = new PrefabReference(""); } } } public override void OnNewGameModel(GameModel gameModel) { ReadonlyInGameData currentGame = InGameData.CurrentGame; if (((currentGame != null) ? currentGame.rogueData : null) == null) { return; } RogueLegendsManager instance = RogueLegendsManager.instance; if (((instance != null) ? instance.RogueSaveData : null) == null) { return; } List<ArtifactLoot> artifactsInventory = RogueLegendsManager.instance.RogueSaveData.artifactsInventory; List<ArtifactModelBase> artifacts = (from artifactDateBase in Il2CppSystemDictionaryExt.Values<string, ArtifactDataBase>(GameData.Instance.artifactsData.artifactDatas) select ((Il2CppObjectBase)artifactDateBase.ArtifactModel()).Cast<ArtifactModelBase>()).ToList(); foreach (ModArtifact modArtifact in ModContent.GetContent<ModArtifact>()) { if (modArtifact is IArtifactSynergy artifactSynergy) { ArtifactLoot obj = Il2CppGenerics.FirstOrDefault<ArtifactLoot>(artifactsInventory, (Func<ArtifactLoot, bool>)((ArtifactLoot loot) => loot.baseId.Contains(((ModContent)modArtifact).Id))); int tier = ((obj != null) ? obj.tier : (-1)); artifactSynergy.ModifyOtherArtifacts(artifacts, tier); } } } public override void OnSaveSettings(JObject settings) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0024: Expected O, but got Unknown JToken obj = settings["Completionism"]; if (obj == null) { JObject val = new JObject(); JToken val2 = (JToken)val; settings["Completionism"] = (JToken)val; obj = val2; } JToken val3 = obj; foreach (var (text2, flag2) in Completionism.RogueRemixStats) { val3[(object)text2] = JToken.op_Implicit(flag2); } } public override void OnLoadSettings(JObject settings) { JToken val = default(JToken); if (!settings.TryGetValue("Completionism", ref val)) { return; } JObject val2 = (JObject)(object)((val is JObject) ? val : null); if (val2 == null) { return; } foreach (KeyValuePair<string, JToken> item in val2) { item.Deconstruct(out var key, out var value); string key2 = key; JToken val3 = value; JValue val4 = (JValue)(object)((val3 is JValue) ? val3 : null); if (val4 != null && val4.Value is bool value2) { Completionism.RogueRemixStats[key2] = value2; } } } public override void OnProfileLoaded(ProfileModel result) { try { LegendsDataModel legendsData = result.legendsData; Dictionary<string, bool> val = default(Dictionary<string, bool>); if (legendsData != null && legendsData.savedLegendsStats?.TryGetValue("RogueRemix", ref val) == true) { Enumerator<string, bool> enumerator = val.GetEnumerator(); string text = default(string); bool flag = default(bool); while (enumerator.MoveNext()) { enumerator.Current.Deconstruct(ref text, ref flag); string key = text; bool value = flag; Completionism.RogueRemixStats.TryAdd(key, value); } result.legendsData.savedLegendsStats.Remove("RogueRemix"); ((BloonsMod)this).SaveModSettings(); } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning((object)ex); } } public override void OnUpdate() { ArtifactPlacementTowerCache.Clear(); } static RogueRemixMod() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_005c: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_00e8: 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_0108: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown ModSettingFloat val = new ModSettingFloat(1f) { description = "Speeds up the animations in the Rogue Legends map" }; ((ModSettingNumber<double>)val).min = 1.0; ((ModSettingNumber<double>)val).max = 3.0; ((ModSettingNumber<double>)val).slider = true; ((ModSettingDouble)val).stepSize = 0.1f; ((ModSetting)val).icon = "IngameUi[FastForwardGlowBtn]"; ((ModSettingNumber<double>)val).sliderSuffix = "x"; RogueMapAnimationSpeed = val; DamageBoostsAffectModifiers = new ModSettingBool(true) { description = "By default, damage bonuses from boosts and artifacts don't affect additive modifiers like what Moab Maulers have. This settings makes them be affected.", icon = "4f11d9b6f8bd4ec4fb1ef1cde5baf163" }; AlwaysStockXpAndMM = new ModSettingBool(true) { description = "Makes merchants also stock the Rogue XP and Monkey Money tokens on stage 1 and after stage 4", icon = "06120913d7019384cbd6a803065f3d80" }; DisableCritPopups = new ModSettingBool(true) { description = "Disables Critical Hit popups added by Artifacts, which can noticeably improve performance under certain conditions.", requiresRestart = true, icon = "9db122d8d7b9083439c796519a48f481" }; SellingReplacesDiscarding = new ModSettingBool(true) { description = "Discarding an artifact will give tokens the same way selling it would", icon = "MonkeyKnowledgeUi[BetterSellDealsIcon]" }; ArtifactUpgrading = new ModSettingBool(true) { description = "Allows artifacts you already have to appear as loot, and having two of the same artifact of the same tier will upgrade it to one of the higher tier.", icon = "IngameUi[UpgradeBtn]" }; NoRaces = new ModSettingBool(false) { description = "Replaces all Race and Endurance Race minigames with Least Cash minigames", icon = "ChallengeRulesIcons[LeastCashIcon]" }; TrainingSandboxMode = new ModSettingBool(true) { description = "Makes the Rogue Legends training mode be Sandbox", icon = "1bf486871cae1224ca90cf52c1965462" }; BoostsInShop = new ModSettingBool(false) { description = "Makes boost popups no longer happen during matches, and instead Boosts can be purchased at Shop Tiles", icon = "b6685aa5064b78842a62aa5c8c6da9af" }; BloonEncounterRewardsRemix = new ModSettingBool(false) { description = "Makes all Bloon Encounters give a reward choice and not just tokens only", icon = "921b13fd01d035845b3801cee503b9a8" }; SkippingRemix = new ModSettingBool(false) { description = "Makes skipping only cost lives if you have an active attempt going on the tile", icon = "Ui[SkipArrows]" }; TrackHeroLoadoutCompletions = new ModSettingBool(true) { description = "Saves info for displaying the completionist loadout borders.", icon = "a94e04831943e4837a4712123f032bb9" }; ClearHeroCompletionData = new ModSettingButton((Action)delegate { PopupScreenExt.SafelyQueue(PopupScreen.instance, (Action<PopupScreen>)delegate(PopupScreen screen) { screen.ShowPopup((Placement)2, "Clear Data", "This will clear your completion history for.", ReturnCallback.op_Implicit((Action)delegate { Completionism.RogueRemixStats.Clear(); ((BloonsMod)ModContent.GetInstance<RogueRemixMod>()).SaveModSettings(); }), "OK", (ReturnCallback)null, "Cancel", (TransitionAnim)1, (BackGround)1, false, false); }); }) { description = "Use this to remove all hero completion data.", icon = "Ui[RestartIcon]" }; ArtifactPlacementTowerCache = new Dictionary<TowerModel, TowerModel>(); } } public static class RulesChanges { [HarmonyPatch(typeof(RogueVictoryScreen), "Open")] internal static class RogueVictoryScreen_Open { [HarmonyPostfix] internal static void Postfix(RogueVictoryScreen __instance) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Invalid comparison between Unknown and I4 RogueGameData rogueData = InGameData.CurrentGame.rogueData; RogueLootData rogueLootData = __instance.RogueSaveData.rogueLootData; if (ModSettingBool.op_Implicit(RogueRemixMod.BloonEncounterRewardsRemix) && RogueMap.TypeEarnsTokenAfterGame(rogueData.tileType)) { rogueLootData.isTokenLoot = false; rogueLootData.allowTowers = true; } if ((int)rogueData.tileType != 8) { } } } [HarmonyPatch(typeof(RogueLegendsManager), "InitRogueRun")] internal static class RogueLegendsManager_InitRogueRun { [HarmonyPostfix] internal static void Postfix(RogueLegendsManager __instance) { RogueGameModifiers modifiers = __instance.RogueSaveData.modifiers; modifiers.boostsDisabled |= ModSettingBool.op_Implicit(RogueRemixMod.BoostsInShop); } } [HarmonyPatch(typeof(DamageBoostMutator), "Mutate")] internal static class DamageBoostMutator_Mutate { [HarmonyPostfix] internal static void Postfix(DamageBoostMutator __instance, Model model) { ApplyDamageToModifiers(model, __instance.multiplier); } } public static void ModifyRules(RogueData data) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected I4, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected I4, but got Unknown RogueGameModeRules rogueGameModeRules = data.rogueGameModeRules; if (ModSettingBool.op_Implicit(RogueRemixMod.BoostsInShop)) { } foreach (RogueModeGenericRules item2 in (Il2CppArrayBase<RogueModeGenericRules>)(object)rogueGameModeRules.modeRules) { RogueTileType rogueTileType = item2.rogueTileType; RogueTileType val = rogueTileType; switch ((int)val) { case 0: case 1: case 2: case 3: continue; } switch (val - 8) { } } List<string> list = ((IEnumerable<string>)RogueData.ignoreCountArtifacts).ToList(); Enumerator<string, ArtifactDataBase> enumerator2 = GameData.Instance.artifactsData.artifactDatas.GetEnumerator(); string text = default(string); ArtifactDataBase val2 = default(ArtifactDataBase); while (enumerator2.MoveNext()) { enumerator2.Current.Deconstruct(ref text, ref val2); string item = text; ArtifactDataBase val3 = val2; if (((Il2CppObjectBase)val3.ArtifactModel()).Cast<ArtifactModelBase>().IsBoost) { list.Add(item); } } foreach (ModBoostArtifact item3 in ModContent.GetContent<ModBoostArtifact>()) { list.AddRange(((ModArtifact)item3).Ids); } RogueData.ignoreCountArtifacts = Il2CppStringArray.op_Implicit(list.ToArray()); } public static void ApplyDamageToModifiers(Model model, float multiplier) { if (!ModSettingBool.op_Implicit(RogueRemixMod.DamageBoostsAffectModifiers)) { return; } DamageModifierForTagModel val = default(DamageModifierForTagModel); DamageModifierForBloonTypeModel val2 = default(DamageModifierForBloonTypeModel); DamageModifierForBloonStateModel val3 = default(DamageModifierForBloonStateModel); DamageModifierForModifiersModel val4 = default(DamageModifierForModifiersModel); DamageModifierForRoundModel val5 = default(DamageModifierForRoundModel); foreach (DamageModifierModel item in MonoLinqHelper.ToArray<DamageModifierModel>(model.GetDescendants<DamageModifierModel>())) { if (Il2CppSystemObjectExt.Is<DamageModifierForTagModel>((Il2CppObjectBase)(object)item, ref val)) { DamageModifierForTagModel obj = val; obj.damageAddative *= multiplier; } else if (Il2CppSystemObjectExt.Is<DamageModifierForBloonTypeModel>((Il2CppObjectBase)(object)item, ref val2)) { DamageModifierForBloonTypeModel obj2 = val2; obj2.damageAdditive *= multiplier; } else if (Il2CppSystemObjectExt.Is<DamageModifierForBloonStateModel>((Il2CppObjectBase)(object)item, ref val3)) { DamageModifierForBloonStateModel obj3 = val3; obj3.damageAdditive *= multiplier; } else if (Il2CppSystemObjectExt.Is<DamageModifierForModifiersModel>((Il2CppObjectBase)(object)item, ref val4)) { DamageModifierForModifiersModel obj4 = val4; obj4.damageAddative *= multiplier; } else if (Il2CppSystemObjectExt.Is<DamageModifierForRoundModel>((Il2CppObjectBase)(object)item, ref val5)) { DamageModifierForRoundModel obj5 = val5; obj5.damagePerRound *= multiplier; } } } } public static class SkippingChanges { [HarmonyPatch(typeof(RogueTileInfoPanel), "Bind")] internal static class RogueTileInfoPanel_Bind { [HarmonyPostfix] internal static void Postfix(RogueTileInfoPanel __instance, RogueTile selectedTile, bool showContinueBtn, bool showSkipBtn) { if (ModSettingBool.op_Implicit(RogueRemixMod.SkippingRemix) || DebugFreeSkipping) { ((Component)((IEnumerable<RectTransform>)((Component)__instance.skipBtn).GetComponentsInChildren<RectTransform>(true)).First((RectTransform transform) => ((Object)transform).name == "Cost")).gameObject.SetActive(!DebugFreeSkipping && (showContinueBtn || ((LegendsTile)selectedTile).tileType != 2 || !showSkipBtn)); } } } [HarmonyPatch(typeof(RogueTileInfoPanel), "SkipTileClicked")] internal static class RogueTileInfoPanel_SkipTileClicked { [HarmonyPrefix] internal static void Prefix(RogueTileInfoPanel __instance) { if (!((Component)((IEnumerable<RectTransform>)((Component)__instance.skipBtn).GetComponentsInChildren<RectTransform>(true)).First((RectTransform transform) => ((Object)transform).name == "Cost")).gameObject.active) { RogueGameSaveData rogueSaveData = RogueLegendsManager.instance.RogueSaveData; int lives = rogueSaveData.lives; rogueSaveData.lives = lives + 1; lives = rogueSaveData.unseenLivesLost; rogueSaveData.unseenLivesLost = lives - 1; RogueCampaignStats currentStageStats = rogueSaveData.currentStageStats; lives = currentStageStats.heartsLost; currentStageStats.heartsLost = lives - 1; RogueCampaignStats totalCampaignStats = rogueSaveData.totalCampaignStats; lives = totalCampaignStats.heartsLost; totalCampaignStats.heartsLost = lives - 1; blockNextLifeLossAnim = true; blockNextLifeLossAnalytics = true; } } } [HarmonyPatch(typeof(AnalyticsManager), "LegendsLoseHearts")] internal static class AnalyticsManager_LegendsLoseHearts { [HarmonyPrefix] internal static bool Prefix() { if (blockNextLifeLossAnalytics) { blockNextLifeLossAnalytics = false; return false; } return true; } } [HarmonyPatch(typeof(RogueMapScreen), "LivesRemovedAnim")] internal static class RogueMapScreen_LivesRemovedAnim { [HarmonyPrefix] internal static bool Prefix() { if (blockNextLifeLossAnim) { blockNextLifeLossAnim = false; return false; } return true; } } [HarmonyPatch(typeof(UnityToSimulation), "ExecuteContinueFromCheckpoint")] internal static class UnityToSimulation_ExecuteContinueFromCheckpoint { [HarmonyPostfix] internal static void Postfix(UnityToSimulation __instance) { RogueGameSaveData val = default(RogueGameSaveData); if (RogueLegendsManager.instance != null && InGameData.CurrentGame.rogueData != null && Il2CppSystemObjectExt.Is<RogueGameSaveData>(RogueLegendsManager.instance.RogueSaveData, ref val) && val.unseenLivesLost > 0) { RogueGameSaveData obj = val; obj.lives += val.unseenLivesLost; RogueCampaignStats currentStageStats = val.currentStageStats; currentStageStats.heartsLost -= val.unseenLivesLost; val.unseenLivesLost = 0; } } } private static bool blockNextLifeLossAnalytics; private static bool blockNextLifeLossAnim; private static readonly bool DebugFreeSkipping; } public class ToggleSettings : ModContent, IModSettings, IModContent { [HarmonyPatch(typeof(RogueLegendsManager), "HasArtifactInLootPoolAlready")] internal static class RogueLegendsManager_HasArtifactInLootPoolAlready { [HarmonyPrefix] internal static bool Prefix(RogueLegendsManager __instance, ArtifactModelBase artifactModel, ref bool __result) { if ((!ModSettingBool.op_Implicit(RogueRemixMod.BoostsInShop) && artifactModel.baseId.Contains("Unboosted")) || (Cache.TryGetValue(artifactModel.ArtifactName, out ModSettingBool value) && !ModSettingBool.op_Implicit(value))) { __result = true; return false; } return true; } } public static readonly ModSettingCategory NewArtifacts = new ModSettingCategory("New Artifacts") { modifyCategory = delegate(ModHelperCategory category) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) ModHelperButton val = ((ModHelperComponent)category).AddButton(new Info("Enable All", 1000f, -100f, 562f, 200f, new Vector2(0.5f, 1f)), "Ui[GreenBtnLong]", Action.op_Implicit((Action)delegate { foreach (ModSettingBool item in ((BloonsMod)ModContent.GetInstance<RogueRemixMod>()).ModSettings.Values.Where((ModSetting setting) => setting.category == NewArtifacts).OfType<ModSettingBool>()) { ((ModSetting)item).SetValue((object)true); } })); ((ModHelperComponent)val).LayoutElement.ignoreLayout = true; ((ModHelperComponent)val).AddText(new Info("Text", (InfoPreset)0), "Enable All", 80f); ModHelperButton val2 = ((ModHelperComponent)category).AddButton(new Info("Disable All", -1000f, -100f, 562f, 200f, new Vector2(0.5f, 1f)), "Ui[RedBtnLong]", Action.op_Implicit((Action)delegate { foreach (ModSettingBool item2 in ((BloonsMod)ModContent.GetInstance<RogueRemixMod>()).ModSettings.Values.Where((ModSetting setting) => setting.category == NewArtifacts).OfType<ModSettingBool>()) { ((ModSetting)item2).SetValue((object)false); } })); ((ModHelperComponent)val2).LayoutElement.ignoreLayout = true; ((ModHelperComponent)val2).AddText(new Info("Text", (InfoPreset)0), "Disable All", 80f); } }; public static readonly ModSettingCategory ArtifactChanges = new ModSettingCategory("Artifact Changes") { modifyCategory = delegate(ModHelperCategory category) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) ModHelperButton val = ((ModHelperComponent)category).AddButton(new Info("Enable All", 1000f, -100f, 562f, 200f, new Vector2(0.5f, 1f)), "Ui[GreenBtnLong]", Action.op_Implicit((Action)delegate { foreach (ModSettingBool item3 in ((BloonsMod)ModContent.GetInstance<RogueRemixMod>()).ModSettings.Values.Where((ModSetting setting) => setting.category == ArtifactChanges).OfType<ModSettingBool>()) { ((ModSetting)item3).SetValue((object)true); } })); ((ModHelperComponent)val).LayoutElement.ignoreLayout = true; ((ModHelperComponent)val).AddText(new Info("Text", (InfoPreset)0), "Enable All", 80f); ModHelperButton val2 = ((ModHelperComponent)category).AddButton(new Info("Disable All", -1000f, -100f, 562f, 200f, new Vector2(0.5f, 1f)), "Ui[RedBtnLong]", Action.op_Implicit((Action)delegate { foreach (ModSettingBool item4 in ((BloonsMod)ModContent.GetInstance<RogueRemixMod>()).ModSettings.Values.Where((ModSetting setting) => setting.category == ArtifactChanges).OfType<ModSettingBool>()) { ((ModSetting)item4).SetValue((object)false); } })); ((ModHelperComponent)val2).LayoutElement.ignoreLayout = true; ((ModHelperComponent)val2).AddText(new Info("Text", (InfoPreset)0), "Disable All", 80f); } }; internal static readonly Dictionary<string, ModSettingBool> Cache = new Dictionary<string, ModSettingBool>(); protected override float RegistrationPriority => 10000f; public override IEnumerable<ModContent> Load() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown foreach (TypeInfo definedType in typeof(RogueRemixMod).Assembly.DefinedTypes) { if (!definedType.IsAbstract && (definedType.IsAssignableTo(typeof(ModArtifact)) || definedType.IsAssignableTo(typeof(ModVanillaArtifact))) && (ModSettingBool.op_Implicit(RogueRemixMod.BoostsInShop) || !definedType.IsAssignableTo(typeof(ModBoostArtifact))) && (!(definedType == typeof(ItsATrap)) || ModHelper.HasMod("PowersInShop"))) { ModSettingBool val = new ModSettingBool(true) { button = true, displayName = definedType.Name }; if (definedType.IsAssignableTo(typeof(ModArtifact))) { ((ModSetting)val).category = NewArtifacts; val.enabledText = "Active"; val.disabledText = "Inactive"; } if (definedType.IsAssignableTo(typeof(ModVanillaArtifact))) { ((ModSetting)val).category = ArtifactChanges; val.enabledText = "Changed"; val.disabledText = "Unchanged"; } base.mod.ModSettings.Add(definedType.Name, (ModSetting)(object)val); } } return ((ModContent)this).Load(); } public override void Register() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Expected O, but got Unknown string key; foreach (ModArtifact item2 in base.mod.Content.OfType<ModArtifact>()) { ModSettingBool val = (ModSettingBool)base.mod.ModSettings[((object)item2).GetType().Name]; ((ModSetting)val).icon = item2.IconCommonReference.AssetGUID; ((ModSetting)val).displayName = ((NamedModContent)item2).DisplayName; ((ModSetting)val).description = "Controls whether this modded artifact will show up in loot"; foreach (var tier in item2.Tiers) { int item = tier.Item1; ModSettingBool val2 = val; ModSettingBool val3 = val2; string description = ((ModSetting)val2).description; if (1 == 0) { } key = item switch { 0 => "Common: " + item2.DescriptionCommon, 1 => "Rare: " + item2.DescriptionRare, 2 => "Legendary: " + item2.DescriptionLegendary, _ => "?", }; if (1 == 0) { } ((ModSetting)val3).description = description + "\n" + key; } foreach (string id in item2.Ids) { Cache[id] = val; } } foreach (ModVanillaArtifact item3 in base.mod.Content.OfType<ModVanillaArtifact>()) { ModSettingBool val4 = (ModSettingBool)base.mod.ModSettings[((object)item3).GetType().Name]; Il2CppArrayBase<ArtifactModelBase> source = MonoLinqHelper.ToArray<ArtifactModelBase>(GameData.Instance.artifactsData.GetBaseArtifactModels(item3.BaseId, -1)); ((ModSetting)val4).icon = ((IEnumerable<ArtifactModelBase>)source).First().icon.AssetGUID; ((ModSetting)val4).requiresRestart = true; ((ModSetting)val4).displayName = item3.BaseDisplayName; ((ModSetting)val4).description = "Controls whether this vanilla artifact is altered:\n" + item3.MetaDescription; } foreach (KeyValuePair<string, ModSetting> modSetting in base.mod.ModSettings) { modSetting.Deconstruct(out key, out var value); string text = key; ModSetting val5 = value; ModContent.Localize(base.mod, text + " Setting Name", val5.displayName); ModContent.Localize(base.mod, text + " Setting Description", val5.description); } } } public static class TokenChanges { [HarmonyPatch(typeof(RogueLegendsManager), "GetRandomLoot")] internal static class RogueLegendsManager_GetRandomLoot { [HarmonyPostfix] internal static void Postfix(RogueLootData rogueLootData, ref List<RogueLoot> __result) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 if (rogueLootData != null && rogueLootData.allowArtifacts && (int)rogueLootData.rogueLootType == 1 && !rogueLootData.isTokenLoot) { TokenChanges.AddTokenFallback<RogueLoot>(__result); } } } [HarmonyPatch(typeof(RogueLegendsManager), "GetRandomArtifacts")] internal static class RogueLegendsManager_GetRandomArtifacts { [HarmonyPostfix] internal static void Postfix(RogueLegendsManager __instance, ref List<ArtifactLoot> __result, RogueLootType type, int tileSeed, int guaranteedLegendary) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_010c: Expected O, but got Unknown //IL_012c: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown if ((int)type != 1) { return; } if (MerchantChanges.IsPopulatingShop) { if (ModSettingBool.op_Implicit(RogueRemixMod.BoostsInShop) && MerchantChanges.ShouldAddBoosts) { List<ArtifactLoot> randomArtifacts = __instance.GetRandomArtifacts(3, (RogueLootType)0, 0, tileSeed, -1, 0, (guaranteedLegendary > 0) ? 1 : 0, false, 1f, 1f, false); Enumerator<ArtifactLoot> enumerator = randomArtifacts.GetEnumerator(); while (enumerator.MoveNext()) { ArtifactLoot current = enumerator.Current; current.lootType = (RogueLootType)1; } __result.AddRange(((Il2CppObjectBase)randomArtifacts).Cast<IEnumerable<ArtifactLoot>>()); } RogueData rogueData = GameData.Instance.rogueData; if (ModSettingBool.op_Implicit(RogueRemixMod.AlwaysStockXpAndMM) && (__instance.RogueSaveData.stage == 0 || __instance.RogueSaveData.stage > rogueData.campaignStageCount)) { for (int i = 0; i < rogueData.merchantMMTokenCount; i++) { __result.Add(new ArtifactLoot { baseId = "TokenMonkeyMoney", artifactName = "TokenMonkeyMoney", lootType = (RogueLootType)1 }); } for (int j = 0; j < rogueData.merchantXpTokenCount; j++) { __result.Add(new ArtifactLoot { baseId = "TokenRogueXp", artifactName = "TokenRogueXp", lootType = (RogueLootType)1 }); } } } else { TokenChanges.AddTokenFallback<ArtifactLoot>(__result); } } } [HarmonyPatch(typeof(RogueLootPopup), "SetLootChoices")] internal static class RogueLootPopup_SetLootChoices { [HarmonyPostfix] internal static void Postfix(RogueLootPopup __instance) { RogueArtifactDisplayIcon[] array = (from o in (IEnumerable<GameObject>)__instance.activeButtons.ToArray() select o.GetComponentInChildren<RogueArtifactDisplayIcon>() into icon where (Object)(object)icon != (Object)null select icon).ToArray(); hijackingLootButtonClicked = true; RogueArtifactDisplayIcon[] array2 = array; ArtifactLoot val2 = default(ArtifactLoot); foreach (RogueArtifactDisplayIcon val in array2) { lastRogueLoot = null; ((UnityEvent)val.selectBtn.onClick).Invoke(); if (Il2CppSystemObjectExt.Is<ArtifactLoot>((Il2CppObjectBase)(object)lastRogueLoot, ref val2)) { if (val2.artifactName == "Token" && val2.tier > 0) { val.StackCount = val2.tier; } ArtifactUpgrading.HandleUpgradeIcon(val, val2.artifactName); } } hijackingLootButtonClicked = false; } } [HarmonyPatch(typeof(RogueLootPopup), "LootButtonClicked")] internal static class RogueLootPopup_LootButtonClicked { [HarmonyPrefix] internal static bool Prefix(RogueLoot loot) { lastRogueLoot = loot; return !hijackingLootButtonClicked; } } [HarmonyPatch(typeof(RogueLootPopup), "AddArtifactAndClose")] internal static class RogueLootPopup_AddArtifact { [HarmonyPrefix] internal static bool Prefix(RogueLootPopup __instance, ArtifactLoot artifact) { if (artifact != null && artifact.artifactName == "Token" && artifact.tier > 0) { RewardTokens(artifact.tier, __instance.onRewardScreenClosedCallback); RogueLegendsManager.instance.CheckFeats(); ((Popup)__instance).canHide = true; ((Popup)__instance).OKClicked(); return false; } return true; } } private static bool hijackingLootButtonClicked; private static RogueLoot? lastRogueLoot; public static void AddTokenFallback<T>(List<T> results) where T : RogueLoot { //IL_00b5: 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_00c6: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) ArtifactLoot[] array = (from loot in IEnumerableExt.OfIl2CppType<ArtifactLoot>((IEnumerable)results.ToArray()) where (int)loot.lootType == 1 select loot).ToArray(); if (array.Length != 0) { int num = array.Max((ArtifactLoot loot) => loot.ArtifactPower()); ArtifactLoot val = default(ArtifactLoot); if (Il2CppSystemObjectExt.Is<ArtifactLoot>(((IEnumerable<ArtifactLoot>)array).FirstOrDefault((Func<ArtifactLoot, bool>)((ArtifactLoot loot) => loot.baseId == "Token")), ref val)) { val.tier = Math.Max(num, val.tier); return; } results.Add(((Il2CppObjectBase)new ArtifactLoot { artifactName = "Token", tier = num, lootType = (RogueLootType)1, baseId = "Token", startingArtifact = false }).Cast<T>()); } } public static void RewardTokens(int amount, ReturnCallback? callback = null) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown ArtifactLoot val = new ArtifactLoot { lootType = (RogueLootType)1, artifactName = "Token", baseId = "Token" }; for (int i = 0; i < amount; i++) { RogueLegendsManager.instance.RogueSaveData.AddArtifactToInventory(val, true, false); } PopupScreen.instance.ShowRogueRewardPopup(callback ?? ReturnCallback.op_Implicit((Action)delegate { }), (RogueLoot)(object)val, false, amount); } } public static class TrainingSandbox { [HarmonyPatch(typeof(RogueNewGameScreen), "PlayTrainingModeClicked")] internal static class RogueNewGameScreen_PlayTrainingModeClicked { [HarmonyPrefix] internal static void Prefix() { training = true; } [HarmonyPostfix] internal static void Postfix() { training = false; } } [HarmonyPatch(typeof(RogueNewGameScreen), "ContinueTrainingMode")] internal static class RogueNewGameScreen_ContinueTrainingMode { [HarmonyPrefix] internal static void Prefix() { training = true; } [HarmonyPostfix] internal static void Postfix() { training = false; } } [HarmonyPatch(typeof(InGameData), "SetupRogueGame")] internal static class InGameData_SetupRogueGame { [HarmonyPostfix] internal static void Postfix(InGameData __instance, DailyChallengeModel dcm) { if (training && ModSettingBool.op_Implicit(RogueRemixMod.TrainingSandboxMode)) { __instance.selectedMode = "Sandbox"; training = false; } } } private static bool training; } } namespace RogueRemix.NewArtifacts { public class AreWeThereYet : ModItemArtifact { public override string Icon => "Ui[StopWatch]"; public override bool SmallIcon => true; public override string Description(int tier) { return $"All Monkey placement cooldowns are reduced {tier + 1} round{((tier == 0) ? "" : "s")}"; } public override void ModifyArtifactModel(ItemArtifactModel artifactModel) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown foreach (string item in (Il2CppArrayBase<string>)(object)TowerType.towers) { ArtifactModelBehaviorExt.AddBehavior<InstaCooldownBehaviorModel>(artifactModel, new InstaCooldownBehaviorModel("", item, -(((ArtifactModelBase)artifactModel).tier + 1))); } } } public class ArtifactExpansion : ModBoostArtifact { [HarmonyPatch(typeof(DisplayArtifactsPanel), "ResetUIs")] internal static class DisplayArtifactsPanel_ResetUIs { [HarmonyPostfix] internal static void Postfix(DisplayArtifactsPanel __instance) { if ((Object)(object)__instance.artifactCountTxt != (Object)null && __instance.RogueSaveData != null) { __instance.artifactCountTxt.OverrideText(ArtifactCount(__instance.RogueSaveData) + "/" + ArtifactLimit(__instance.RogueSaveData)); } } } [HarmonyPatch(typeof(DisplayArtifactsPanel), "OpenDelete")] internal static class DisplayArtifactsPanel_OpenDelete { [HarmonyPrefix] internal static bool Prefix(DisplayArtifactsPanel __instance) { return ArtifactCount(__instance.RogueSaveData) > ArtifactLimit(__instance.RogueSaveData); } } public override int MinTier => 1; public override string Icon => "Ui[ArtifactPowerIcon]"; public override bool SmallIcon => true; public override string Description(int tier) { return $"Artifact Limit increased by {(double)tier * 0.1:P0}"; } public override IEnumerable<ModContent> Load() { IEnumerable<ModContent> result; if (!ModSettingBool.op_Implicit(RogueRemixMod.BoostsInShop)) { IEnumerable<ModContent> enumerable = Array.Empty<ModContent>(); result = enumerable; } else { result = ((ModContent)this).Load(); } return result; } public override void ModifyArtifactModel(BoostArtifactModel artifactModel) { } private static int ArtifactCount(RogueGameSaveData saveData) { return ((IEnumerable<ArtifactLoot>)saveData.artifactsInventory.ToArray()).Count((ArtifactLoot loot) => !((Il2CppArrayBase<string>)(object)RogueData.ignoreCountArtifacts).Contains(loot.artifactName)); } private static int ArtifactLimit(RogueGameSaveData saveData) { return (int)((float)saveData.modifiers.artifactLimit * (1f + 0.1f * (float)((IEnumerable<ArtifactLoot>)saveData.artifactsInventory.ToArray()).Where((ArtifactLoot a) => a.baseId.Contains("ArtifactExpansion")).Sum((ArtifactLoot a) => a.tier))); } } public class BladeLord : ModItemArtifact { public override int MinTier => 1; public override string Icon => "38e5316dcb867014897df32623237621"; public override bool SmallIcon => true; private static float Interval(int tier) { if (1 == 0) { } float result = tier switch { 0 => 0.7f, 1 => 0.5f, 2 => 0.3f, _ => 1f, }; if (1 == 0) { } return result; } public override string Description(int tier) { return $"Blade Shooters are permanently orbited by three of their projectiles that damage Bloons every {Interval(tier):N1} seconds"; } public override string InstaMonkey(int tier) { return TowerType.TackShooter; } public override int[] InstaTiers(int tier) { if (1 == 0) { } int[] result = tier switch { 0 => new int[3] { 0, 1, 1 }, 1 => new int[3] { 0, 2, 1 }, 2 => new int[3] { 0, 2, 0 }, _ => Array.Empty<int>(), }; if (1 == 0) { } return result; } public override void ModifyArtifactModel(ItemArtifactModel artifactModel) { } public override void ModifyGameModel(GameModel gameModel, int tier) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown AttackModel val = ModelExt.Duplicate<AttackModel>(TowerModelExt.GetAttackModel(gameModel.GetTower(TowerType.BoomerangMonkey, 5, 0, 0), "Orbit")); ProjectileModel descendant = ((Model)val).GetDescendant<ProjectileModel>(); ProjectileModelBehaviorExt.RemoveBehavior<DamageModifierModel>(descendant); ProjectileModelBehaviorExt.RemoveBehavior<DamageModel>(descendant); ArcEmissionModel val4 = default(ArcEmissionModel); foreach (TowerModel item in ((IEnumerable<TowerModel>)gameModel.towers).Where((TowerModel model) => ((EntityModel)model).baseId == TowerType.TackShooter && ((Il2CppArrayBase<int>)(object)model.tiers)[1] >= 3)) { WeaponModel val2 = ((Il2CppArrayBase<WeaponModel>)(object)TowerModelExt.GetAttackModel(item).weapons)[0]; ProjectileModel val3 = ModelExt.Duplicate<ProjectileModel>(val2.projectile); if (Il2CppSystemObjectExt.Is<ArcEmissionModel>((Il2CppObjectBase)(object)val2.emission, ref val4)) { val3.pierce *= (float)val4.count; } ProjectileModelExt.AddFilter(val3, (FilterModel)new FilterAllModel("")); ProjectileModelBehaviorExt.RemoveBehavior<TravelStraitModel>(val3); ProjectileModelBehaviorExt.AddBehavior<AgeModel>(val3, new AgeModel("", 9999999f, 9999999, true, (EndOfRoundClearBypassModel)null)); ProjectileModelBehaviorExt.AddBehavior<DontDestroyOnContinueModel>(val3, new DontDestroyOnContinueModel("")); ProjectileModelBehaviorExt.AddBehavior<CantBeReflectedModel>(val3, new CantBeReflectedModel("")); TowerModelBehaviorExt.AddBehavior<OrbitModel>(item, new OrbitModel("", val3, 3, item.range * 0.75f)); AttackModel val5 = ModelExt.Duplicate<AttackModel>(val); WeaponModel val6 = ((Il2CppArrayBase<WeaponModel>)(object)val5.weapons)[0]; ProjectileModel projectile = val6.projectile; val6.Rate = Interval(tier); ProjectileModelBehaviorExt.AddBehavior<DamageModel>(projectile, ModelExt.Duplicate<DamageModel>(ProjectileModelExt.GetDamageModel(val3))); foreach (DamageModifierForTagModel behavior in ProjectileModelBehaviorExt.GetBehaviors<DamageModifierForTagModel>(val3)) { ProjectileModelBehaviorExt.AddBehavior<DamageModifierForTagModel>(projectile, ModelExt.Duplicate<DamageModifierForTagModel>(behavior)); } projectile.radius = 10f + item.range * 0.75f; TowerModelBehaviorExt.AddBehavior<AttackModel>(item, val5); } } } public class CamoBeGone : ModItemArtifact { private const int PierceAmount = 3; public override string Icon => "3f078943acee04c8284d8d8d87c5b9ba"; public override bool SmallIcon => true; private static float Effect(int tier) { if (1 == 0) { } float result = tier switch { 0 => 0.1f, 1 => 0.15f, 2 => 0.25f, _ => 0f, }; if (1 == 0) { } return result; } public override string Description(int tier) { return $"Projectiles that De-Camo Bloons have {3}x pierce, and the towers that fire them have {Effect(tier):P0} more attack speed"; } public override void ModifyArtifactModel(ItemArtifactModel artifactModel) { } public override void ModifyGameModel(GameModel gameModel, int tier) { RemoveBloonModifiersModel val = default(RemoveBloonModifiersModel); foreach (TowerModel item in (Il2CppArrayBase<TowerModel>)(object)gameModel.towers) { bool flag = false; foreach (ProjectileModel item2 in MonoLinqHelper.ToArray<ProjectileModel>(((Model)item).GetDescendants<ProjectileModel>())) { if (Il2CppReferenceArray.Any<Model>(item2.behaviors, (Func<Model, bool>)((Model b) => Il2CppSystemObjectExt.Is<RemoveBloonModifiersModel>((Il2CppObjectBase)(object)b, ref val) && val.cleanseCamo))) { item2.pierce *= 3f; flag = true; } } if (!flag) { continue; } foreach (WeaponModel item3 in MonoLinqHelper.ToArray<WeaponModel>(((Model)item).GetDescendants<WeaponModel>())) { item3.Rate /= 1f + Effect(tier); } } } } public class CashInjection : ModBoostArtifact { public override string Icon => "UiEmoteIcons[MoneyBag]"; public override bool SmallIcon => true; private static float Effect(int tier) { if (1 == 0) { } float result = tier switch { 0 => 0.15f, 1 => 0.2f, 2 => 0.3f, _ => 0f, }; if (1 == 0) { } return result; } public override string Description(int tier) { return $"Starting cash increased {Effect(tier):P0}"; } public override IEnumerable<ModContent> Load() { IEnumerable<ModContent> result; if (!ModSettingBool.op_Implicit(RogueRemixMod.BoostsInShop)) { IEnumerable<ModContent> enumerable = Array.Empty<ModContent>(); result = enumerable; } else { result = ((ModContent)this).Load(); } return result; } public override void ModifyArtifactModel(BoostArtifactModel artifactModel) { } public override void OnActivated(Simulation simulation, int tier) { if (simulation.gameStarted) { return; } foreach (CashManager item in Il2CppSystemDictionaryExt.Values<int, CashManager>(simulation.CashManagers)) { item.cash.Add(item.cash.Value * (double)Effect(tier)); } } } public class CrystalBall : ModItemArtifact { public override string DescriptionCommon => "Wizard Monkeys attack 15% faster and have long range targeting within the ranges of other towers"; public override string DescriptionRare => "Wizard Monkeys attack 20% faster and have long range targeting within the ranges of other towers"; public override string DescriptionLegendary => "Wizard Monkeys attack 30% faster and have long range targeting within the ranges of other towers"; public override string Icon => "0291b9d3eef4a4f289e59a9cf63b4194"; public override bool SmallIcon => true; public override TowerSet RarityFrameType => (TowerSet)4; public override string InstaMonkey(int tier) { return TowerType.WizardMonkey; } public override int[] InstaTiers(int tier) { if (1 == 0) { } int[] result = tier switch { 2 => new int[3] { 2, 0, 0 }, 1 => new int[3] { 2, 1, 0 }, _ => new int[3] { 1, 1, 0 }, }; if (1 == 0) { } return result; } public override void ModifyArtifactModel(ItemArtifactModel artifactModel) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown int tier = ((ArtifactModelBase)artifactModel).tier; if (1 == 0) { } float num = tier switch { 0 => 0.85f, 1 => 0.8f, 2 => 0.7f, _ => 1f, }; if (1 == 0) { } ArtifactModelBehaviorExt.AddBoostBehavior(artifactModel, (BoostArtifactBehaviorModel)new RateBoostBehaviorModel("", num), (Action<BoostArtifactModel>)null); } public override void ModifyGameModel(GameModel gameModel, int tier) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Expected O, but got Unknown //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_01c1: Expected O, but got Unknown AttackFilterModel val = default(AttackFilterModel); foreach (TowerModel item in Il2CppGenericIEnumerable.AsIEnumerable<TowerModel>(gameModel.GetTowersWithBaseId(TowerType.WizardMonkey, false))) { foreach (AttackModel attackModel in TowerModelExt.GetAttackModels(item)) { if (AttackModelBehaviorExt.GetBehavior<TargetFirstPrioCamoModel>(attackModel) != null) { AttackModelBehaviorExt.RemoveBehavior<TargetFirstPrioCamoModel>(attackModel); AttackModelBehaviorExt.AddBehavior<TargetFirstSharedRangeModel>(attackModel, new TargetFirstSharedRangeModel("", true, true, false, false, false, false, "")); } if (AttackModelBehaviorExt.GetBehavior<TargetLastPrioCamoModel>(attackModel) != null) { AttackModelBehaviorExt.RemoveBehavior<TargetLastPrioCamoModel>(attackModel); AttackModelBehaviorExt.AddBehavior<TargetLastSharedRangeModel>(attackModel, new TargetLastSharedRangeModel("", true, true, false, false, false, false, "")); } if (AttackModelBehaviorExt.GetBehavior<TargetClosePrioCamoModel>(attackModel) != null) { AttackModelBehaviorExt.RemoveBehavior<TargetClosePrioCamoModel>(attackModel); AttackModelBehaviorExt.AddBehavior<TargetCloseSharedRa