using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BattleMatch; using BepInEx; using BepInEx.Logging; using Cards; using Cards.Data; using Cards.Utility; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Steamworks; using TMPro; using UnityEngine; using UnityEngine.UIElements.Collections; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("com.corgan.AtOEndless")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3+2a29923e8247db17aa5cb0e0e4e7ec417d07a2e3")] [assembly: AssemblyProduct("AtOEndless")] [assembly: AssemblyTitle("com.corgan.AtOEndless")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { 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.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.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 IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AtOEndless { [Serializable] public class AtOEndlessSaveData { public HashSet activeBlessings = new HashSet(); public void FillData() { Plugin.LogInfo("SET ACTIVE BLESSINGS: " + string.Join(", ", AtOEndless.activeBlessings)); activeBlessings = AtOEndless.activeBlessings; } public void LoadData() { AtOEndless.activeBlessings = activeBlessings; Plugin.LogInfo("GET ACTIVE BLESSINGS: " + string.Join(", ", activeBlessings)); } } public class AtOEndlessSaveManager : MonoBehaviourPunCallbacks { private PhotonView photonView; public AtOEndlessSaveData endlessData = new AtOEndlessSaveData(); public void CreateView() { photonView = PhotonView.Get((Component)(object)this); } public void SendData() { Plugin.LogInfo("SEND ACTIVE BLESSINGS: " + string.Join(", ", endlessData.activeBlessings)); photonView.RPC("SendDataCo", (RpcTarget)0, new object[1] { Functions.CompressString(JsonHelper.ToJson(endlessData.activeBlessings.ToArray())) }); } [PunRPC] public void SendDataCo(string activeBlessings) { endlessData.activeBlessings = JsonHelper.FromJson(Functions.DecompressString(activeBlessings)).ToHashSet(); Plugin.LogInfo("SENDCO ACTIVE BLESSINGS: " + string.Join(", ", endlessData.activeBlessings)); endlessData.LoadData(); } public void FillData(BinaryFormatter binaryFormatter, CryptoStream cryptoStream) { endlessData.FillData(); binaryFormatter.Serialize(cryptoStream, endlessData); if (GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.IsMaster()) { Plugin.LogInfo("SEND DATA FILL"); SendData(); } } public void LoadData(CryptoStream cryptoStream) { BinaryFormatter binaryFormatter = new BinaryFormatter(); endlessData = (AtOEndlessSaveData)binaryFormatter.Deserialize(cryptoStream); endlessData.LoadData(); if (GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.IsMaster()) { Plugin.LogInfo("SEND DATA LOAD"); SendData(); } } } [HarmonyPatch] public class AtOEndless { public static HashSet activeBlessings = new HashSet(); public static List availableBlessings = new List(); public static CardType blessingCardType = (CardType)(Enum.GetValues(typeof(CardType)).Cast().Max() + 1); public static EventActivation blessingCombatStart = (EventActivation)(Enum.GetValues(typeof(EventActivation)).Cast().Max() + 1); public static EventActivation blessingBeginRound = (EventActivation)(Enum.GetValues(typeof(EventActivation)).Cast().Max() + 2); public static AtOEndlessSaveManager EndlessSaveManager; public static bool refreshed = false; public static Dictionary portalStrings = new Dictionary { { (Zone)0, "a grassy" }, { (Zone)3, "an icy" }, { (Zone)2, "a swampy" }, { (Zone)1, "a molten" }, { (Zone)12, "a sandy" }, { (Zone)14, "a salty" }, { (Zone)4, "a cosmic" } }; public static List blessingCards = new List(21) { "armageddon", "chaoticwind", "coldfront", "deathgrip", "empower", "firecrackers", "heavenlyarmaments", "hexproof", "ironclad", "lanternfestival", "lavabursts", "livingforest", "poisonfields", "putrefaction", "rosegarden", "sacredground", "subzero", "thegrinch", "thunderstorm", "upwind", "vigorous" }; public static Dictionary> RemoveRequirementsByZone = new Dictionary> { { (Zone)0, new List(1) { "treasurehuntii" } }, { (Zone)3, new List(1) { "darkdeal" } }, { (Zone)1, new List(5) { "armblowtorch", "armchargedrod", "armcoolingengine", "armdisclauncher", "armsmallcannon" } }, { (Zone)2, new List() }, { (Zone)12, new List(3) { "ulmininportal", "ulminindown", "riftulmi61" } }, { (Zone)14, new List(6) { "sahtidown", "sahtipolizonevent", "sahtiship", "dreadroom", "dreadup", "dreadmastcannon" } }, { (Zone)4, new List() } }; public static Dictionary> AddRequirementsByZone = new Dictionary> { { (Zone)0, new List(6) { "crossroadnorth", "crossroadsouth", "caravannopay", "fungamemill", "riftsen47", "riftsen48" } }, { (Zone)3, new List(3) { "boatfaenlor", "riftfaen42", "riftfaen43" } }, { (Zone)1, new List(4) { "lavacascade", "goblinnorth", "riftvelka39", "riftvelka40" } }, { (Zone)2, new List(5) { "boatup", "boatcenter", "boatdown", "riftaqua46", "riftaqua47" } }, { (Zone)12, new List(3) { "ulmininup", "riftulmi60", "riftulmi61" } }, { (Zone)14, new List(6) { "sahtiup", "dreaddown", "sahtipirateking", "sahtipolizon", "riftsahti67", "riftsahti68" } }, { (Zone)4, new List(4) { "voidnorth", "voidnorthpass", "voidsouth", "voidsouthpass" } } }; public static string[] zoneStartNodes = new string[7] { "sen_0", "faen_0", "aqua_0", "velka_0", "ulmin_0", "sahti_0", "voidlow_0" }; private static CardDataNew GetCardSource(CardRealtimeData cardData) { if (!(cardData == (CardRealtimeData)null)) { return Traverse.Create((object)cardData).Field("card").Value; } return null; } private static void SetCardSourceField(CardDataNew cardData, string fieldName, T value) { Traverse.Create((object)cardData).Field(fieldName).SetValue((object)value); } private static CardRealtimeData CreateRuntimeCard(CardDataNew cardData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown CardRealtimeData val = new CardRealtimeData(cardData, cardData.Id); val.PostInit(); return val; } private static Hero[] GetTeamHeroes() { Hero[] array = (Hero[])(object)new Hero[4]; for (int i = 0; i < array.Length; i++) { array[i] = AtOManager.Instance.team.GetHero(i); } return array; } private static Hero[] GetMatchHeroes() { Hero[] array = (Hero[])(object)new Hero[4]; Team value = Traverse.Create((object)MatchManager.Instance).Property("TeamHero", (object[])null).Value; for (int i = 0; i < array.Length; i++) { if (value == null) { break; } if (i >= value.Count) { break; } ref Hero reference = ref array[i]; Character obj = value[i]; reference = (Hero)(object)((obj is Hero) ? obj : null); } return array; } private static NPC[] GetMatchNPCs() { NPC[] array = (NPC[])(object)new NPC[4]; Team value = Traverse.Create((object)MatchManager.Instance).Property("TeamNPC", (object[])null).Value; for (int i = 0; i < array.Length; i++) { if (value == null) { break; } if (i >= value.Count) { break; } ref NPC reference = ref array[i]; Character obj = value[i]; reference = (NPC)(object)((obj is NPC) ? obj : null); } return array; } private static int GetRandomIntRange(int min, int max) { return MatchManager.Instance.Random.GetRandomIntRange(min, max, "items", ""); } private static void DisableKillPet(CardRealtimeData cardData) { CardDataNew cardSource = GetCardSource(cardData); if (((cardSource != null) ? cardSource.PetData : null) != null) { cardSource.PetData.KillPet = false; } } public static CardDataNew GetRandomBlessing(List ignore = null) { List list = availableBlessings.ToList(); foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, false); cardData = Functions.GetCardDataFromCardData(cardData, ""); if (cardData != (CardRealtimeData)null && list.Contains(cardData.Id)) { Plugin.LogInfo("Active Blessing: " + cardData.Id); list.Remove(cardData.Id); } } if (ignore != null) { foreach (string item in ignore) { CardRealtimeData cardData2 = Globals.Instance.GetCardData(item, false); cardData2 = Functions.GetCardDataFromCardData(cardData2, ""); if (cardData2 != (CardRealtimeData)null && list.Contains(cardData2.Id)) { Plugin.LogInfo("Ignore Blessing: " + cardData2.Id); list.Remove(cardData2.Id); } } } Plugin.LogInfo($"Blessing Cards: {list.Count}"); if (list.Count > 0) { int num = Random.Range(0, list.Count); string text = list[num]; Plugin.LogInfo($"Random Corruption Index: {num} - {text}"); CardRealtimeData val = Globals.Instance.GetCardData(text, false); if (AtOManager.Instance.GetTownTier() == 0) { val = Functions.GetCardDataFromCardData(val, ""); if (val != (CardRealtimeData)null) { text = val.Id; } } if (AtOManager.Instance.GetTownTier() >= 1) { val = Functions.GetCardDataFromCardData(val, "A"); if (val != (CardRealtimeData)null) { text = val.Id; } } if (AtOManager.Instance.GetTownTier() >= 2) { val = Functions.GetCardDataFromCardData(val, "B"); if (val != (CardRealtimeData)null) { text = val.Id; } } if (AtOManager.Instance.GetTownTier() >= 3) { val = Functions.GetCardDataFromCardData(val, "RARE"); if (val != (CardRealtimeData)null) { text = val.Id; } } if (val == (CardRealtimeData)null) { val = Globals.Instance.GetCardData(text, false); } Plugin.LogInfo("Got Corruption Card: " + val.Id); return GetCardSource(val); } return null; } public static void BeginMatchBlessings() { Plugin.LogInfo("BEGIN MATCH BLESSINGS " + string.Join(", ", activeBlessings)); Hero[] matchHeroes = GetMatchHeroes(); Plugin.LogInfo($"Got Heroes: {matchHeroes.Length}"); NPC[] matchNPCs = GetMatchNPCs(); Plugin.LogInfo($"Got NPCs: {matchNPCs.Length}"); foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = MatchManager.Instance.GetCardData(activeBlessing, true); Plugin.LogInfo("Got Blessing Data for " + cardData.Id); } } public static void CombatStartBlessings() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) Plugin.LogInfo("COMBAT START BLESSINGS " + string.Join(", ", activeBlessings)); foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = MatchManager.Instance.GetCardData(activeBlessing, true); if (!((Object)(object)cardData.Item != (Object)null) || cardData.Item.Activation != blessingCombatStart) { continue; } cardData.EnergyCost = 0; cardData.Vanish = true; SetCardSourceField(GetCardSource(cardData), "cardClass", (CardClass)7); MatchManager.Instance.GenerateNewCard(1, activeBlessing, false, (CardPlace)4, (CardRealtimeData)null, (CardRealtimeData)null, -1, true, 0, (CopyConfig)null); Hero[] matchHeroes = GetMatchHeroes(); for (int i = 0; i < 4; i++) { if (matchHeroes[i] != null && ((Character)matchHeroes[i]).Alive) { ((Character)matchHeroes[i]).DoItem(blessingCombatStart, cardData, cardData.Item.Id, (Character)null, 0, "", 0, (CardRealtimeData)null, false); break; } } } } public static void BeginRoundBlessings() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Invalid comparison between Unknown and I4 //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Invalid comparison between Unknown and I4 //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Invalid comparison between Unknown and I4 //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Invalid comparison between Unknown and I4 //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Invalid comparison between Unknown and I4 //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Invalid comparison between Unknown and I4 //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) Plugin.LogInfo("BEGIN ROUND BLESSINGS " + string.Join(", ", activeBlessings)); foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = MatchManager.Instance.GetCardData(activeBlessing, true); if (!((Object)(object)cardData.Item != (Object)null) || cardData.Item.Activation != blessingBeginRound) { continue; } Hero[] matchHeroes = GetMatchHeroes(); NPC[] matchNPCs = GetMatchNPCs(); Plugin.LogInfo($"{activeBlessing} - BEGIN ROUND - {cardData.Item.ItemTarget}"); if ((int)cardData.Item.ItemTarget == 3) { for (int i = 0; i < 4; i++) { if (matchHeroes[i] != null && ((Character)matchHeroes[i]).Alive) { ((Character)matchHeroes[i]).DoItem(blessingBeginRound, cardData, cardData.Item.Id, (Character)null, 0, "", 0, (CardRealtimeData)null, false); break; } } } else if ((int)cardData.Item.ItemTarget == 1 || (int)cardData.Item.ItemTarget == 0) { if ((int)cardData.Item.ItemTarget == 0) { for (int j = 0; j < 4; j++) { if (matchHeroes[j] != null && ((Character)matchHeroes[j]).Alive) { ((Character)matchHeroes[j]).DoItem(blessingBeginRound, cardData, cardData.Item.Id, (Character)null, 0, "", 0, (CardRealtimeData)null, false); } } continue; } bool flag = false; while (!flag) { int randomIntRange = GetRandomIntRange(0, 4); if (matchHeroes[randomIntRange] != null && ((Character)matchHeroes[randomIntRange]).Alive) { ((Character)matchHeroes[randomIntRange]).DoItem(blessingBeginRound, cardData, cardData.Item.Id, (Character)null, 0, "", 0, (CardRealtimeData)null, false); flag = true; } } } else if ((int)cardData.Item.ItemTarget == 4) { for (int k = 0; k < 4; k++) { if (matchNPCs[k] != null && ((Character)matchNPCs[k]).Alive) { ((Character)matchNPCs[k]).DoItem(blessingBeginRound, cardData, cardData.Item.Id, (Character)null, 0, "", 0, (CardRealtimeData)null, false); break; } } } else { if ((int)cardData.Item.ItemTarget != 2 && (int)cardData.Item.ItemTarget != 6) { continue; } if ((int)cardData.Item.ItemTarget == 6) { for (int l = 0; l < 4; l++) { if (matchNPCs[l] != null && ((Character)matchNPCs[l]).Alive) { ((Character)matchNPCs[l]).DoItem(blessingBeginRound, cardData, cardData.Item.Id, (Character)null, 0, "", 0, (CardRealtimeData)null, false); } } continue; } bool flag2 = false; while (!flag2) { int randomIntRange2 = GetRandomIntRange(0, 4); if (matchNPCs[randomIntRange2] != null && ((Character)matchNPCs[randomIntRange2]).Alive) { ((Character)matchNPCs[randomIntRange2]).DoItem(blessingBeginRound, cardData, cardData.Item.Id, (Character)null, 0, "", 0, (CardRealtimeData)null, false); flag2 = true; } } } } } [HarmonyPostfix] [HarmonyPatch(typeof(Enum), "GetName")] public static void GetName(Type enumType, object value, ref string __result) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (enumType == typeof(CardType) && (CardType)value == blessingCardType) { __result = "Blessing"; } } [HarmonyPostfix] [HarmonyPatch(typeof(ItemCombatIcon), "DoHover")] public static void DoHover(ItemCombatIcon __instance, bool state, ref CardRealtimeData ___cardData) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!(___cardData == (CardRealtimeData)null) && ___cardData.CardType == blessingCardType) { ((Component)__instance.spriteBackgroundHover).gameObject.SetActive(true); } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "ActivateItem")] public static void ActivateItem(ref Character __instance, EventActivation theEvent, Character target, int auxInt, string auxString, ref bool ___isHero, ref Item ___itemClass, ref CardRealtimeData ___cardCasted) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Invalid comparison between Unknown and I4 //IL_0165: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)MatchManager.Instance == (Object)null) { return; } int num = -1; foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = MatchManager.Instance.GetCardData(activeBlessing, true); if (!(cardData != (CardRealtimeData)null)) { continue; } ItemData val = null; if ((Object)(object)cardData.Item != (Object)null) { val = cardData.Item; } else if ((Object)(object)cardData.ItemEnchantment != (Object)null) { val = cardData.ItemEnchantment; } if (!((Object)(object)val != (Object)null) || (val.ActivationOnlyOnHeroes && ___isHero) || (val.Activation != theEvent && ((int)val.Activation != 20 || (int)theEvent != 29))) { continue; } if (Globals.Instance.ShowDebug) { Functions.DebugLogGD("[Character/ActivateItem] Checking if " + activeBlessing + " will activate", "item"); } Plugin.LogInfo($"{theEvent} - {cardData.Id} - {__instance.HeroIndex} - {val.ItemTarget}"); if (___itemClass.DoItem(theEvent, cardData, activeBlessing, __instance, target, auxInt, auxString, 0, ___cardCasted, true, false)) { num++; if (Globals.Instance.ShowDebug) { Functions.DebugLogGD("[Character/ActivateItem] " + activeBlessing + "-> OK", "item"); } MatchManager.Instance.DoItem(__instance, theEvent, cardData, activeBlessing, target, auxInt, auxString, num, false); } else if (Globals.Instance.ShowDebug) { Functions.DebugLogGD(activeBlessing + " -> XXXXXX", "item"); } } } [HarmonyPostfix] [HarmonyPatch(typeof(InitiativesManager), "SetInitiatives")] public static void SetInitiativesPostfix() { BeginMatchBlessings(); } [HarmonyTranspiler] [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static IEnumerable NextTurnContinue_Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, generator); val.MatchStartForward((CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(MatchManager), "corruptionItem"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldnull, (object)null, (string)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(AtOEndless), "CombatStartBlessings", (Type[])null, (Type[])null)) }).Advance(4) .MatchStartForward((CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(MatchManager), "corruptionItem"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldnull, (object)null, (string)null) }) .InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(AtOEndless), "BeginRoundBlessings", (Type[])null, (Type[])null)) }); return val.InstructionEnumeration(); } [HarmonyPrefix] [HarmonyPatch(typeof(Node), "OnMouseUp")] public static void OnMouseUp(ref Node __instance) { if (Functions.ClickedThisTransform(((Component)__instance).transform) && !AlertManager.Instance.IsActive() && !GameManager.Instance.IsTutorialActive() && !SettingsManager.Instance.IsActive() && !DamageMeterManager.Instance.IsActive() && (!Object.op_Implicit((Object)(object)MapManager.Instance) || !MapManager.Instance.IsCharacterUnlock()) && (!Object.op_Implicit((Object)(object)MapManager.Instance) || (!MapManager.Instance.IsCorruptionOver() && !MapManager.Instance.IsConflictOver())) && (!Object.op_Implicit((Object)(object)MapManager.Instance) || !MapManager.Instance.selectedNode) && !Object.op_Implicit((Object)(object)EventManager.Instance) && ((object)Unsafe.As(ref SteamManager.Instance.steamId)/*cast due to .constrained prefix*/).ToString() == "76561197965495526") { GameManager.Instance.SetCursorPlain(); MapManager.Instance.HidePopup(); MapManager.Instance.PlayerSelectedNode(__instance, false); GameManager.Instance.PlayAudio(AudioManager.Instance.soundButtonClick, 0f, 0f); } } [HarmonyPrefix] [HarmonyPatch(typeof(Functions), "DebugLogGD")] public static bool DebugLogGD(string str, string type) { StringBuilder stringBuilder = new StringBuilder(); if (type != "") { stringBuilder.Append("["); stringBuilder.Append(type.ToUpper()); stringBuilder.Append("] "); } stringBuilder.Append(str); Plugin.LogInfo(stringBuilder.ToString()); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(AtOManager), "BeginAdventure")] public static void BeginAdventure(ref AtOManager __instance) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { activeBlessings = new HashSet(); } } [HarmonyPrefix] [HarmonyPatch(typeof(MatchManager), "FinishLoadTurnData")] public static void FinishLoadTurnData(ref MatchManager __instance) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge()) { return; } List list = new List(); int num = 0; foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, false); ItemCombatIcon val = Object.Instantiate(__instance.iconCorruption, ((Component)__instance.iconCorruption).transform.parent); ((Object)((Component)val).gameObject).name = "CorruptionIcon"; float num2 = ((Component)val).transform.localPosition.x - 3f - 0.7f * (float)(num % 6); float num3 = ((Component)val).transform.localPosition.y - 0.7f * (float)Mathf.FloorToInt((float)(num / 6)); ((Component)val).transform.localPosition = new Vector3(num2, num3, ((Component)val).transform.localPosition.z + 3f); Plugin.LogInfo("GAME OBJECT " + ((Object)((Component)val).gameObject).name); list.Add(val); num++; if (cardData != (CardRealtimeData)null) { ((Component)((Component)val).transform).gameObject.SetActive(true); val.ShowIconCorruption(cardData); Plugin.LogInfo("CARD ID " + cardData.Id); } else { ((Component)((Component)val).transform).gameObject.SetActive(false); } } } [HarmonyPrefix] [HarmonyPatch(typeof(CardDescriptionExtension), "SetDescriptionNew")] public static void SetDescriptionNewPre(CardRealtimeData data, bool forceDescription, Character character, bool includeInSearch, out EventActivation __state) { //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_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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected I4, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected I4, but got Unknown __state = (EventActivation)0; if (data.CardType == blessingCardType && (Object)(object)data.Item != (Object)null) { if (data.Item.Activation == blessingBeginRound) { __state = (EventActivation)(int)data.Item.Activation; data.Item.Activation = (EventActivation)2; } if (data.Item.Activation == blessingCombatStart) { __state = (EventActivation)(int)data.Item.Activation; data.Item.Activation = (EventActivation)1; } } } [HarmonyPostfix] [HarmonyPatch(typeof(CardDescriptionExtension), "SetDescriptionNew")] public static void SetDescriptionNewPost(CardRealtimeData data, bool forceDescription, Character character, bool includeInSearch, EventActivation __state) { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (data.CardType == blessingCardType && (Object)(object)data.Item != (Object)null && (int)__state != 0) { data.Item.Activation = __state; } } [HarmonyPostfix] [HarmonyPatch(typeof(SaveManager), "SaveGame")] public static void SaveGame(int slot, bool backUp) { try { string endlessSavePath = GetEndlessSavePath(slot); Directory.CreateDirectory(Path.GetDirectoryName(endlessSavePath)); if (backUp && File.Exists(endlessSavePath)) { File.Copy(endlessSavePath, endlessSavePath + ".bak", overwrite: true); } EndlessSaveManager.endlessData.FillData(); File.WriteAllText(endlessSavePath, JsonHelper.ToJson(EndlessSaveManager.endlessData.activeBlessings.ToArray())); if (GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.IsMaster()) { EndlessSaveManager.SendData(); } } catch (Exception ex) { Plugin.LogInfo("Failed to save AtOEndless Data"); Plugin.LogInfo("Reason: " + ex.Message + " " + ex.StackTrace); } } [HarmonyPostfix] [HarmonyPatch(typeof(SaveManager), "LoadGame")] public static void LoadGame(int slot, bool comingFromReloadCombat) { string endlessSavePath = GetEndlessSavePath(slot); if (!File.Exists(endlessSavePath)) { Plugin.LogInfo("No AtOEndless save file exists"); return; } try { string text = File.ReadAllText(endlessSavePath); EndlessSaveManager.endlessData.activeBlessings = JsonHelper.FromJson(text).ToHashSet(); EndlessSaveManager.endlessData.LoadData(); if (GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.IsMaster()) { EndlessSaveManager.SendData(); } } catch (Exception ex) { Plugin.LogInfo("Failed to load AtOEndless Data. Reason: " + ex.Message); } } private static string GetEndlessSavePath(int slot) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) return Path.Combine(Application.persistentDataPath, SteamId.op_Implicit(SteamManager.Instance.steamId).ToString(), GameManager.Instance.ProfileFolder, $"AtOEndless_save_slot_{slot}.json"); } [HarmonyPostfix] [HarmonyPatch(typeof(SaveManager), "DeleteGame")] public static void DeleteGame(int slot, bool sendTelemetry) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) string value = Traverse.Create(typeof(SaveManager)).Field("saveGameExtension").GetValue(); string value2 = Traverse.Create(typeof(SaveManager)).Field("saveGameExtensionBK").GetValue(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(Application.persistentDataPath); stringBuilder.Append("/"); stringBuilder.Append(SteamId.op_Implicit(SteamManager.Instance.steamId)); stringBuilder.Append("/"); stringBuilder.Append(GameManager.Instance.ProfileFolder); stringBuilder.Append("endless_"); stringBuilder.Append(slot); string path = stringBuilder.ToString() + value; string path2 = stringBuilder.ToString() + value2; if (File.Exists(path)) { File.Delete(path); } if (File.Exists(path2)) { File.Delete(path2); } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "LevelUp")] public static void LevelUp(Character __instance, HeroData ___heroData) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_additional_levels"), "") && ___heroData.HeroSubClass.MaxHp.Length < 9) { int[] array = new int[9]; ___heroData.HeroSubClass.MaxHp.CopyTo(array, 4); ___heroData.HeroSubClass.MaxHp.CopyTo(array, 0); ___heroData.HeroSubClass.MaxHp = array; } } [HarmonyPostfix] [HarmonyPatch(typeof(SubClassData), "GetTraitLevel")] public static void GetTraitLevel(SubClassData __instance, string traitName, ref int __result) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_additional_levels"), "")) { Hero val = (from hero in GetTeamHeroes() where ((Character)hero).SubclassName.ToLower() == __instance.SubClassName.ToLower() select hero).First(); if (((Character)val).Traits.Length < 9) { string[] array = new string[9]; ((Character)val).Traits.CopyTo(array, 0); ((Character)val).Traits = array; } if (((Character)val).Traits[__result] != null && ((Character)val).Traits[__result] != "" && ((Character)val).Traits[__result] != traitName) { __result += 4; } Plugin.LogInfo($"GetTraitLevel: {__result} - {((Character)val).Traits.Length} - {((Character)val).Traits[__result]}"); string[] traits = ((Character)val).Traits; foreach (string text in traits) { Plugin.LogInfo("GetTraitLevel: " + text); } } } [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(CharacterWindowUI), "GetTraitData")] public static TraitData GetTraitData(CharacterWindowUI __instance, int level, int index) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown return new TraitData(); } [HarmonyPostfix] [HarmonyPatch(typeof(CharacterWindowUI), "DrawLevelButtons")] public static void DrawLevelButtons(ref CharacterWindowUI __instance, int heroLevel, bool levelUp, ref Hero ___currentHero, ref SubClassData ___currentSCD) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || !AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_additional_levels"), "")) { return; } string color = Globals.Instance.ClassColor[((Character)___currentHero).ClassName]; int characterTier = PlayerManager.Instance.GetCharacterTier("", "trait", ((Character)___currentHero).PerkRank); for (int i = 1; i < 5; i++) { bool active = false; bool enable = false; int num = i * 2; int num2 = num + 1; TraitData traitData = GetTraitData(__instance, i, 0); if (((Character)___currentHero).HaveTrait(traitData.Id)) { enable = true; } else if ((i == heroLevel || i + 4 == heroLevel) && levelUp && (((Character)___currentHero).Owner == null || ((Character)___currentHero).Owner == "" || ((Character)___currentHero).Owner == NetworkManager.Instance.GetPlayerNick()) && !((Character)___currentHero).HaveTrait(traitData.Id)) { active = true; } __instance.traitLevel[num].SetHeroIndex(__instance.heroIndex); __instance.traitLevel[num].SetColor(color); __instance.traitLevel[num].SetPosition(1); __instance.traitLevel[num].SetEnable(enable); __instance.traitLevel[num].SetActive(active); __instance.traitLevel[num].SetTrait(traitData, characterTier); TraitData traitData2 = GetTraitData(__instance, i, 1); bool enable2 = false; bool active2 = false; if (((Character)___currentHero).HaveTrait(traitData2.Id)) { enable2 = true; } else if ((i == heroLevel || i + 4 == heroLevel) && levelUp && (((Character)___currentHero).Owner == null || ((Character)___currentHero).Owner == "" || ((Character)___currentHero).Owner == NetworkManager.Instance.GetPlayerNick()) && !((Character)___currentHero).HaveTrait(traitData2.Id)) { active2 = true; } __instance.traitLevel[num2].SetHeroIndex(__instance.heroIndex); __instance.traitLevel[num2].SetColor(color); __instance.traitLevel[num2].SetPosition(2); __instance.traitLevel[num2].SetEnable(enable2); __instance.traitLevel[num2].SetActive(active2); __instance.traitLevel[num2].SetTrait(traitData2, characterTier); StringBuilder stringBuilder = new StringBuilder(); bool flag = false; if ((i < heroLevel || ((i == heroLevel || i + 4 == heroLevel) && levelUp)) && (((Character)___currentHero).Owner == null || ((Character)___currentHero).Owner == "" || ((Character)___currentHero).Owner == NetworkManager.Instance.GetPlayerNick())) { flag = true; } stringBuilder.Append(""); if (flag) { stringBuilder.Append(""); } stringBuilder.Append(Texts.Instance.GetText("levelNumber", "").Replace("", $"{i + 1}&{i + 5}")); if (flag) { stringBuilder.Append(""); } stringBuilder.Append(""); stringBuilder.Append("\n"); if (flag) { stringBuilder.Append(""); } stringBuilder.Append(Texts.Instance.GetText("incrementMaxHp", "").Replace("", ___currentSCD.MaxHp[i].ToString())); if (flag) { stringBuilder.Append(""); } __instance.traitLevelText[i].text = stringBuilder.ToString(); } } [HarmonyPrefix] [HarmonyPatch(typeof(Node), "AssignNode")] public static void AssignNodePre(ref AtOManager __instance, out string[][] __state) { __state = new string[2][] { AtOManager.Instance.mapVisitedNodes.ToArray(), AtOManager.Instance.mapVisitedNodesAction.ToArray() }; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { AtOManager.Instance.mapVisitedNodes.Clear(); AtOManager.Instance.mapVisitedNodesAction.Clear(); } } [HarmonyPostfix] [HarmonyPatch(typeof(Node), "AssignNode")] public static void AssignNodePost(ref Node __instance, string[][] __state) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { AtOManager.Instance.mapVisitedNodes.AddRange(new <>z__ReadOnlyArray(__state[0].ToArray())); AtOManager.Instance.mapVisitedNodesAction.AddRange(new <>z__ReadOnlyArray(__state[1].ToArray())); } } [HarmonyPostfix] [HarmonyPatch(typeof(AtOManager), "GetTownTier")] public static void GetTownTier(ref AtOManager __instance, ref int ___townTier, ref int __result) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { __result = Math.Min(___townTier, 3); } } [HarmonyPostfix] [HarmonyPatch(typeof(AtOManager), "GetActNumberForText")] public static void GetActNumberForText(ref AtOManager __instance, ref int ___townTier, ref int __result) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { __result = ___townTier + 1; } } [HarmonyPrefix] [HarmonyPatch(typeof(MapManager), "Awake")] public static void Awake(ref MapManager __instance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown if (refreshed) { return; } foreach (GameObject map in __instance.mapList) { foreach (Transform item in map.transform) { Transform val = item; if (!(((Object)((Component)val).gameObject).name == "Nodes")) { continue; } foreach (Transform item2 in val) { Transform val2 = item2; Node component = ((Component)val2).gameObject.GetComponent(); if ((Object)(object)((Component)component).GetComponent().nodeData != (Object)null) { ((Component)component).GetComponent().nodeData = Globals.Instance.GetNodeData(component.nodeData.NodeId); } else { Plugin.LogInfo("No Node Data for " + ((Object)((Component)val2).gameObject).name); } } } } refreshed = true; } [HarmonyPostfix] [HarmonyPatch(typeof(NetworkManager), "Awake")] public static void NetworkManagerAwake(ref NetworkManager __instance) { EndlessSaveManager = ((Component)NetworkManager.Instance).gameObject.AddComponent(); EndlessSaveManager.CreateView(); } public static string[] GetEnabledPerks() { List list = new List(); foreach (List value in AtOManager.Instance.PerksManager.heroPerks.Values) { foreach (string item in value) { if (item.StartsWith("endless_") && !list.Contains(item)) { list.Add(item); } } } return list.ToArray(); } public static string GetRandomPerkDescription(PerkData perkData) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Invalid comparison between Unknown and I4 //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Invalid comparison between Unknown and I4 //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Invalid comparison between Unknown and I4 //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Invalid comparison between Unknown and I4 //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_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) StringBuilder stringBuilder = new StringBuilder(); if (perkData.MaxHealth != 0) { stringBuilder.Append($"Health {perkData.MaxHealth:+#;-#;0}"); } if (perkData.SpeedQuantity != 0) { stringBuilder.Append($"Speed {perkData.SpeedQuantity:+#;-#;0}"); } if ((Object)(object)perkData.AuracurseBonus != (Object)null && perkData.AuracurseBonusValue != 0) { stringBuilder.Append($"charges {perkData.AuracurseBonusValue:+#;-#;0}"); } if (perkData.ResistModifiedValue != 0) { if ((int)perkData.ResistModified == 10) { stringBuilder.Append($"All resistances {perkData.ResistModifiedValue:+#;-#;0}%"); } if ((int)perkData.ResistModified != 10) { string text = ((object)perkData.ResistModified/*cast due to .constrained prefix*/).ToString().ToLower(); if (text == "slashing") { text = "slash"; } stringBuilder.Append($"resistance {perkData.ResistModifiedValue:+#;-#;0}%"); } } if (perkData.DamageFlatBonusValue != 0) { if ((int)perkData.DamageFlatBonus == 10) { stringBuilder.Append($"All damage {perkData.DamageFlatBonusValue:+#;-#;0}"); } if ((int)perkData.DamageFlatBonus != 10) { string text2 = ((object)perkData.DamageFlatBonus/*cast due to .constrained prefix*/).ToString().ToLower(); if (text2 == "slashing") { text2 = "slash"; } stringBuilder.Append($"damage {perkData.DamageFlatBonusValue:+#;-#;0}"); } } stringBuilder.Replace("", ""); stringBuilder.Replace("", ""); return $"{stringBuilder}"; } public static string GetRandomPerkType(string[] exclude) { string[] array = new string[5] { "h", "a", "d", "r", "s" }.Where((string v) => !exclude.Contains(v)).ToArray(); return array[Random.Range(0, array.Length)]; } public unsafe static string GetRandomPerkSubtype(string type) { switch (type) { case "a": { string[] array2 = new string[16] { "bleed", "block", "burn", "chill", "dark", "fury", "insane", "poison", "regeneration", "sharp", "shield", "sight", "spark", "thorns", "vitality", "wet" }; return array2[Random.Range(0, array2.Length)]; } case "d": case "r": { DamageType[] array = (from DamageType d in Enum.GetValues(typeof(DamageType)) where !((object)(*(DamageType*)(&d))/*cast due to .constrained prefix*/).Equals((object)(DamageType)0) select d).ToArray(); return ((object)Unsafe.As(ref array[Random.Range(0, array.Length)])/*cast due to .constrained prefix*/).ToString().ToLower(); } default: return ""; } } public static int GetRandomPerkValue(string type, string subtype = "") { int num = 0; int num2 = 0; if (type == "h") { num2 = 5; num = 15; } if (type == "a") { num2 = 1; num = 2; } if (type == "s") { num2 = 1; num = 2; } if (type == "d") { num2 = 1; num = 3; } if (type == "r") { num2 = 5; num = 10; } return Random.Range(num2, num); } [HarmonyPrefix] [HarmonyPatch(typeof(EventManager), "SetEvent")] public static void SetEvent(ref EventManager __instance, EventData _eventData) { //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0775: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Invalid comparison between Unknown and I4 //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Invalid comparison between Unknown and I4 //IL_08b5: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Invalid comparison between Unknown and I4 //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Invalid comparison between Unknown and I4 //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_08f3: Invalid comparison between Unknown and I4 //IL_0a7d: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_0627: Invalid comparison between Unknown and I4 //IL_0aa4: Unknown result type (might be due to invalid IL or missing references) //IL_0aa7: Invalid comparison between Unknown and I4 //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Invalid comparison between Unknown and I4 //IL_092c: Unknown result type (might be due to invalid IL or missing references) //IL_092f: Invalid comparison between Unknown and I4 //IL_0acc: Unknown result type (might be due to invalid IL or missing references) //IL_0acf: Invalid comparison between Unknown and I4 //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Invalid comparison between Unknown and I4 //IL_0af1: Unknown result type (might be due to invalid IL or missing references) //IL_0af4: Invalid comparison between Unknown and I4 //IL_0968: Unknown result type (might be due to invalid IL or missing references) //IL_096b: Invalid comparison between Unknown and I4 //IL_0b1a: Unknown result type (might be due to invalid IL or missing references) //IL_0b1e: Invalid comparison between Unknown and I4 //IL_09a4: Unknown result type (might be due to invalid IL or missing references) //IL_09a8: Invalid comparison between Unknown and I4 //IL_0b44: Unknown result type (might be due to invalid IL or missing references) //IL_0b48: Invalid comparison between Unknown and I4 //IL_0c30: Unknown result type (might be due to invalid IL or missing references) //IL_09e1: Unknown result type (might be due to invalid IL or missing references) //IL_09e5: Invalid comparison between Unknown and I4 //IL_0d13: Unknown result type (might be due to invalid IL or missing references) //IL_0c4f: Unknown result type (might be due to invalid IL or missing references) //IL_0c52: Invalid comparison between Unknown and I4 //IL_0c6f: Unknown result type (might be due to invalid IL or missing references) //IL_0c72: Invalid comparison between Unknown and I4 //IL_0a1e: Unknown result type (might be due to invalid IL or missing references) //IL_0a21: Invalid comparison between Unknown and I4 //IL_0c8c: Unknown result type (might be due to invalid IL or missing references) //IL_0c8f: Invalid comparison between Unknown and I4 //IL_0ca9: Unknown result type (might be due to invalid IL or missing references) //IL_0cad: Invalid comparison between Unknown and I4 //IL_0cc7: Unknown result type (might be due to invalid IL or missing references) //IL_0ccb: Invalid comparison between Unknown and I4 //IL_0ce5: Unknown result type (might be due to invalid IL or missing references) //IL_0ce8: Invalid comparison between Unknown and I4 if (_eventData.EventId == "e_endless_perk") { EventReplyData val = Globals.Instance.GetEventData("e_challenge_next").Replys.First(); Random.InitState(Functions.GetDeterministicHashCode(AtOManager.Instance.GetGameId())); List list = new List(); for (int i = 0; i < 5; i++) { EventReplyData val2 = val.ShallowCopy(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("endless_"); List list2 = new List(); for (int j = 0; j < 2; j++) { string randomPerkType = GetRandomPerkType(list2.ToArray()); list2.Add(randomPerkType); string randomPerkSubtype = GetRandomPerkSubtype(randomPerkType); int randomPerkValue = GetRandomPerkValue(randomPerkType, randomPerkSubtype); stringBuilder.Append(randomPerkType + ":"); if (randomPerkSubtype != "") { stringBuilder.Append(randomPerkSubtype + "#" + randomPerkType + "v:"); } stringBuilder.Append($"{randomPerkValue}#"); } stringBuilder.Length--; stringBuilder.Append("_" + Functions.RandomString(6f, 0f)); val2.SsPerkData = Globals.Instance.GetPerkData(stringBuilder.ToString()); val2.SsPerkData1 = null; val2.ReplyText = GetRandomPerkDescription(val2.SsPerkData); val2.SsRewardText = ""; val2.SsRequirementUnlock = null; val2.SsDustReward = 0; val2.SsExperienceReward = 0; val2.SsGoldReward = 0; val2.SsFinishObeliskMap = false; val2.SsEvent = (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_pick_blessing"), "") ? Globals.Instance.GetEventData("e_endless_blessing") : Globals.Instance.GetEventData("e_endless_obelisk")); list.Add(val2); } Globals.Instance.GetEventData("e_endless_perk").Replys = list.ToArray(); } if (_eventData.EventId == "e_endless_blessing") { EventReplyData val3 = Globals.Instance.GetEventData("e_challenge_next").Replys.First(); Random.InitState(Functions.GetDeterministicHashCode(AtOManager.Instance.GetGameId())); List list3 = new List(); List list4 = new List(); for (int k = 0; k < 3; k++) { CardDataNew randomBlessing = GetRandomBlessing(list4); if ((Object)(object)randomBlessing != (Object)null) { list4.Add(randomBlessing.Id); EventReplyData val4 = val3.ShallowCopy(); val4.SsPerkData = null; val4.SsPerkData1 = null; val4.SsAddCards = new List(1) { randomBlessing }; val4.ReplyShowCard = randomBlessing; val4.ReplyText = randomBlessing.CardName; val4.SsRewardText = ""; val4.SsRequirementUnlock = null; val4.SsDustReward = 0; val4.SsExperienceReward = 0; val4.SsGoldReward = 0; val4.SsFinishObeliskMap = false; val4.SsEvent = Globals.Instance.GetEventData("e_endless_obelisk"); list3.Add(val4); } } EventReplyData val5 = val3.ShallowCopy(); val5.SsPerkData = null; val5.SsPerkData1 = null; val5.ReplyText = ((list3.Count == 0) ? "There are no more blessings to choose from." : "Skip"); val5.SsRewardText = ""; val5.SsRequirementUnlock = null; val5.SsDustReward = 0; val5.SsExperienceReward = 0; val5.SsGoldReward = 0; val5.SsFinishObeliskMap = false; val5.SsEvent = Globals.Instance.GetEventData("e_endless_obelisk"); list3.Add(val5); Globals.Instance.GetEventData("e_endless_blessing").Replys = list3.ToArray(); } if (!(_eventData.EventId == "e_endless_obelisk")) { return; } EventReplyData val6 = Globals.Instance.GetEventData("e_sen34_a").Replys.First(); Zone mapZone = AtOManager.Instance.GetMapZone(AtOManager.Instance.currentMapNode); Random.InitState(Functions.GetDeterministicHashCode(AtOManager.Instance.GetGameId())); bool flag = SteamManager.Instance.PlayerHaveDLC("2511580") || (GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.AnyPlayersHaveSku("2511580")); bool flag2 = SteamManager.Instance.PlayerHaveDLC("3185630") || (GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.AnyPlayersHaveSku("3185630")); List list5 = new List(); list5.Add(Globals.Instance.GetNodeData("sen_0")); list5.Add(Globals.Instance.GetNodeData("faen_0")); list5.Add(Globals.Instance.GetNodeData("aqua_0")); list5.Add(Globals.Instance.GetNodeData("velka_0")); if (flag) { list5.Add(Globals.Instance.GetNodeData("ulmin_0")); } if (flag2) { list5.Add(Globals.Instance.GetNodeData("sahti_0")); } list5.Add(Globals.Instance.GetNodeData("voidlow_0")); bool flag3 = false; if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_unique_zones"), "") && (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_sen"), "") || (int)mapZone == 0) && (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_faen"), "") || (int)mapZone == 3) && (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_aqua"), "") || (int)mapZone == 2) && (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_velka"), "") || (int)mapZone == 1) && (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_ulmin"), "") || (int)mapZone == 12) && (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_sahti"), "") || (int)mapZone == 14) && (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_void"), "") || (int)mapZone == 5)) { AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_sen"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_faen"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_aqua"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_velka"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_ulmin"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_sahti"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_void"), ""); flag3 = true; } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_require_all_before_void"), "") && (int)mapZone == 5) { AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_sen"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_faen"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_aqua"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_velka"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_ulmin"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_sahti"), ""); AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_complete_void"), ""); flag3 = true; } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_unique_zones"), "") || !AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_repeats"), "")) { if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_sen"), "") || (int)mapZone == 0) { list5.Remove(Globals.Instance.GetNodeData("sen_0")); } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_faen"), "") || (int)mapZone == 3) { list5.Remove(Globals.Instance.GetNodeData("faen_0")); } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_aqua"), "") || (int)mapZone == 2) { list5.Remove(Globals.Instance.GetNodeData("aqua_0")); } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_velka"), "") || (int)mapZone == 1) { list5.Remove(Globals.Instance.GetNodeData("velka_0")); } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_ulmin"), "") || (int)mapZone == 12) { list5.Remove(Globals.Instance.GetNodeData("ulmin_0")); } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_sahti"), "") || (int)mapZone == 14) { list5.Remove(Globals.Instance.GetNodeData("sahti_0")); } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_void"), "") || (int)mapZone == 5) { list5.Remove(Globals.Instance.GetNodeData("voidlow_0")); } } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_require_all_before_void"), "") && ((!AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_sen"), "") && (int)mapZone != 0) || (!AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_faen"), "") && (int)mapZone != 3) || (!AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_aqua"), "") && (int)mapZone != 2) || (!AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_velka"), "") && (int)mapZone != 1) || (flag && !AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_ulmin"), "") && (int)mapZone != 12) || (flag2 && !AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_complete_sahti"), "") && (int)mapZone != 14))) { list5.Remove(Globals.Instance.GetNodeData("voidlow_0")); } List list6 = new List(); int num = -1; if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_zonecount_1"), "")) { num = 1; } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_zonecount_2"), "")) { num = 2; } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_zonecount_3"), "")) { num = 3; } int num2 = ((num == -1) ? list5.Count : Math.Min(list5.Count, num)); for (int l = 0; l < num2; l++) { NodeData val7 = list5[Random.Range(0, list5.Count)]; EventReplyData val8 = val6.ShallowCopy(); val8.ReplyActionText = (EventAction)0; val8.SsRequirementUnlock = null; if (!flag3) { if ((int)mapZone == 0) { val8.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_complete_sen"); } else if ((int)mapZone == 3) { val8.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_complete_faen"); } else if ((int)mapZone == 2) { val8.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_complete_aqua"); } else if ((int)mapZone == 1) { val8.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_complete_velka"); } else if ((int)mapZone == 12) { val8.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_complete_ulmin"); } else if ((int)mapZone == 14) { val8.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_complete_sahti"); } else if ((int)mapZone == 5) { val8.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_complete_void"); } } val8.ReplyText = ((num == 1) ? "You are unable to focus and your mind races as you approach the obelisk." : GetPortalString(AtOManager.Instance.GetMapZone(val7.NodeId))); val8.SsRewardText = ""; val8.SsNodeTravel = val7; list6.Add(val8); list5.Remove(val7); } Globals.Instance.GetEventData("e_endless_obelisk").Replys = list6.ToArray(); } public static string GetPortalString(Zone zone) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) return "Your focus on " + DictionaryExtensions.Get((IDictionary)portalStrings, zone, (string)null) + " world."; } [HarmonyPrefix] [HarmonyPatch(typeof(EventManager), "FinalResolution")] public static void FinalResolutionPre(EventManager __instance, EventData ___currentEvent, EventReplyData ___replySelected) { if (!(___currentEvent.EventId == "e_endless_blessing") || ___replySelected == null || ___replySelected.SsAddCards == null || ___replySelected.SsAddCards.Count <= 0) { return; } CardDataNew val = ___replySelected.SsAddCards[0]; Plugin.LogInfo("Selected blessing: " + val.Id); activeBlessings.Add(val.Id); if ((Object)(object)val != (Object)null) { activeBlessings.Add(val.Id); if ((Object)(object)val.Item != (Object)null && val.Item.MaxHealth > 0) { Hero[] teamHeroes = GetTeamHeroes(); for (int i = 0; i < 4; i++) { if (teamHeroes[i] != null && (Object)(object)((Character)teamHeroes[i]).HeroData != (Object)null) { Hero obj = teamHeroes[i]; ((Character)obj).Hp = ((Character)obj).Hp + val.Item.MaxHealth; Hero obj2 = teamHeroes[i]; ((Character)obj2).HpCurrent = ((Character)obj2).HpCurrent + val.Item.MaxHealth; ((Character)teamHeroes[i]).SetHP(); ((Character)teamHeroes[i]).ClearCaches(); } } } } ___replySelected.SsAddCards = null; } [HarmonyPostfix] [HarmonyPatch(typeof(EventManager), "FinalResolution")] public static void FinalResolutionPost(EventManager __instance, EventData ___currentEvent, EventReplyData ___replySelected) { if (___currentEvent.EventId == "e_endless_perk" && ___replySelected != null) { __instance.result.text = GetRandomPerkDescription(___replySelected.SsPerkData); } } [HarmonyPostfix] [HarmonyPatch(typeof(Globals), "GetPerkData")] public static void GetPerkData(Globals __instance, ref PerkData __result, ref Dictionary ____PerksSource, string id) { //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__result == (Object)null) || !id.StartsWith("endless_")) { return; } __result = ScriptableObject.CreateInstance(); __result.Icon = Globals.Instance.GetAuraCurseData("burn").Sprite; __result.Id = id.ToLower(); string[] array = id.Split(new char[1] { '_' })[1].Split(new char[1] { '#' }); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { ':' }); string text = array2[0]; string text2 = array2[1]; switch (text) { case "h": __result.MaxHealth = int.Parse(text2); break; case "s": __result.SpeedQuantity = int.Parse(text2); break; case "a": __result.AuracurseBonus = Globals.Instance.GetAuraCurseData(text2); break; case "av": __result.AuracurseBonusValue = int.Parse(text2); break; case "d": __result.DamageFlatBonus = (DamageType)Enum.Parse(typeof(DamageType), $"{char.ToUpper(text2[0])}{text2.Substring(1).ToLower()}"); break; case "dv": __result.DamageFlatBonusValue = int.Parse(text2); break; case "r": __result.ResistModified = (DamageType)Enum.Parse(typeof(DamageType), $"{char.ToUpper(text2[0])}{text2.Substring(1).ToLower()}"); break; case "rv": __result.ResistModifiedValue = int.Parse(text2); break; case "e": __result.EnergyBegin = int.Parse(text2); break; } } __result.Init(); ____PerksSource.Add(__result.Id, __result); } [HarmonyPostfix] [HarmonyPatch(typeof(PerksManager), "AddPerkToHero")] public static void AddPerkToHeroPost(Hero hero, string perkId, bool initHealth) { if ((Object)(object)Globals.Instance.GetPerkData(perkId) != (Object)null) { _ = ((Character)hero).SubclassName; } } public static void AddNewRequirement(string id, ref Dictionary ____Requirements) { if (____Requirements.TryGetValue("_tier2", out var value)) { EventRequirementData val = Object.Instantiate(value); string requirementId = (((Object)val).name = id); val.RequirementId = requirementId; ____Requirements.Add(val.RequirementId.ToLower(), val); } } [HarmonyPostfix] [HarmonyPatch(typeof(CardItem), "SetCard")] public static void SetCard(CardItem __instance, string id, bool deckScale, Hero _theHero, NPC _theNPC, bool GetFromGlobal, bool _generated, ref CardRealtimeData ___cardData, ref Transform ___targetTextT, ref Transform ___targetT, ref Transform ___requireTextT, ref Transform ___typeText, ref Transform ___typeTextImage, ref Transform ___descriptionTextT, ref TMP_Text ___descriptionTextTM) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (___cardData.CardType == blessingCardType) { if (((Component)___targetTextT).gameObject.activeSelf) { ((Component)___targetTextT).gameObject.SetActive(false); } if (((Component)___targetT).gameObject.activeSelf) { ((Component)___targetT).gameObject.SetActive(false); } if (((Component)___requireTextT).gameObject.activeSelf) { ((Component)___requireTextT).gameObject.SetActive(false); } if (((Component)___typeText).gameObject.activeSelf) { ((Component)___typeText).gameObject.SetActive(false); } if (((Component)___typeTextImage).gameObject.activeSelf) { ((Component)___typeTextImage).gameObject.SetActive(false); } ___descriptionTextT.localPosition = new Vector3(___descriptionTextT.localPosition.x, -0.63f, ___descriptionTextT.localPosition.z); ___descriptionTextTM.margin = new Vector4(0.02f, -0.02f, 0.02f, -0.04f); } } public static CardDataNew AddNewCard(string id, string baseId, ref Dictionary ____CardsSource, ref Dictionary ____Cards) { if (____CardsSource.TryGetValue(baseId, out var value)) { Plugin.LogInfo("Adding new card: " + id + " from " + baseId); CardDataNew val = Object.Instantiate(value); SetCardSourceField(val, "id", id); SetCardSourceField(val, "internalId", id); if ((Object)(object)val.Item != (Object)null) { ItemData val2 = Object.Instantiate(val.Item); val2.Id = id; SetCardSourceField(val, "item", val2); } if ((Object)(object)val.ItemEnchantment != (Object)null) { ItemData val3 = Object.Instantiate(val.ItemEnchantment); val3.Id = id; SetCardSourceField(val, "itemEnchantment", val3); } ____CardsSource.Add(val.Id.ToLower(), val); ____Cards.Add(val.Id.ToLower(), CreateRuntimeCard(val)); return val; } return null; } private static void InitNewCard(CardDataNew newCard, ref Dictionary> ____CardItemByType, ref Dictionary> ____CardListByType, ref Dictionary> ____CardListByClass, ref List ____CardListNotUpgraded, ref Dictionary> ____CardListNotUpgradedByClass, ref Dictionary> ____CardListByClassType, ref Dictionary ____CardEnergyCost) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00dc: Invalid comparison between Unknown and I4 //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) CardRealtimeData val = Globals.Instance.GetCardData(newCard.Id, false) ?? CreateRuntimeCard(newCard); ____CardEnergyCost[newCard.Id] = val.EnergyCost; Globals.Instance.IncludeInSearch(newCard.CardName, newCard.Id, true); if (!____CardListByClass.ContainsKey(val.CardClass)) { ____CardListByClass[val.CardClass] = new List(); } ____CardListByClass[val.CardClass].Add(newCard.Id); if ((int)val.CardUpgraded == 0) { if (!____CardListNotUpgradedByClass.ContainsKey(val.CardClass)) { ____CardListNotUpgradedByClass[val.CardClass] = new List(); } ____CardListNotUpgradedByClass[val.CardClass].Add(newCard.Id); ____CardListNotUpgraded.Add(newCard.Id); if ((int)val.CardClass == 8) { if (!____CardItemByType.ContainsKey(val.CardType)) { ____CardItemByType.Add(val.CardType, new List()); } ____CardItemByType[val.CardType].Add(newCard.Id); } } List cardTypes = val.GetCardTypes(); for (int i = 0; i < cardTypes.Count; i++) { if (!____CardListByType.ContainsKey(cardTypes[i])) { ____CardListByType.Add(cardTypes[i], new List()); } ____CardListByType[cardTypes[i]].Add(newCard.Id); string key = Enum.GetName(typeof(CardClass), val.CardClass) + "_" + Enum.GetName(typeof(CardType), cardTypes[i]); if (!____CardListByClassType.ContainsKey(key)) { ____CardListByClassType[key] = new List(); } ____CardListByClassType[key].Add(newCard.Id); Globals.Instance.IncludeInSearch(Texts.Instance.GetText(Enum.GetName(typeof(CardType), cardTypes[i]), ""), newCard.Id, true); } val.PostInit(); CardDescriptionExtension.SetDescriptionNew(val, true, (Character)null, false); } public static CardDataNew CloneBlessingCard(string cardId, bool isBlessing, ref Dictionary ____CardsSource, ref Dictionary ____Cards, ref Dictionary> ____CardItemByType, ref Dictionary> ____CardListByType, ref Dictionary> ____CardListByClass, ref List ____CardListNotUpgraded, ref Dictionary> ____CardListNotUpgradedByClass, ref Dictionary> ____CardListByClassType, ref Dictionary ____CardEnergyCost) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Invalid comparison between Unknown and I4 //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Invalid comparison between Unknown and I4 //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Invalid comparison between Unknown and I4 //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Invalid comparison between Unknown and I4 //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Invalid comparison between Unknown and I4 //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Invalid comparison between Unknown and I4 //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Invalid comparison between Unknown and I4 //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Invalid comparison between Unknown and I4 //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Invalid comparison between Unknown and I4 //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Invalid comparison between Unknown and I4 //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Invalid comparison between Unknown and I4 //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Invalid comparison between Unknown and I4 //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Invalid comparison between Unknown and I4 //IL_01db: Unknown result type (might be due to invalid IL or missing references) if (____CardsSource.TryGetValue("endless" + cardId, out var value)) { Plugin.LogInfo("Got existing card: " + value.Id); return value; } Plugin.LogInfo("Creating blessing card endless" + cardId); CardDataNew val = AddNewCard("endless" + cardId, cardId, ref ____CardsSource, ref ____Cards); SetCardSourceField(val, "cardName", "Blessing: " + val.CardName); if (isBlessing) { SetCardSourceField(val, "cardType", blessingCardType); } SetCardSourceField(val, "cardClass", (CardClass)9); ItemData val2 = val.Item ?? val.ItemEnchantment; if ((Object)(object)val2 != (Object)null) { if ((int)val2.CastedCardType != 0) { val2.CastedCardType = (CardType)0; } if ((int)val2.ItemTarget == 4) { val2.ItemTarget = (ItemTarget)3; } else if ((int)val2.ItemTarget == 3) { val2.ItemTarget = (ItemTarget)4; } if ((int)val2.ItemTarget == 2) { val2.ItemTarget = (ItemTarget)1; } else if ((int)val2.ItemTarget == 1) { val2.ItemTarget = (ItemTarget)2; } if ((int)val2.ItemTarget == 10) { val2.ItemTarget = (ItemTarget)8; } else if ((int)val2.ItemTarget == 8) { val2.ItemTarget = (ItemTarget)10; } if ((int)val2.ItemTarget == 9) { val2.ItemTarget = (ItemTarget)7; } else if ((int)val2.ItemTarget == 7) { val2.ItemTarget = (ItemTarget)9; } if ((int)val2.ItemTarget == 0) { val2.ItemTarget = (ItemTarget)6; } else if ((int)val2.ItemTarget == 6) { val2.ItemTarget = (ItemTarget)0; } if ((int)val2.CardPlace == 1 && val2.CardNum > 0) { val2.CardPlace = (CardPlace)5; } if ((int)val2.CardPlace == 5 && val2.CardNum > 0 && ((int)val2.Activation == 2 || (int)val2.Activation == 28)) { val2.Activation = (EventActivation)22; } if (val2.CardNum == 0 && (int)val2.Activation == 28) { val2.Activation = blessingBeginRound; } if (val2.CardNum == 0 && (int)val2.Activation == 27) { val2.Activation = blessingCombatStart; } if ((Object)(object)val2.CardToGain != (Object)null) { val2.CardToGain = CloneBlessingCard(val2.CardToGain.Id, isBlessing: false, ref ____CardsSource, ref ____Cards, ref ____CardItemByType, ref ____CardListByType, ref ____CardListByClass, ref ____CardListNotUpgraded, ref ____CardListNotUpgradedByClass, ref ____CardListByClassType, ref ____CardEnergyCost); SetCardSourceField(val2.CardToGain, "playable", value: true); } else if (val2.CardToGainList != null && val2.CardToGainList.Count > 0) { List list = new List(); foreach (CardDataNew cardToGain in val2.CardToGainList) { CardDataNew val3 = CloneBlessingCard(cardToGain.Id, isBlessing: false, ref ____CardsSource, ref ____Cards, ref ____CardItemByType, ref ____CardListByType, ref ____CardListByClass, ref ____CardListNotUpgraded, ref ____CardListNotUpgradedByClass, ref ____CardListByClassType, ref ____CardEnergyCost); SetCardSourceField(val3, "playable", value: true); list.Add(val3); } val2.CardToGainList = list; } if ((Object)(object)val.ItemEnchantment != (Object)null) { SetCardSourceField(val, "itemEnchantment", val2); } else { SetCardSourceField(val, "item", val2); } } SetCardSourceField(val, "effectRequired", ""); if (val.Upgrade.UpgradedFrom != "") { SetCardSourceField(val, "upgrade", new UpgradeData(val.Upgrade.UpgradesTo1, val.Upgrade.UpgradesTo2, val.Upgrade.CardUpgraded, "endless" + val.Upgrade.UpgradedFrom.ToLower(), val.Upgrade.UpgradesToRare)); } if (val.Upgrade.UpgradesTo1 != "") { CardDataNew val4 = CloneBlessingCard(val.Upgrade.UpgradesTo1.ToLower(), isBlessing: true, ref ____CardsSource, ref ____Cards, ref ____CardItemByType, ref ____CardListByType, ref ____CardListByClass, ref ____CardListNotUpgraded, ref ____CardListNotUpgradedByClass, ref ____CardListByClassType, ref ____CardEnergyCost); SetCardSourceField(val, "upgrade", new UpgradeData(val4.Id, val.Upgrade.UpgradesTo2, val.Upgrade.CardUpgraded, val.Upgrade.UpgradedFrom, val.Upgrade.UpgradesToRare)); } if (val.Upgrade.UpgradesTo2 != "") { CardDataNew val5 = CloneBlessingCard(val.Upgrade.UpgradesTo2.ToLower(), isBlessing: true, ref ____CardsSource, ref ____Cards, ref ____CardItemByType, ref ____CardListByType, ref ____CardListByClass, ref ____CardListNotUpgraded, ref ____CardListNotUpgradedByClass, ref ____CardListByClassType, ref ____CardEnergyCost); SetCardSourceField(val, "upgrade", new UpgradeData(val.Upgrade.UpgradesTo1, val5.Id, val.Upgrade.CardUpgraded, val.Upgrade.UpgradedFrom, val.Upgrade.UpgradesToRare)); } if ((Object)(object)val.Upgrade.UpgradesToRare != (Object)null) { CardDataNew val6 = CloneBlessingCard(val.Upgrade.UpgradesToRare.Id, isBlessing: true, ref ____CardsSource, ref ____Cards, ref ____CardItemByType, ref ____CardListByType, ref ____CardListByClass, ref ____CardListNotUpgraded, ref ____CardListNotUpgradedByClass, ref ____CardListByClassType, ref ____CardEnergyCost); SetCardSourceField(val, "upgrade", new UpgradeData(val.Upgrade.UpgradesTo1, val.Upgrade.UpgradesTo2, val.Upgrade.CardUpgraded, val.Upgrade.UpgradedFrom, val6)); } InitNewCard(val, ref ____CardItemByType, ref ____CardListByType, ref ____CardListByClass, ref ____CardListNotUpgraded, ref ____CardListNotUpgradedByClass, ref ____CardListByClassType, ref ____CardEnergyCost); return val; } public static CardRealtimeData CreateCard() { return null; } [HarmonyPostfix] [HarmonyPatch(typeof(Globals), "GetExperienceByLevel")] public static void GetExperienceByLevel(ref Globals __instance, int level, ref int __result) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_additional_levels"), "")) { if (level == 5) { __result = 2250; } if (level == 6) { __result = 3000; } if (level == 7) { __result = 4000; } if (level == 8) { __result = 6000; } if (level >= 9) { __result = 99999; } } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "CalculateRewardForCharacter")] public static void CalculateRewardForCharacter(ref Character __instance, ref int _experience, ref int __result) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_additional_levels"), "") && AtOManager.Instance.GetActNumberForText("") - 1 >= 5) { if (AtOManager.Instance.IsChallengeTraitActive("smartheroes")) { _experience += Functions.FuncRoundToInt((float)_experience * 0.5f); } float num = 0.1f; if (__instance.Level > AtOManager.Instance.GetActNumberForText("")) { __result = Functions.FuncRoundToInt((float)_experience * num); } else if (__instance.Experience >= Globals.Instance.GetExperienceByLevel(__instance.Level)) { __result = Functions.FuncRoundToInt((float)_experience * num); } else if (__instance.Experience + _experience > Globals.Instance.GetExperienceByLevel(__instance.Level)) { int num2 = _experience - (Globals.Instance.GetExperienceByLevel(__instance.Level) - __instance.Experience); __result = Globals.Instance.GetExperienceByLevel(__instance.Level) - __instance.Experience + Functions.FuncRoundToInt((float)num2 * num); } else { __result = _experience; } } } [HarmonyPostfix] [HarmonyPatch(typeof(OverCharacter), "DoStats")] public static void DoStats(ref OverCharacter __instance, ref Hero ___hero) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_additional_levels"), "")) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("L"); stringBuilder.Append(((Character)___hero).Level); if (((Character)___hero).Level < 9) { stringBuilder.Append(" ["); stringBuilder.Append(((Character)___hero).Experience); stringBuilder.Append("/"); stringBuilder.Append(Globals.Instance.GetExperienceByLevel(((Character)___hero).Level)); stringBuilder.Append("]"); } __instance.experienceText.text = stringBuilder.ToString(); } } [HarmonyPostfix] [HarmonyPatch(typeof(Globals), "CreateGameContent")] public static void CreateGameContent(ref Globals __instance, ref Dictionary ____Events, ref Dictionary ____NodeDataSource, ref Dictionary ____CombatDataSource, ref Dictionary ____Cinematics, ref Dictionary ____Requirements, ref Dictionary ____CardsSource, ref Dictionary ____Cards, ref Dictionary> ____CardItemByType, ref Dictionary> ____CardListByType, ref Dictionary> ____CardListByClass, ref List ____CardListNotUpgraded, ref Dictionary> ____CardListNotUpgradedByClass, ref Dictionary> ____CardListByClassType, ref Dictionary ____CardEnergyCost) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge()) { return; } foreach (string blessingCard in blessingCards) { CardDataNew val = CloneBlessingCard(blessingCard, isBlessing: true, ref ____CardsSource, ref ____Cards, ref ____CardItemByType, ref ____CardListByType, ref ____CardListByClass, ref ____CardListNotUpgraded, ref ____CardListNotUpgradedByClass, ref ____CardListByClassType, ref ____CardEnergyCost); availableBlessings.Add(val.Id); } GameManager.Instance.cardSprites = GameManager.Instance.cardSprites.Concat(GameManager.Instance.cardSprites.Where((Sprite c) => ((Object)c).name == "card-bg-special")).ToArray(); AddNewRequirement("endless_complete_sen", ref ____Requirements); AddNewRequirement("endless_complete_faen", ref ____Requirements); AddNewRequirement("endless_complete_aqua", ref ____Requirements); AddNewRequirement("endless_complete_ulmin", ref ____Requirements); AddNewRequirement("endless_complete_velka", ref ____Requirements); AddNewRequirement("endless_complete_sahti", ref ____Requirements); AddNewRequirement("endless_complete_void", ref ____Requirements); AddNewRequirement("endless_unique_zones", ref ____Requirements); AddNewRequirement("endless_allow_repeats", ref ____Requirements); AddNewRequirement("endless_require_all_before_void", ref ____Requirements); AddNewRequirement("endless_allow_perks", ref ____Requirements); AddNewRequirement("endless_allow_blessings", ref ____Requirements); AddNewRequirement("endless_allow_blessings_starting_4", ref ____Requirements); AddNewRequirement("endless_allow_blessings_every_4", ref ____Requirements); AddNewRequirement("endless_allow_blessings_after_void", ref ____Requirements); AddNewRequirement("endless_pick_blessing", ref ____Requirements); AddNewRequirement("endless_allow_additional_levels", ref ____Requirements); AddNewRequirement("endless_zonecount_1", ref ____Requirements); AddNewRequirement("endless_zonecount_2", ref ____Requirements); AddNewRequirement("endless_zonecount_3", ref ____Requirements); if (____Events.TryGetValue("e_sen44_a", out var value)) { EventData val2 = Object.Instantiate(value); EventData val3 = Object.Instantiate(value); EventData val4 = Object.Instantiate(value); EventData val5 = Object.Instantiate(value); EventData val6 = Object.Instantiate(value); EventData val7 = Object.Instantiate(value); EventData val8 = Object.Instantiate(value); EventReplyData obj = Globals.Instance.GetEventData("e_sen44_a").Replys.First(); EventReplyData val9 = obj.ShallowCopy(); EventReplyData val10 = obj.ShallowCopy(); val9.ReplyActionText = (EventAction)0; val9.ReplyText = "Yes"; val9.SsRewardText = ""; val9.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_allow_perks"); val9.SsEvent = val3; val10.ReplyActionText = (EventAction)0; val10.ReplyText = "No"; val10.SsRewardText = ""; val10.SsRequirementUnlock = null; val10.SsEvent = val3; EventReplyData val11 = obj.ShallowCopy(); EventReplyData val12 = obj.ShallowCopy(); EventReplyData val13 = obj.ShallowCopy(); EventReplyData val14 = obj.ShallowCopy(); EventReplyData val15 = obj.ShallowCopy(); val11.ReplyActionText = (EventAction)0; val11.ReplyText = "After every Act"; val11.SsRewardText = ""; val11.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_allow_blessings"); val11.SsRequirementUnlock2 = Globals.Instance.GetRequirementData("endless_pick_blessing"); val11.SsEvent = val4; val12.ReplyActionText = (EventAction)0; val12.ReplyText = "After every Act starting at Act 4"; val12.SsRewardText = ""; val12.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_allow_blessings_starting_4"); val12.SsEvent = val4; val13.ReplyActionText = (EventAction)0; val13.ReplyText = "After every 4th Act"; val13.SsRewardText = ""; val13.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_allow_blessings_every_4"); val13.SsEvent = val4; val14.ReplyActionText = (EventAction)0; val14.ReplyText = "After every Void Act"; val14.SsRewardText = ""; val14.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_allow_blessings_after_void"); val14.SsEvent = val4; val15.ReplyActionText = (EventAction)0; val15.ReplyText = "Disable"; val15.SsRewardText = ""; val15.SsRequirementUnlock = null; val15.SsEvent = val4; EventReplyData val16 = obj.ShallowCopy(); EventReplyData val17 = obj.ShallowCopy(); val16.ReplyActionText = (EventAction)0; val16.ReplyText = "Yes"; val16.SsRewardText = ""; val16.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_allow_additional_levels"); val16.SsEvent = val5; val17.ReplyActionText = (EventAction)0; val17.ReplyText = "No"; val17.SsRewardText = ""; val17.SsRequirementUnlock = null; val17.SsEvent = val5; EventReplyData val18 = obj.ShallowCopy(); EventReplyData val19 = obj.ShallowCopy(); val18.ReplyActionText = (EventAction)0; val18.ReplyText = "Yes"; val18.SsRewardText = ""; val18.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_require_all_before_void"); val18.SsEvent = val6; val19.ReplyActionText = (EventAction)0; val19.ReplyText = "No"; val19.SsRewardText = ""; val19.SsRequirementUnlock = null; val19.SsEvent = val6; EventReplyData val20 = obj.ShallowCopy(); EventReplyData val21 = obj.ShallowCopy(); val20.ReplyActionText = (EventAction)0; val20.ReplyText = "Yes"; val20.SsRewardText = ""; val20.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_unique_zones"); val20.SsEvent = val8; val21.ReplyActionText = (EventAction)0; val21.ReplyText = "No"; val21.SsRewardText = ""; val21.SsRequirementUnlock = null; val21.SsEvent = val7; EventReplyData val22 = obj.ShallowCopy(); EventReplyData val23 = obj.ShallowCopy(); val22.ReplyActionText = (EventAction)0; val22.ReplyText = "Yes"; val22.SsRewardText = ""; val22.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_allow_repeats"); val22.SsEvent = val8; val23.ReplyActionText = (EventAction)0; val23.ReplyText = "No"; val23.SsRewardText = ""; val23.SsRequirementUnlock = null; val23.SsEvent = val8; EventReplyData val24 = obj.ShallowCopy(); EventReplyData val25 = obj.ShallowCopy(); EventReplyData val26 = obj.ShallowCopy(); EventReplyData val27 = obj.ShallowCopy(); val24.ReplyActionText = (EventAction)0; val24.ReplyText = "1"; val24.SsRewardText = ""; val24.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_zonecount_1"); val24.SsEvent = null; val25.ReplyActionText = (EventAction)0; val25.ReplyText = "2"; val25.SsRewardText = ""; val25.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_zonecount_2"); val25.SsEvent = null; val26.ReplyActionText = (EventAction)0; val26.ReplyText = "3"; val26.SsRewardText = ""; val26.SsRequirementUnlock = Globals.Instance.GetRequirementData("endless_zonecount_3"); val26.SsEvent = null; val27.ReplyActionText = (EventAction)0; val27.ReplyText = "All"; val27.SsRewardText = ""; val27.SsRequirementUnlock = null; val27.SsEvent = null; val2.EventName = "Endless Perks"; val2.Description = "At the end of each act you will be given a list of random perks to choose from. These perks are permanent and will last until the end of the run. These are purely stat based."; val2.DescriptionAction = "Enable randomized perks at the end of each act?"; val2.EventId = "e_endless_allow_perks"; val2.Replys = (EventReplyData[])(object)new EventReplyData[2] { val9, val10 }; val2.Init(); ____Events.Add(val2.EventId.ToLower(), val2); val3.EventName = "Endless Blessings"; val3.Description = "At the end of certain acts you will be given a list of random blessings to choose from. These blessings are permanent and will last until the end of the run. These have in-combat effects, similar to corruptions."; val3.DescriptionAction = "Enable randomized blessings at the end of acts?"; val3.EventId = "e_endless_allow_blessings"; val3.Replys = (EventReplyData[])(object)new EventReplyData[5] { val11, val12, val13, val14, val15 }; val3.Init(); ____Events.Add(val3.EventId.ToLower(), val3); val4.EventName = "Unshackled Growth"; val4.Description = "Change the character level cap to allow leveling up to level 9. This will allow you to select traits from the other side of the tree."; val4.DescriptionAction = "Enable additional levels?"; val4.EventId = "e_endless_allow_additional_levels"; val4.Replys = (EventReplyData[])(object)new EventReplyData[2] { val16, val17 }; val4.Init(); ____Events.Add(val4.EventId.ToLower(), val4); val5.EventName = "Adventure-like"; val5.Description = "This will require you to complete all other acts before being allowed to enter the void act. This is similar to how adventure mode works. Each cycle will restart this requirement."; val5.DescriptionAction = "Require all other acts to be completed per cycle before void act?"; val5.EventId = "e_endless_require_all_before_void"; val5.Replys = (EventReplyData[])(object)new EventReplyData[2] { val18, val19 }; val5.Init(); ____Events.Add(val5.EventId.ToLower(), val5); val6.EventName = "Déjà Vu"; val6.Description = "This will cause each zone to only be encountered once per cycle. For example, if you encounter the Faeborg Forest act, you will not be able to encounter it again until you have completed The Void act and started a new cycle."; val6.DescriptionAction = "Only encounter each zone once per cycle?"; val6.EventId = "e_endless_unique_zones"; val6.Replys = (EventReplyData[])(object)new EventReplyData[2] { val20, val21 }; val6.Init(); ____Events.Add(val6.EventId.ToLower(), val6); val7.EventName = "Déjà Vu... Again?"; val7.Description = "This will allow the same zone to be encountered after itself. For example, you could encounter the Faeborg Forest act, and then encounter the Faeborg Forest act again."; val7.DescriptionAction = "Allow the same zone to be encountered after itself?"; val7.EventId = "e_endless_allow_repeats"; val7.Replys = (EventReplyData[])(object)new EventReplyData[2] { val22, val23 }; val7.Init(); ____Events.Add(val7.EventId.ToLower(), val7); val8.EventName = "Oracle's Vision"; val8.Description = "Choose how many different zones you can be offered at the obelisk. Choosing 'All' will allow you to be offered any of the remaining zones that you have not completed yet in the current cycle. Choosing 1 will only offer you one random zone."; val8.DescriptionAction = "How many random zones to pick from at the obelisk?"; val8.EventId = "e_endless_zone_count"; val8.Replys = (EventReplyData[])(object)new EventReplyData[4] { val24, val25, val26, val27 }; val8.Init(); ____Events.Add(val8.EventId.ToLower(), val8); } Sprite eventSpriteBook = LoadSprite("AtOEndless.Assets.endless.png"); if (____Events.TryGetValue("e_sen34_a", out var value2)) { EventData val28 = Object.Instantiate(value2); val28.EventName = "Endless Obelisk"; val28.Description = "A large floating obelisk stands before you, radiating a strange energy. It seems to be a gateway to other worlds."; val28.DescriptionAction = "Approach the obelisk and envision a world you wish to visit."; val28.EventId = "e_endless_obelisk"; val28.Replys = Array.Empty(); val28.EventSpriteBook = eventSpriteBook; val28.Init(); ____Events.Add(val28.EventId.ToLower(), val28); } if (____Events.TryGetValue("e_challenge_next", out var value3)) { EventData val29 = Object.Instantiate(value3); val29.EventName = "Power of the Obelisk"; val29.Description = "As you approach the obelisk you feel a surge of power course through your veins."; val29.DescriptionAction = "Channel this power into a permanent perk."; val29.EventId = "e_endless_perk"; val29.Requirement = Globals.Instance.GetRequirementData("endless_allow_perks"); val29.Replys = Array.Empty(); val29.EventSpriteBook = eventSpriteBook; val29.ReplyRandom = 0; val29.Init(); ____Events.Add(val29.EventId.ToLower(), val29); } if (____Events.TryGetValue("e_challenge_next", out var value4)) { EventData val30 = Object.Instantiate(value4); val30.EventName = "Blessing of the Obelisk"; val30.Description = "Getting closer to the obelisk you feel a strange energy enveloping you, as if the obelisk is blessing you with its power."; val30.DescriptionAction = "Receive a blessing to aid you in your journey."; val30.EventId = "e_endless_blessing"; val30.Requirement = Globals.Instance.GetRequirementData("endless_pick_blessing"); val30.Replys = Array.Empty(); val30.EventSpriteBook = eventSpriteBook; val30.ReplyRandom = 0; val30.Init(); ____Events.Add(val30.EventId.ToLower(), val30); } if (____Cinematics.TryGetValue("intro", out var value5)) { value5.CinematicEvent = Globals.Instance.GetEventData("e_endless_allow_perks"); ____Cinematics["intro"] = value5; } if (____NodeDataSource.TryGetValue("sen_34", out var value6)) { value6.NodeEvent = (EventData[])(object)new EventData[3] { Globals.Instance.GetEventData("e_endless_perk"), Globals.Instance.GetEventData("e_endless_blessing"), Globals.Instance.GetEventData("e_endless_obelisk") }; value6.NodeEventPriority = new int[3] { 0, 1, 2 }; ____NodeDataSource["sen_34"] = value6; } if (____NodeDataSource.TryGetValue("faen_39", out var value7)) { value7.NodeEvent = (EventData[])(object)new EventData[3] { Globals.Instance.GetEventData("e_endless_perk"), Globals.Instance.GetEventData("e_endless_blessing"), Globals.Instance.GetEventData("e_endless_obelisk") }; value7.NodeEventPriority = new int[3] { 0, 1, 2 }; ____NodeDataSource["faen_39"] = value7; } if (____NodeDataSource.TryGetValue("aqua_36", out var value8)) { value8.NodeEvent = (EventData[])(object)new EventData[3] { Globals.Instance.GetEventData("e_endless_perk"), Globals.Instance.GetEventData("e_endless_blessing"), Globals.Instance.GetEventData("e_endless_obelisk") }; value8.NodeEventPriority = new int[3] { 0, 1, 2 }; ____NodeDataSource["aqua_36"] = value8; } if (____NodeDataSource.TryGetValue("velka_33", out var value9)) { value9.NodeEvent = (EventData[])(object)new EventData[3] { Globals.Instance.GetEventData("e_endless_perk"), Globals.Instance.GetEventData("e_endless_blessing"), Globals.Instance.GetEventData("e_endless_obelisk") }; value9.NodeEventPriority = new int[3] { 0, 1, 2 }; ____NodeDataSource["velka_33"] = value9; } if (____NodeDataSource.TryGetValue("ulmin_40", out var value10)) { value10.NodeEvent = (EventData[])(object)new EventData[3] { Globals.Instance.GetEventData("e_endless_perk"), Globals.Instance.GetEventData("e_endless_blessing"), Globals.Instance.GetEventData("e_endless_obelisk") }; value10.NodeEventPriority = new int[3] { 0, 1, 2 }; ____NodeDataSource["ulmin_40"] = value10; } if (____NodeDataSource.TryGetValue("sahti_63", out var value11)) { value11.NodeEvent = (EventData[])(object)new EventData[3] { Globals.Instance.GetEventData("e_endless_perk"), Globals.Instance.GetEventData("e_endless_blessing"), Globals.Instance.GetEventData("e_endless_obelisk") }; value11.NodeEventPriority = new int[3] { 0, 1, 2 }; ____NodeDataSource["sahti_63"] = value11; } if (____CombatDataSource.TryGetValue("evoidhigh_13b", out var value12)) { value12.EventData = Globals.Instance.GetEventData("e_endless_obelisk"); ____CombatDataSource["evoidhigh_13b"] = value12; } if (____Cinematics.TryGetValue("endgame", out var value13)) { value13.CinematicEndAdventure = false; ____Cinematics["endgame"] = value13; } GameManager.Instance.DebugShow(); } private static Sprite LoadSprite(string filename) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) Image val; Texture2D val2; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(filename)) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); val = Image.FromStream(stream); val2 = new Texture2D(val.Width, val.Height); ImageConversion.LoadImage(val2, array); } Plugin.LogInfo($"Loaded {filename} w:{val.Width} h:{val.Height}"); return Sprite.Create(val2, new Rect(0f, 0f, (float)val.Width, (float)val.Height), new Vector2(0.5f, 0.5f)); } [HarmonyPrefix] [HarmonyPatch(typeof(EventManager), "CloseEvent")] public static void CloseEvent(ref EventManager __instance, CloseEventData ____closeEventData, EventData ___currentEvent) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Invalid comparison between Unknown and I4 if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge()) { return; } NodeData val = ____closeEventData?.destinationNode; if (!((Object)(object)val != (Object)null) || !(___currentEvent.EventId == "e_endless_obelisk")) { return; } AtOManager.Instance.SetTownTier(AtOManager.Instance.GetActNumberForText("")); AtOManager.Instance.SetGameId(string.Format("{0}+{1}", AtOManager.Instance.GetGameId().Split(new char[1] { '+' }).First(), AtOManager.Instance.GetActNumberForText(""))); AtOManager.Instance.gameNodeAssigned.Clear(); AtOManager.Instance.GenerateTownItemList(); if (RemoveRequirementsByZone.TryGetValue(AtOManager.Instance.GetMapZone(val.NodeId), out var value)) { foreach (string item in value) { AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData(item), ""); } } if (AddRequirementsByZone.TryGetValue(AtOManager.Instance.GetMapZone(val.NodeId), out var value2)) { foreach (string item2 in value2) { AtOManager.Instance.AddPlayerRequirement(Globals.Instance.GetRequirementData(item2), true); } } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_blessings"), "")) { AtOManager.Instance.AddPlayerRequirement(Globals.Instance.GetRequirementData("endless_pick_blessing"), true); } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_blessings_starting_4"), "")) { if (AtOManager.Instance.GetActNumberForText("") > 3) { AtOManager.Instance.AddPlayerRequirement(Globals.Instance.GetRequirementData("endless_pick_blessing"), true); } else { AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_pick_blessing"), ""); } } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_blessings_every_4"), "")) { if (AtOManager.Instance.GetActNumberForText("") % 4 == 0) { AtOManager.Instance.AddPlayerRequirement(Globals.Instance.GetRequirementData("endless_pick_blessing"), true); } else { AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_pick_blessing"), ""); } } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_blessings_after_void"), "")) { if ((int)AtOManager.Instance.GetMapZone(val.NodeId) == 4) { AtOManager.Instance.AddPlayerRequirement(Globals.Instance.GetRequirementData("endless_pick_blessing"), true); } else { AtOManager.Instance.RemovePlayerRequirement(Globals.Instance.GetRequirementData("endless_pick_blessing"), ""); } } } [HarmonyPostfix] [HarmonyPatch(typeof(AtOManager), "AddPlayerRequirement")] public static void AddPlayerRequirement(ref AtOManager __instance, EventRequirementData requirement, bool share, ref List ___playerRequeriments) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { Plugin.LogInfo("Add Requirement: " + requirement.RequirementId); } } [HarmonyPostfix] [HarmonyPatch(typeof(AtOManager), "RemovePlayerRequirement")] public static void RemovePlayerRequirement(ref AtOManager __instance, EventRequirementData requirement, string requirementId, ref List ___playerRequeriments) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { Plugin.LogInfo("Remove Requirement: " + ((requirementId != "") ? requirementId : requirement.RequirementId)); } } [HarmonyPrefix] [HarmonyPatch(typeof(AtOManager), "UpgradeTownTier")] public static bool UpgradeTownTier(ref AtOManager __instance, ref int ___townTier) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge()) { return true; } return false; } [HarmonyPrefix] [HarmonyPatch(typeof(NPC), "InitData")] public static void InitDataPre(ref NPC __instance) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && (Object)(object)((Character)__instance).NpcData != (Object)null && AtOManager.Instance.GetActNumberForText("") >= 3 && (Object)(object)((Character)__instance).NpcData.UpgradedMob != (Object)null) { ((Character)__instance).NpcData = ((Character)__instance).NpcData.UpgradedMob; } } [HarmonyPostfix] [HarmonyPatch(typeof(NPC), "InitData")] public static void InitDataPost(ref NPC __instance) { //IL_003e: 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_00b1: Invalid comparison between Unknown and I4 //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Invalid comparison between Unknown and I4 if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { int num = AtOManager.Instance.GetActNumberForText("") - 1; if (num >= 1 && ((int)AtOManager.Instance.GetMapZone(AtOManager.Instance.currentMapNode) == 0 || (int)AtOManager.Instance.GetMapZone(AtOManager.Instance.currentMapNode) == 6)) { NPC obj = __instance; int hp = (((Character)__instance).HpCurrent = Functions.FuncRoundToInt((float)((Character)__instance).Hp + (float)((Character)__instance).Hp * 3f)); ((Character)obj).Hp = hp; NPC obj2 = __instance; ((Character)obj2).Speed = ((Character)obj2).Speed + 2; } if (num >= 3 && (int)AtOManager.Instance.GetMapZone(AtOManager.Instance.currentMapNode) != 4 && (int)AtOManager.Instance.GetMapZone(AtOManager.Instance.currentMapNode) != 5) { NPC obj3 = __instance; int hp = (((Character)__instance).HpCurrent = Functions.FuncRoundToInt((float)((Character)__instance).Hp + (float)((Character)__instance).Hp * 0.5f)); ((Character)obj3).Hp = hp; NPC obj4 = __instance; ((Character)obj4).Speed = ((Character)obj4).Speed + 1; } if (num >= 4) { NPC obj5 = __instance; int hp = (((Character)__instance).HpCurrent = Functions.FuncRoundToInt((float)((Character)__instance).Hp + (float)((Character)__instance).Hp * (0.5f * (float)(num - 3)))); ((Character)obj5).Hp = hp; NPC obj6 = __instance; ((Character)obj6).Speed = ((Character)obj6).Speed + (num - 3); } } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetAuraCurseQuantityModification")] public static void GetAuraCurseQuantityModification(ref Character __instance, ref int __result, string id, CardClass CC, ref bool ___isHero) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || ___isHero) { return; } switch (id) { case "paralyze": return; case "invulnerable": return; case "stress": return; case "fatigue": return; } int num = AtOManager.Instance.GetActNumberForText("") - 1; if (num >= 4) { __result = Mathf.FloorToInt((float)__result + (1f + 0.5f * (float)(num - 3))); } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "DamageBonus")] public static void DamageBonus(ref Character __instance, ref float[] __result, DamageType DT, int energyCost, ref bool ___isHero) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && !___isHero) { int num = AtOManager.Instance.GetActNumberForText("") - 1; if (num >= 4) { __result = new float[2] { __result[0] + (float)(2 * (num - 3)), __result[1] + 15f * (float)(num - 3) }; } } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "HealBonus")] public static void HealBonus(ref Character __instance, ref float[] __result, int energyCost, ref bool ___isHero) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && !___isHero) { int num = AtOManager.Instance.GetActNumberForText("") - 1; if (num >= 4) { __result = new float[2] { __result[0] + (float)(2 * (num - 3)), __result[1] + 15f * (float)(num - 3) }; } } } [HarmonyPostfix] [HarmonyPatch(typeof(GameData), "FillData")] public static void FillData(ref GameData __instance, ref int ___townTier) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { ___townTier = AtOManager.Instance.GetActNumberForText("") - 1; } } [HarmonyPrefix] [HarmonyPatch(typeof(AtOManager), "SetCurrentNode")] public static void SetCurrentNodePre(ref AtOManager __instance, out string[][] __state) { __state = new string[2][] { AtOManager.Instance.mapVisitedNodes.ToArray(), AtOManager.Instance.mapVisitedNodesAction.ToArray() }; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { AtOManager.Instance.mapVisitedNodes.Clear(); AtOManager.Instance.mapVisitedNodesAction.Clear(); } } [HarmonyPostfix] [HarmonyPatch(typeof(AtOManager), "SetCurrentNode")] public static void SetCurrentNodePost(ref AtOManager __instance, string[][] __state) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { AtOManager.Instance.mapVisitedNodes.AddRange(new <>z__ReadOnlyArray(__state[0].ToArray())); AtOManager.Instance.mapVisitedNodesAction.AddRange(new <>z__ReadOnlyArray(__state[1].ToArray())); } } [HarmonyPrefix] [HarmonyPatch(typeof(MapManager), "DrawNodes")] public static void DrawNodesPre(ref MapManager __instance, out string[][] __state) { __state = new string[2][] { AtOManager.Instance.mapVisitedNodes.ToArray(), AtOManager.Instance.mapVisitedNodesAction.ToArray() }; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { AtOManager.Instance.mapVisitedNodes.Clear(); AtOManager.Instance.mapVisitedNodesAction.Clear(); } } [HarmonyPostfix] [HarmonyPatch(typeof(MapManager), "DrawNodes")] public static void DrawNodesPost(ref MapManager __instance, string[][] __state, ref Dictionary ___mapNode) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge()) { return; } AtOManager.Instance.mapVisitedNodes.AddRange(new <>z__ReadOnlyArray(__state[0].ToArray())); AtOManager.Instance.mapVisitedNodesAction.AddRange(new <>z__ReadOnlyArray(__state[1].ToArray())); for (int i = 0; i < AtOManager.Instance.mapVisitedNodes.Count; i++) { if (AtOManager.Instance.mapVisitedNodes[i] != "" && ___mapNode.ContainsKey(AtOManager.Instance.mapVisitedNodes[i])) { ___mapNode[AtOManager.Instance.mapVisitedNodes[i]].SetVisited(); } if (zoneStartNodes.Contains(AtOManager.Instance.mapVisitedNodes[i])) { break; } } } [HarmonyPrefix] [HarmonyPatch(typeof(MapManager), "GetMapNodesCo")] public static void GetMapNodesCoPre(ref MapManager __instance, out string[][] __state) { __state = new string[2][] { AtOManager.Instance.mapVisitedNodes.ToArray(), AtOManager.Instance.mapVisitedNodesAction.ToArray() }; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { AtOManager.Instance.mapVisitedNodes.Clear(); AtOManager.Instance.mapVisitedNodesAction.Clear(); } } [HarmonyPostfix] [HarmonyPatch(typeof(MapManager), "GetMapNodesCo")] public static void GetMapNodesCoPost(ref MapManager __instance, string[][] __state) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { AtOManager.Instance.mapVisitedNodes.AddRange(new <>z__ReadOnlyArray(__state[0].ToArray())); AtOManager.Instance.mapVisitedNodesAction.AddRange(new <>z__ReadOnlyArray(__state[1].ToArray())); } } [HarmonyPrefix] [HarmonyPatch(typeof(MapManager), "AssignGameNodes")] public static void AssignGameNodesPre(ref MapManager __instance, out string[][] __state) { __state = new string[2][] { AtOManager.Instance.mapVisitedNodes.ToArray(), AtOManager.Instance.mapVisitedNodesAction.ToArray() }; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { AtOManager.Instance.mapVisitedNodes.Clear(); AtOManager.Instance.mapVisitedNodesAction.Clear(); } } [HarmonyPostfix] [HarmonyPatch(typeof(MapManager), "AssignGameNodes")] public static void AssignGameNodesPost(ref MapManager __instance, string[][] __state) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { AtOManager.Instance.mapVisitedNodes.AddRange(new <>z__ReadOnlyArray(__state[0].ToArray())); AtOManager.Instance.mapVisitedNodesAction.AddRange(new <>z__ReadOnlyArray(__state[1].ToArray())); } } [HarmonyPrefix] [HarmonyPatch(typeof(CinematicManager), "DoCinematic")] public static bool DoCinematicPre(ref CinematicManager __instance, ref CinematicData ___cinematicData) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge()) { return true; } if (AtOManager.Instance.CinematicId == "intro" && AtOManager.Instance.GetActNumberForText("") > 1) { GameManager.Instance.ChangeScene("Map"); return false; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(AtOManager), "FinishGame")] public static bool FinishGame(ref AtOManager __instance, ref CombatData ___currentCombatData) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge()) { return true; } if (___currentCombatData.CombatId == "evoidhigh_13b") { return false; } return true; } [HarmonyPostfix] [HarmonyPatch(typeof(MapManager), "SetPositionInCurrentNode")] public static void SetPositionInCurrentNode(ref MapManager __instance, ref bool __result) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || __result || !(AtOManager.Instance.currentMapNode == "voidhigh_13") || !AtOManager.Instance.bossesKilledName.Any((string s) => s.StartsWith("archonnihr", StringComparison.OrdinalIgnoreCase))) { return; } CombatData currentCombatData = AtOManager.Instance.GetCurrentCombatData(); CombatData combatData = Globals.Instance.GetCombatData((currentCombatData != null) ? currentCombatData.CombatId : null); if ((Object)(object)currentCombatData != (Object)(object)combatData) { AtOManager.Instance.SetCombatData(combatData); currentCombatData = AtOManager.Instance.GetCurrentCombatData(); } if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_perks"), "")) { if ((Object)(object)currentCombatData.EventData != (Object)(object)Globals.Instance.GetEventData("e_endless_perk")) { currentCombatData.EventData = Globals.Instance.GetEventData("e_endless_perk"); } } else if (AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_allow_blessings"), "") && AtOManager.Instance.PlayerHasRequirement(Globals.Instance.GetRequirementData("endless_pick_blessing"), "") && (Object)(object)currentCombatData.EventData != (Object)(object)Globals.Instance.GetEventData("e_endless_blessing")) { currentCombatData.EventData = Globals.Instance.GetEventData("e_endless_blessing"); } __result = true; } [HarmonyPostfix] [HarmonyPatch(typeof(IntroNewGameManager), "DoIntro")] public static void DoIntro(ref IntroNewGameManager __instance) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { __instance.title.text = __instance.title.text.Replace(string.Format(Texts.Instance.GetText("actNumber", ""), AtOManager.Instance.GetTownTier() + 2), string.Format(Texts.Instance.GetText("actNumber", ""), AtOManager.Instance.GetActNumberForText(""))); } } [HarmonyPostfix] [HarmonyPatch(typeof(MenuSaveButton), "SetGameData")] public static void SetGameData(ref MenuSaveButton __instance, GameData _gameData) { if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge()) { __instance.descriptionText.text = __instance.descriptionText.text.Replace(string.Format(Texts.Instance.GetText("actNumber", ""), Math.Min(4, _gameData.TownTier + 1)), string.Format(Texts.Instance.GetText("actNumber", ""), _gameData.TownTier + 1)); } } [HarmonyPrefix] [HarmonyPatch(typeof(SteamManager), "SetScore")] public static bool SetScore() { return false; } [HarmonyPrefix] [HarmonyPatch(typeof(SteamManager), "SetObeliskScore")] public static bool SetObeliskScore() { return false; } [HarmonyPrefix] [HarmonyPatch(typeof(SteamManager), "SetSingularityScore")] public static bool SetSingularityScore() { return false; } [HarmonyPrefix] [HarmonyPatch(typeof(SteamManager), "SetWeeklyScore")] public static bool SetWeeklyScore() { return false; } [HarmonyPrefix] [HarmonyPatch(typeof(MatchManager), "CastCardAction")] public static void CastCardAction(MatchManager __instance, ref CardRealtimeData _cardActive, Transform targetTransformCast, ref CardItem theCardItem, string _uniqueCastId, bool _automatic, ref CardRealtimeData _card, int _cardIterationTotal, int _cardSpecialValueGlobal) { if (!_automatic) { if (theCardItem.CardData.KillPet) { DisableKillPet(theCardItem.CardData); } } else if (_cardActive == (CardRealtimeData)null && _card != (CardRealtimeData)null) { if (_card.KillPet) { DisableKillPet(_card); } } else if (_cardActive.KillPet) { DisableKillPet(_cardActive); } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "AuraCurseImmunitiesByItemsList")] public static void AuraCurseImmunitiesByItemsListPre(ref Character __instance) { if (!GameManager.Instance.IsObeliskChallenge()) { GameManager.Instance.IsWeeklyChallenge(); } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "AuraCurseImmunitiesByItemsList")] public static void AuraCurseImmunitiesByItemsListPost(ref Character __instance, ref List __result, ref HeroData ___heroData, ref string ___subclassName) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || !((Object)(object)___heroData != (Object)null)) { return; } foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null) { if ((Object)(object)cardData.Item.AuracurseImmune1 != (Object)null && !__result.Contains(cardData.Item.AuracurseImmune1.Id)) { __result.Add(cardData.Item.AuracurseImmune1.Id); } if ((Object)(object)cardData.Item.AuracurseImmune2 != (Object)null && !__result.Contains(cardData.Item.AuracurseImmune2.Id)) { __result.Add(cardData.Item.AuracurseImmune2.Id); } } } if (__result.Contains("bleed") && AtOManager.Instance.team.CharacterHavePerk(___subclassName, "mainperkfury1c")) { __result.Remove("bleed"); } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "AuraCurseImmuneByItems")] public static void AuraCurseImmuneByItemsPre(ref Character __instance, string acName, out bool __state, ref bool ___useCache, ref Dictionary ___cacheAuraCurseImmuneByItems) { __state = false; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && (Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheAuraCurseImmuneByItems.ContainsKey(acName)) { __state = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "AuraCurseImmuneByItems")] public static void AuraCurseImmuneByItemsPost(ref Character __instance, string acName, bool __state, ref bool __result, ref bool ___useCache, ref Dictionary ___cacheAuraCurseImmuneByItems, ref HeroData ___heroData, ref string ___subclassName) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || __state || (!__result && acName == "bleed" && AtOManager.Instance.team.CharacterHavePerk(___subclassName, "mainperkfury1c")) || !((Object)(object)___heroData != (Object)null)) { return; } foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (!(cardData != (CardRealtimeData)null) || !((Object)(object)cardData.Item != (Object)null)) { continue; } if ((Object)(object)cardData.Item.AuracurseImmune1 != (Object)null && cardData.Item.AuracurseImmune1.Id == acName) { if (___cacheAuraCurseImmuneByItems.ContainsKey(acName)) { ___cacheAuraCurseImmuneByItems[acName] = true; } else { ___cacheAuraCurseImmuneByItems.Add(acName, value: true); } __result = true; break; } if ((Object)(object)cardData.Item.AuracurseImmune2 != (Object)null && cardData.Item.AuracurseImmune2.Id == acName) { if (___cacheAuraCurseImmuneByItems.ContainsKey(acName)) { ___cacheAuraCurseImmuneByItems[acName] = true; } else { ___cacheAuraCurseImmuneByItems.Add(acName, value: true); } __result = true; break; } } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemsMaxHPModifier")] public static void GetItemsMaxHPModifierPost(ref Character __instance, ref int __result, ref HeroData ___heroData, ref string ___subclassName) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || !((Object)(object)___heroData != (Object)null)) { return; } foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null && cardData.Item.MaxHealth != 0) { __result += cardData.Item.MaxHealth; } } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "GetItemHealFlatBonus")] public static void GetItemHealFlatBonusPre(ref Character __instance, out bool __state, ref bool ___useCache, ref List ___cacheGetItemHealFlatBonus) { __state = false; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && (Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemHealFlatBonus.Count > 0) { __state = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemHealFlatBonus")] public static void GetItemHealFlatBonusPost(ref Character __instance, bool __state, ref int __result, ref bool ___useCache, ref List ___cacheGetItemHealFlatBonus, ref HeroData ___heroData, ref string ___subclassName) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || __state || !((Object)(object)___heroData != (Object)null)) { return; } bool flag = false; foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null && cardData.Item.HealFlatBonus != 0) { __result += cardData.Item.HealFlatBonus; flag = true; } } if ((Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemHealFlatBonus.Count > 0 && flag) { ___cacheGetItemHealFlatBonus[0] = __result; } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "GetItemHealPercentBonus")] public static void GetItemHealPercentBonusPre(ref Character __instance, out bool __state, ref bool ___useCache, ref List ___cacheGetItemHealPercentBonus) { __state = false; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && (Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemHealPercentBonus.Count > 0) { __state = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemHealPercentBonus")] public static void GetItemHealPercentBonusPost(ref Character __instance, bool __state, ref float __result, ref bool ___useCache, ref List ___cacheGetItemHealPercentBonus, ref HeroData ___heroData, ref string ___subclassName) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || __state || !((Object)(object)___heroData != (Object)null)) { return; } bool flag = false; foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null && (double)cardData.Item.HealPercentBonus != 0.0) { __result += cardData.Item.HealPercentBonus; flag = true; } } if ((Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemHealPercentBonus.Count > 0 && flag) { ___cacheGetItemHealPercentBonus[0] = __result; } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "GetItemHealReceivedFlatBonus")] public static void GetItemHealReceivedFlatBonusPre(ref Character __instance, out bool __state, ref bool ___useCache, ref List ___cacheGetItemHealReceivedFlatBonus) { __state = false; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && (Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemHealReceivedFlatBonus.Count > 0) { __state = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemHealReceivedFlatBonus")] public static void GetItemHealReceivedFlatBonusPost(ref Character __instance, bool __state, ref int __result, ref bool ___useCache, ref List ___cacheGetItemHealReceivedFlatBonus, ref HeroData ___heroData, ref string ___subclassName) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || __state || !((Object)(object)___heroData != (Object)null)) { return; } bool flag = false; foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null && cardData.Item.HealReceivedFlatBonus != 0) { __result += cardData.Item.HealReceivedFlatBonus; flag = true; } } if ((Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemHealReceivedFlatBonus.Count > 0 && flag) { ___cacheGetItemHealReceivedFlatBonus[0] = __result; } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "GetItemHealReceivedPercentBonus")] public static void GetItemHealReceivedPercentBonusPre(ref Character __instance, out bool __state, ref bool ___useCache, ref List ___cacheGetItemHealReceivedPercentBonus) { __state = false; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && (Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemHealReceivedPercentBonus.Count > 0) { __state = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemHealReceivedPercentBonus")] public static void GetItemHealReceivedPercentBonusPost(ref Character __instance, bool __state, ref float __result, ref bool ___useCache, ref List ___cacheGetItemHealReceivedPercentBonus, ref HeroData ___heroData, ref string ___subclassName) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || __state || !((Object)(object)___heroData != (Object)null)) { return; } bool flag = false; foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null && (double)cardData.Item.HealReceivedPercentBonus != 0.0) { __result += cardData.Item.HealReceivedPercentBonus; flag = true; } } if ((Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemHealReceivedPercentBonus.Count > 0 && flag) { ___cacheGetItemHealReceivedPercentBonus[0] = __result; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemHealPercentDictionary")] public static void GetItemHealPercentDictionaryPost(ref Character __instance, ref Dictionary __result, ref HeroData ___heroData) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || !((Object)(object)___heroData != (Object)null)) { return; } foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null && (double)cardData.Item.HealPercentBonus != 0.0) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(cardData.CardName); stringBuilder.Append("_card"); __result.Add(stringBuilder.ToString(), (int)cardData.Item.HealPercentBonus); } } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemHealFlatDictionary")] public static void GetItemHealFlatDictionaryPost(ref Character __instance, ref Dictionary __result, ref HeroData ___heroData) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || !((Object)(object)___heroData != (Object)null)) { return; } foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null && (double)cardData.Item.HealFlatBonus != 0.0) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(cardData.CardName); stringBuilder.Append("_card"); __result.Add(stringBuilder.ToString(), cardData.Item.HealFlatBonus); } } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "GetItemAuraCurseModifiers")] public static void GetItemAuraCurseModifiersPre(ref Character __instance, out bool __state, ref bool ___useCache, ref Dictionary ___cacheGetItemAuraCurseModifiers) { __state = false; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && (Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemAuraCurseModifiers.Count > 0) { __state = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemAuraCurseModifiers")] public static void GetItemAuraCurseModifiersPost(ref Character __instance, bool __state, ref Dictionary __result, ref bool ___useCache, ref Dictionary ___cacheGetItemAuraCurseModifiers, ref HeroData ___heroData, ref string ___subclassName) { if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || __state || !((Object)(object)___heroData != (Object)null)) { return; } bool flag = false; foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (!(cardData != (CardRealtimeData)null) || !((Object)(object)cardData.Item != (Object)null)) { continue; } if ((Object)(object)cardData.Item.AuracurseBonus1 != (Object)null) { if (__result.ContainsKey(cardData.Item.AuracurseBonus1.Id)) { __result[cardData.Item.AuracurseBonus1.Id] += cardData.Item.AuracurseBonusValue1; } else { __result[cardData.Item.AuracurseBonus1.Id] = cardData.Item.AuracurseBonusValue1; } flag = true; } if ((Object)(object)cardData.Item.AuracurseBonus2 != (Object)null) { if (__result.ContainsKey(cardData.Item.AuracurseBonus2.Id)) { __result[cardData.Item.AuracurseBonus2.Id] += cardData.Item.AuracurseBonusValue2; } else { __result[cardData.Item.AuracurseBonus2.Id] = cardData.Item.AuracurseBonusValue2; } flag = true; } } if ((Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemAuraCurseModifiers.Count > 0 && flag) { ___cacheGetItemAuraCurseModifiers = __result; } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "GetItemDamageFlatModifiers")] public static void GetItemDamageFlatModifiersPre(ref Character __instance, DamageType DamageType, out bool __state, ref bool ___useCache, ref Dictionary ___cacheGetItemDamageFlatModifiers) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) __state = false; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && (Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemDamageFlatModifiers.ContainsKey(DamageType)) { __state = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemDamageFlatModifiers")] public static void GetItemDamageFlatModifiersPost(ref Character __instance, DamageType DamageType, bool __state, ref int __result, ref bool ___useCache, ref Dictionary ___cacheGetItemDamageFlatModifiers, ref HeroData ___heroData) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_008a: Invalid comparison between Unknown and I4 //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Invalid comparison between Unknown and I4 //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Invalid comparison between Unknown and I4 if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || __state || !((Object)(object)___heroData != (Object)null)) { return; } bool flag = false; foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null) { if (cardData.Item.DamageFlatBonus == DamageType || (int)cardData.Item.DamageFlatBonus == 10) { __result += cardData.Item.DamageFlatBonusValue; flag = true; } if (cardData.Item.DamageFlatBonus2 == DamageType || (int)cardData.Item.DamageFlatBonus2 == 10) { __result += cardData.Item.DamageFlatBonusValue2; flag = true; } if (cardData.Item.DamageFlatBonus3 == DamageType || (int)cardData.Item.DamageFlatBonus3 == 10) { __result += cardData.Item.DamageFlatBonusValue3; flag = true; } flag = true; } } if ((Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemDamageFlatModifiers.ContainsKey(DamageType) && flag) { ___cacheGetItemDamageFlatModifiers[DamageType] = __result; } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "GetItemDamagePercentModifiers")] public static void GetItemDamagePercentModifiersPre(ref Character __instance, DamageType DamageType, out bool __state, ref bool ___useCache, ref Dictionary ___cacheGetItemDamagePercentModifiers) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) __state = false; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && (Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemDamagePercentModifiers.ContainsKey(DamageType)) { __state = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemDamagePercentModifiers")] public static void GetItemDamagePercentModifiersPost(ref Character __instance, DamageType DamageType, bool __state, ref float __result, ref bool ___useCache, ref Dictionary ___cacheGetItemDamagePercentModifiers, ref HeroData ___heroData) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_008a: Invalid comparison between Unknown and I4 //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Invalid comparison between Unknown and I4 //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Invalid comparison between Unknown and I4 if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || __state || !((Object)(object)___heroData != (Object)null)) { return; } bool flag = false; foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null) { if (cardData.Item.DamagePercentBonus == DamageType || (int)cardData.Item.DamagePercentBonus == 10) { __result += cardData.Item.DamagePercentBonusValue; flag = true; } if (cardData.Item.DamagePercentBonus2 == DamageType || (int)cardData.Item.DamagePercentBonus2 == 10) { __result += cardData.Item.DamagePercentBonusValue2; flag = true; } if (cardData.Item.DamagePercentBonus3 == DamageType || (int)cardData.Item.DamagePercentBonus3 == 10) { __result += cardData.Item.DamagePercentBonusValue3; flag = true; } flag = true; } } if ((Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemDamagePercentModifiers.ContainsKey(DamageType) && flag) { ___cacheGetItemDamagePercentModifiers[DamageType] = __result; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemDamageDonePercentDictionary")] public static void GetItemDamageDonePercentDictionaryPost(ref Character __instance, DamageType DamageType, ref Dictionary __result, ref HeroData ___heroData) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 //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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Invalid comparison between Unknown and I4 if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || !((Object)(object)___heroData != (Object)null)) { return; } foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); float num = 0f; if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null) { if (cardData.Item.DamagePercentBonus == DamageType || (int)cardData.Item.DamagePercentBonus == 10) { num += cardData.Item.DamagePercentBonusValue; } if (cardData.Item.DamagePercentBonus2 == DamageType || (int)cardData.Item.DamagePercentBonus2 == 10) { num += cardData.Item.DamagePercentBonusValue2; } if (cardData.Item.DamagePercentBonus3 == DamageType || (int)cardData.Item.DamagePercentBonus3 == 10) { num += cardData.Item.DamagePercentBonusValue3; } if ((double)num != 0.0) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(cardData.CardName); stringBuilder.Append("_card"); __result.Add(stringBuilder.ToString(), (int)num); } } } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemDamageDoneDictionary")] public static void GetItemDamageDoneDictionaryPost(ref Character __instance, DamageType DamageType, ref Dictionary __result, ref HeroData ___heroData) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Invalid comparison between Unknown and I4 if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || !((Object)(object)___heroData != (Object)null)) { return; } foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); int num = 0; if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null) { if (cardData.Item.DamageFlatBonus == DamageType || (int)cardData.Item.DamageFlatBonus == 10) { num += cardData.Item.DamageFlatBonusValue; } if (cardData.Item.DamageFlatBonus2 == DamageType || (int)cardData.Item.DamageFlatBonus2 == 10) { num += cardData.Item.DamageFlatBonusValue2; } if (cardData.Item.DamageFlatBonus3 == DamageType || (int)cardData.Item.DamageFlatBonus3 == 10) { num += cardData.Item.DamageFlatBonusValue3; } if (num != 0) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(cardData.CardName); stringBuilder.Append("_card"); __result.Add(stringBuilder.ToString(), num); } } } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "GetItemResistModifiers")] public static void GetItemResistModifiersPre(ref Character __instance, DamageType type, out bool __state, ref bool ___useCache, ref Dictionary ___cacheGetItemResistModifiers) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) __state = false; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && (Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemResistModifiers.ContainsKey(type)) { __state = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemResistModifiers")] public static void GetItemResistModifiersPost(ref Character __instance, DamageType type, bool __state, ref int __result, ref bool ___useCache, ref Dictionary ___cacheGetItemResistModifiers, ref HeroData ___heroData) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_008a: Invalid comparison between Unknown and I4 //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Invalid comparison between Unknown and I4 //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Invalid comparison between Unknown and I4 if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || __state || !((Object)(object)___heroData != (Object)null)) { return; } bool flag = false; foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null) { if (cardData.Item.ResistModified1 == type || (int)cardData.Item.ResistModified1 == 10) { __result += cardData.Item.ResistModifiedValue1; flag = true; } if (cardData.Item.ResistModified2 == type || (int)cardData.Item.ResistModified2 == 10) { __result += cardData.Item.ResistModifiedValue2; flag = true; } if (cardData.Item.ResistModified3 == type || (int)cardData.Item.ResistModified3 == 10) { __result += cardData.Item.ResistModifiedValue3; flag = true; } flag = true; } } if ((Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemResistModifiers.ContainsKey(type) && flag) { ___cacheGetItemResistModifiers[type] = __result; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemResistModifiersDictionary")] public static void GetItemResistModifiersDictionaryPost(ref Character __instance, DamageType type, ref Dictionary __result, ref HeroData ___heroData) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Invalid comparison between Unknown and I4 if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || !((Object)(object)___heroData != (Object)null)) { return; } foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); int num = 0; if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null) { if (cardData.Item.ResistModified1 == type || (int)cardData.Item.ResistModified1 == 10) { num += cardData.Item.ResistModifiedValue1; } if (cardData.Item.ResistModified2 == type || (int)cardData.Item.ResistModified2 == 10) { num += cardData.Item.ResistModifiedValue2; } if (cardData.Item.ResistModified3 == type || (int)cardData.Item.ResistModified3 == 10) { num += cardData.Item.ResistModifiedValue3; } if (num != 0) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(cardData.CardName); stringBuilder.Append("_card"); __result.Add(stringBuilder.ToString(), num); } } } } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "GetItemStatModifiers")] public static void GetItemStatModifiersPre(ref Character __instance, CharacterStat stat, out bool __state, ref bool ___useCache, ref Dictionary ___cacheGetItemStatModifiers) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) __state = false; if (!GameManager.Instance.IsObeliskChallenge() && !GameManager.Instance.IsWeeklyChallenge() && (Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemStatModifiers.ContainsKey(stat)) { __state = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(Character), "GetItemStatModifiers")] public static void GetItemStatModifiersPost(ref Character __instance, CharacterStat stat, bool __state, ref int __result, ref bool ___useCache, ref Dictionary ___cacheGetItemStatModifiers, ref HeroData ___heroData) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) if (GameManager.Instance.IsObeliskChallenge() || GameManager.Instance.IsWeeklyChallenge() || __state || !((Object)(object)___heroData != (Object)null)) { return; } bool flag = false; foreach (string activeBlessing in activeBlessings) { CardRealtimeData cardData = Globals.Instance.GetCardData(activeBlessing, true); if (cardData != (CardRealtimeData)null && (Object)(object)cardData.Item != (Object)null) { if (cardData.Item.CharacterStatModified == stat) { __result += cardData.Item.CharacterStatModifiedValue; flag = true; } if (cardData.Item.CharacterStatModified2 == stat) { __result += cardData.Item.CharacterStatModifiedValue2; flag = true; } if (cardData.Item.CharacterStatModified3 == stat) { __result += cardData.Item.CharacterStatModifiedValue3; flag = true; } flag = true; } } if ((Object.op_Implicit((Object)(object)MatchManager.Instance) & ___useCache) && ___cacheGetItemStatModifiers.ContainsKey(stat) && flag) { ___cacheGetItemStatModifiers[stat] = __result; } } } [BepInPlugin("com.corgan.AtOEndless", "AtOEndless", "1.0.3")] [BepInProcess("AcrossTheObelisk.exe")] public class Plugin : BaseUnityPlugin { internal int ModDate = int.Parse(DateTime.Today.ToString("yyyyMMdd")); private readonly Harmony harmony = new Harmony("com.corgan.AtOEndless"); internal static ManualLogSource Log; public static string debugBase = "com.corgan.AtOEndless "; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"com.corgan.AtOEndless 1.0.3 has loaded!"); LogDebug("Excuting Patches"); harmony.PatchAll(); } internal static void LogDebug(string msg) { Log.LogDebug((object)(debugBase + msg)); } internal static void LogInfo(string msg) { Log.LogInfo((object)(debugBase + msg)); } internal static void LogError(string msg) { Log.LogError((object)(debugBase + msg)); } } public static class PluginInfo { public const string PLUGIN_GUID = "com.corgan.AtOEndless"; public const string PLUGIN_NAME = "AtOEndless"; public const string PLUGIN_VERSION = "1.0.3"; } }