Decompiled source of TFOLMod v0.2.6
TFOLMod.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks.CompilerServices; using DG.Tweening; using DG.Tweening.Core; using DG.Tweening.Plugins.Options; using HarmonyLib; using JetBrains.Annotations; using LBoL.Base; using LBoL.Base.Extensions; using LBoL.ConfigData; using LBoL.Core; using LBoL.Core.Battle; using LBoL.Core.Battle.BattleActions; using LBoL.Core.Battle.Interactions; using LBoL.Core.Cards; using LBoL.Core.Intentions; using LBoL.Core.Randoms; using LBoL.Core.Stations; using LBoL.Core.StatusEffects; using LBoL.Core.Units; using LBoL.EntityLib.Cards.Adventure; using LBoL.EntityLib.Cards.Character.Cirno; using LBoL.EntityLib.Cards.Character.Cirno.Friend; using LBoL.EntityLib.Cards.Character.Koishi; using LBoL.EntityLib.Cards.Character.Marisa; using LBoL.EntityLib.Cards.Character.Reimu; using LBoL.EntityLib.Cards.Character.Sakuya; using LBoL.EntityLib.Cards.Enemy; using LBoL.EntityLib.Cards.Neutral.Black; using LBoL.EntityLib.Cards.Neutral.Blue; using LBoL.EntityLib.Cards.Neutral.Green; using LBoL.EntityLib.Cards.Neutral.MultiColor; using LBoL.EntityLib.Cards.Neutral.NoColor; using LBoL.EntityLib.Cards.Neutral.Red; using LBoL.EntityLib.Cards.Neutral.TwoColor; using LBoL.EntityLib.Cards.Neutral.White; using LBoL.EntityLib.EnemyUnits.Character; using LBoL.EntityLib.EnemyUnits.Normal; using LBoL.EntityLib.EnemyUnits.Normal.Drones; using LBoL.EntityLib.EnemyUnits.Normal.Maoyus; using LBoL.EntityLib.EnemyUnits.Opponent; using LBoL.EntityLib.Exhibits; using LBoL.EntityLib.Exhibits.Shining; using LBoL.EntityLib.PlayerUnits; using LBoL.EntityLib.StatusEffects.Basic; using LBoL.EntityLib.StatusEffects.Cirno; using LBoL.EntityLib.StatusEffects.Enemy; using LBoL.EntityLib.StatusEffects.Enemy.Seija; using LBoL.EntityLib.StatusEffects.Neutral.MultiColor; using LBoL.EntityLib.StatusEffects.Others; using LBoL.Presentation; using LBoL.Presentation.Effect; using LBoL.Presentation.UI; using LBoL.Presentation.UI.ExtraWidgets; using LBoL.Presentation.UI.Panels; using LBoL.Presentation.UI.Widgets; using LBoL.Presentation.Units; using LBoLEntitySideloader; using LBoLEntitySideloader.Attributes; using LBoLEntitySideloader.CustomHandlers; using LBoLEntitySideloader.CustomKeywords; using LBoLEntitySideloader.Entities; using LBoLEntitySideloader.PersistentValues; using LBoLEntitySideloader.Resource; using LBoLEntitySideloader.Utils; using Spine.Unity; using TFOLMod; using TFOLMod.BattleActions; using TFOLMod.Cards; using TFOLMod.Cards.B; using TFOLMod.Cards.Template; using TFOLMod.Config; using TFOLMod.Enemies.Template; using TFOLMod.Exhibits; using TFOLMod.GunName; using TFOLMod.Helpers; using TFOLMod.ImageLoader; using TFOLMod.Keywords; using TFOLMod.Localization; using TFOLMod.Patches; using TFOLMod.Perks; using TFOLMod.StatusEffects; using TFOLMod.UI; using TFOLMod.Ui; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Experimental.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("LBoL.Base")] [assembly: IgnoresAccessChecksTo("LBoL.ConfigData")] [assembly: IgnoresAccessChecksTo("LBoL.Core")] [assembly: IgnoresAccessChecksTo("LBoL.EntityLib")] [assembly: IgnoresAccessChecksTo("LBoL.Presentation")] [assembly: IgnoresAccessChecksTo("Untitled.ConfigDataBuilder.Base")] [assembly: AssemblyCompany("TFOLMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9f09016df1c6b41ae7c24949df370daf8089c9e6")] [assembly: AssemblyProduct("TFOLMod")] [assembly: AssemblyTitle("TFOLMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] public class SouvenirSaveData : CustomGameRunSaveData { public override string Name => "SouvenirPerkData"; public string StoredCardId { get; set; } public override void Save(GameRunController gameRun) { if (gameRun.Player is TFOLModDef.TFOLMod) { StoredCardId = SouvenirState.StoredCardId; } } public override void Restore(GameRunController gameRun) { if (gameRun.Player is TFOLModDef.TFOLMod) { if (string.IsNullOrEmpty(StoredCardId)) { SouvenirState.Initialize(); } else { SouvenirState.LoadFromSave(StoredCardId); } } } } public class DoubleDogDareSaveData : CustomGameRunSaveData { public override string Name => "DoubleDogDareMemories"; public Dictionary<int, List<string>> ChosenCardIds { get; set; } = new Dictionary<int, List<string>>(); public override void Save(GameRunController gameRun) { ChosenCardIds = DoubleDogDareState.ChosenCardIds; } public override void Restore(GameRunController gameRun) { if (ChosenCardIds == null || ChosenCardIds.Count == 0) { DoubleDogDareState.Initialize(); } else { DoubleDogDareState.LoadFromSave(ChosenCardIds); } } } [Flags] public enum CardZoneFlags { None = 0, Hand = 1, Draw = 2, Discard = 4, Exile = 8, Deck = 6, Battle = 7, All = 0xF } [HarmonyPatch] internal class GameStatePatches { [HarmonyPatch(typeof(UiManager), "LeaveGameRun")] [HarmonyPostfix] private static void ResetManagerOnRunEnd() { if (PlayerTeamManager.IsInitialized) { PlayerTeamManager.Reset(); } } } public class PositionController : MonoBehaviour { private Vector3 _originalPosition; private Vector3 _offset; private bool _isInitialized = false; public Vector3 TargetPosition { get; private set; } public void Initialize(Vector3 offset) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) _originalPosition = ((Component)this).transform.position; _offset = offset; TargetPosition = _originalPosition + _offset; ((Component)this).transform.position = TargetPosition; _isInitialized = true; } private void LateUpdate() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (_isInitialized) { ((Component)this).transform.position = TargetPosition; } } } namespace TFOLMod { [BepInPlugin("Vengyre.LBoL.Character.TFOL", "TFOLMod", "0.2.6")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("LBoL.exe")] public class BepinexPlugin : BaseUnityPlugin { public static string modUniqueID = "TFOLMod"; public static string playerName = "TFOL"; public static string mainPlayerModel = "Sunny"; public static List<string> sidekickModels = new List<string> { "Luna", "Star" }; public static bool useInGameModel = true; public static string modelName = mainPlayerModel; public static bool modelIsFlipped = true; public static List<ManaColor> offColors = new List<ManaColor> { (ManaColor)5, (ManaColor)3, (ManaColor)6 }; public static ConfigEntry<bool> enableAct1Boss; public static CustomConfigEntry<bool> enableAct1BossEntry = new CustomConfigEntry<bool>(value: false, "EnableAct1Boss", "EnableAct1Boss", "Toggle the Act 1 boss. Default: Off"); private static readonly Harmony harmony = PInfo.harmony; internal static ManualLogSource log; internal static TemplateSequenceTable sequenceTable = new TemplateSequenceTable(0); internal static IResourceSource embeddedSource = (IResourceSource)new EmbeddedSource(Assembly.GetExecutingAssembly()); internal static DirectorySource directorySource = new DirectorySource("Vengyre.LBoL.Character.TFOL", ""); internal static PerkSaveData PerkSaveData = new PerkSaveData(); internal static FormationSaveData FormationSaveData = new FormationSaveData(); internal static DoubleDogDareSaveData DoubleDogDareSaveData = new DoubleDogDareSaveData(); internal static SouvenirSaveData SouvenirSaveData = new SouvenirSaveData(); private void Awake() { log = ((BaseUnityPlugin)this).Logger; enableAct1Boss = ((BaseUnityPlugin)this).Config.Bind<bool>(enableAct1BossEntry.Section, enableAct1BossEntry.Key, enableAct1BossEntry.Value, enableAct1BossEntry.Description); Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; CardIndexGenerator.PromiseClearIndexSet(); EntityManager.RegisterSelf(); ModResources.Load(); PerkManager.Initialize(); RollBlacklistManager.Initialize(); TempReplenishHandler.RegisterHandlers(); ((CustomGameRunSaveData)PerkSaveData).RegisterSelf("Vengyre.LBoL.Character.TFOL"); ((CustomGameRunSaveData)FormationSaveData).RegisterSelf("Vengyre.LBoL.Character.TFOL"); ((CustomGameRunSaveData)DoubleDogDareSaveData).RegisterSelf("Vengyre.LBoL.Character.TFOL"); ((CustomGameRunSaveData)SouvenirSaveData).RegisterSelf("Vengyre.LBoL.Character.TFOL"); YuukaIntegration.Initialize(log); CardTagManager.RegisterDynamicTags(); harmony.PatchAll(); Func<Sprite> func = () => ResourceLoader.LoadSprite("BossIcon.png", (IResourceSource)(object)directorySource, (Rect?)null, 1, (Vector2?)null); EnemyUnitTemplate.AddBossNodeIcon("TFOLMod", func, (Assembly)null); } private void OnDestroy() { if (harmony != null) { harmony.UnpatchSelf(); } } } public static class PInfo { public const string GUID = "Vengyre.LBoL.Character.TFOL"; public const string Name = "TFOLMod"; public const string version = "0.2.6"; public static readonly Harmony harmony = new Harmony("Vengyre.LBoL.Character.TFOL"); } public static class FormationSelection { [CompilerGenerated] private sealed class <SelectFormationInteraction>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private List<Card> <choices>5__1; private SelectCardInteraction <interaction>5__2; private Card <selectedCard>5__3; private Dictionary<TeamPosition, Fairy> <newFormation>5__4; private bool <isGapNode>5__5; private Station <currentStation>5__6; private bool <flag>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SelectFormationInteraction>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <choices>5__1 = null; <interaction>5__2 = null; <selectedCard>5__3 = null; <newFormation>5__4 = null; <currentStation>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Invalid comparison between Unknown and I4 //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Invalid comparison between Unknown and I4 //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Invalid comparison between Unknown and I4 //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Invalid comparison between Unknown and I4 switch (<>1__state) { default: return false; case 0: <>1__state = -1; <choices>5__1 = new List<Card> { (Card)(object)Library.CreateCard<TFOLFormationSunnyLunaStar>(), (Card)(object)Library.CreateCard<TFOLFormationSunnyStarLuna>(), (Card)(object)Library.CreateCard<TFOLFormationLunaSunnyStar>(), (Card)(object)Library.CreateCard<TFOLFormationLunaStarSunny>(), (Card)(object)Library.CreateCard<TFOLFormationStarSunnyLuna>(), (Card)(object)Library.CreateCard<TFOLFormationStarLunaSunny>() }; <interaction>5__2 = new SelectCardInteraction(0, 1, (IEnumerable<Card>)<choices>5__1, (SelectedCardHandling)0); <>2__current = Singleton<GameMaster>.Instance.CurrentGameRun.InteractionViewer.View((Interaction)(object)<interaction>5__2); <>1__state = 1; return true; case 1: <>1__state = -1; if (<interaction>5__2.SelectedCards.Count > 0) { <selectedCard>5__3 = <interaction>5__2.SelectedCards.First(); BepinexPlugin.log.LogInfo((object)("[FORMATION CHANGE] Player selected: " + ((GameEntity)<selectedCard>5__3).Name)); <newFormation>5__4 = new Dictionary<TeamPosition, Fairy>(); if (<selectedCard>5__3 is TFOLFormationSunnyLunaStar) { <newFormation>5__4[TeamPosition.Front] = Fairy.Sunny; <newFormation>5__4[TeamPosition.Mid] = Fairy.Luna; <newFormation>5__4[TeamPosition.Back] = Fairy.Star; } else if (<selectedCard>5__3 is TFOLFormationSunnyStarLuna) { <newFormation>5__4[TeamPosition.Front] = Fairy.Sunny; <newFormation>5__4[TeamPosition.Mid] = Fairy.Star; <newFormation>5__4[TeamPosition.Back] = Fairy.Luna; } else if (<selectedCard>5__3 is TFOLFormationStarSunnyLuna) { <newFormation>5__4[TeamPosition.Front] = Fairy.Star; <newFormation>5__4[TeamPosition.Mid] = Fairy.Sunny; <newFormation>5__4[TeamPosition.Back] = Fairy.Luna; } else if (<selectedCard>5__3 is TFOLFormationStarLunaSunny) { <newFormation>5__4[TeamPosition.Front] = Fairy.Star; <newFormation>5__4[TeamPosition.Mid] = Fairy.Luna; <newFormation>5__4[TeamPosition.Back] = Fairy.Sunny; } else if (<selectedCard>5__3 is TFOLFormationLunaSunnyStar) { <newFormation>5__4[TeamPosition.Front] = Fairy.Luna; <newFormation>5__4[TeamPosition.Mid] = Fairy.Sunny; <newFormation>5__4[TeamPosition.Back] = Fairy.Star; } else if (<selectedCard>5__3 is TFOLFormationLunaStarSunny) { <newFormation>5__4[TeamPosition.Front] = Fairy.Luna; <newFormation>5__4[TeamPosition.Mid] = Fairy.Star; <newFormation>5__4[TeamPosition.Back] = Fairy.Sunny; } if (<newFormation>5__4.Count == 3) { PlayerTeamState.SetDefaultFormation(<newFormation>5__4); PlayerTeamState.ResetToDefault(); <isGapNode>5__5 = false; <currentStation>5__6 = Singleton<GameMaster>.Instance.CurrentGameRun.CurrentStation; <flag>5__7 = (int)<currentStation>5__6.Type == 4 || (int)<currentStation>5__6.Type == 6 || (int)<currentStation>5__6.Type == 9 || (int)<currentStation>5__6.Type == 3; if ((<currentStation>5__6 != null) & <flag>5__7) { <isGapNode>5__5 = true; } if (!<isGapNode>5__5) { BepinexPlugin.log.LogInfo((object)"[FORMATION CHANGE] Updating visuals immediately."); PlayerTeamManager.UpdateAllVisualPositionsAndUI(); } else { BepinexPlugin.log.LogInfo((object)"[FORMATION CHANGE] In Gap Node. Skipping visual update to preserve hidden state."); } BepinexPlugin.log.LogInfo((object)"[FORMATION CHANGE] New formation applied!"); <currentStation>5__6 = null; } <selectedCard>5__3 = null; <newFormation>5__4 = null; } else { BepinexPlugin.log.LogInfo((object)"[FORMATION CHANGE] Selection cancelled."); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static void OnPerkButtonClicked() { GameMaster instance = Singleton<GameMaster>.Instance; object obj; if (instance == null) { obj = null; } else { GameRunController currentGameRun = instance.CurrentGameRun; obj = ((currentGameRun != null) ? currentGameRun.Battle : null); } if (obj != null) { BepinexPlugin.log.LogInfo((object)"[FORMATION CHANGE] In battle, exhibit click ignored."); return; } BepinexPlugin.log.LogInfo((object)"[FORMATION CHANGE] Initiating Formation Change."); ((MonoBehaviour)Singleton<GameMaster>.Instance).StartCoroutine(SelectFormationInteraction()); } [IteratorStateMachine(typeof(<SelectFormationInteraction>d__1))] private static IEnumerator SelectFormationInteraction() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SelectFormationInteraction>d__1(0); } } public static class RollBlacklistManager { private static readonly HashSet<Type> _blacklist = new HashSet<Type>(); public static void Initialize() { _blacklist.Add(typeof(FangxiangHeal)); _blacklist.Add(typeof(PoisonTeaParty)); _blacklist.Add(typeof(LigeluCard)); _blacklist.Add(typeof(RangziFanshu)); _blacklist.Add(typeof(YonglinUpgrade)); _blacklist.Add(typeof(QingeHeal)); _blacklist.Add(typeof(RingoJinghua)); _blacklist.Add(typeof(MystiaSing)); _blacklist.Add(typeof(LilyChun)); _blacklist.Add(typeof(SanaeRice)); _blacklist.Add(typeof(Shengyan)); _blacklist.Add(typeof(XingMoney)); _blacklist.Add(typeof(LimaoSchool)); _blacklist.Add(typeof(QingeUpgrade)); _blacklist.Add(typeof(MoguMaster)); _blacklist.Add(typeof(MarisaEat)); _blacklist.Add(typeof(JungleMaster)); BepinexPlugin.log.LogInfo((object)$"[CARD GEN] RollBlacklistManager initialized with {_blacklist.Count} cards."); } public static bool IsBlacklisted(CardConfig config) { Type type = TypeFactory<Card>.GetType(config.Id); if (type != null) { return _blacklist.Contains(type); } return false; } public static bool IsBlacklisted(Type cardType) { return _blacklist.Contains(cardType); } } public static class YuukaIntegration { private static bool isInitialized; public static bool IsYuukaModLoaded { get; private set; } public static Type YuukaBloomSeType { get; private set; } public static Type YuukaFervorNextTurnSeType { get; private set; } public static Type WriggleNightbugType { get; private set; } public static Type YuukaCharacterPendulumStrikeType { get; private set; } public static Type YuukaBossType { get; private set; } public static void Initialize(ManualLogSource log) { if (isInitialized) { return; } if (Chainloader.PluginInfos.TryGetValue("Vengyre.LBoL.Character.Yuuka", out var value)) { Assembly assembly = ((object)value.Instance).GetType().Assembly; if (assembly == null) { log.LogError((object)"Found Yuuka Mod, but could not retrieve assembly."); return; } IsYuukaModLoaded = true; log.LogInfo((object)("[INTEGRATION] Successfully linked with Yuuka Mod: " + assembly.GetName().Name)); YuukaBloomSeType = assembly.GetType("YuukaMod.StatusEffects.YuukaBloomSe"); YuukaFervorNextTurnSeType = assembly.GetType("YuukaMod.StatusEffects.YuukaFervorNextTurnSe"); WriggleNightbugType = assembly.GetType("YuukaMod.Cards.YuukaCharacterWriggleNightbug"); YuukaCharacterPendulumStrikeType = assembly.GetType("YuukaMod.Cards.YuukaCharacterPendulumStrike"); YuukaBossType = assembly.GetType("YuukaMod.Enemies.YuukaMod"); } else { log.LogInfo((object)"[INTEGRATION] Yuuka Mod not found."); } isInitialized = true; } } public class TFOLLoadouts { public static string UltimateSkillA = "TFOLUltA"; public static string UltimateSkillB = "TFOLUltB"; public static string ExhibitA = "TFOLExhibitA"; public static string ExhibitB = "TFOLExhibitB"; public static List<string> DeckA = new List<string> { "Shoot", "Shoot", "Boundary", "Boundary", "TFOLBasicAttackSunny", "TFOLBasicAttackStar", "TFOLBasicBlockLuna", "TFOLBasicBlockStar", "TFOLIceDissolver", "TFOLOnwards" }; public static List<string> DeckB = new List<string> { "Shoot", "Shoot", "Boundary", "Boundary", "TFOLBasicAttackSunny", "TFOLBasicAttackStar", "TFOLBasicBlockLuna", "TFOLBasicBlockSunny", "TFOLStarlightRain", "TFOLLunarShield" }; public static PlayerUnitConfig playerUnitConfig; static TFOLLoadouts() { //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown string modUniqueID = BepinexPlugin.modUniqueID; int? num = 0; ManaGroup val = default(ManaGroup); ((ManaGroup)(ref val)).White = 2; ((ManaGroup)(ref val)).Blue = 1; ((ManaGroup)(ref val)).Black = 0; ((ManaGroup)(ref val)).Red = 1; ((ManaGroup)(ref val)).Green = 0; ((ManaGroup)(ref val)).Colorless = 0; ((ManaGroup)(ref val)).Philosophy = 0; ManaGroup val2 = val; playerUnitConfig = new PlayerUnitConfig(modUniqueID, true, "", 0, 8, num, true, (int?)0, (ManaColor)4, (ManaColor)2, val2, "#c56f4e", 60, 5, 0, UltimateSkillA, UltimateSkillB, ExhibitA, ExhibitB, (IReadOnlyList<string>)DeckA, (IReadOnlyList<string>)DeckB, 3, 3); } } public class EnergyBarController : MonoBehaviour { private Image _energyImage; private Sprite _spriteState0; private Sprite _spriteState1; private Sprite _spriteState2; public void Initialize(Transform parent, Sprite sprite0, Sprite sprite1, Sprite sprite2) { //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_0097: 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_00c3: Unknown result type (might be due to invalid IL or missing references) _spriteState0 = sprite0; _spriteState1 = sprite1; _spriteState2 = sprite2; ((Object)((Component)this).gameObject).name = "EnergyBar_Display"; ((Component)this).transform.SetParent(parent, false); _energyImage = ((Component)this).gameObject.AddComponent<Image>(); ((Graphic)_energyImage).raycastTarget = false; RectTransform component = ((Component)this).gameObject.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = new Vector2(0f, 25f); component.sizeDelta = new Vector2(200f, 20f); UpdateVisuals(); ((Component)this).gameObject.SetActive(false); } public void SetVisible(bool isVisible) { if (((Component)this).gameObject.activeSelf != isVisible) { ((Component)this).gameObject.SetActive(isVisible); } } public void UpdateVisuals() { BepinexPlugin.log.LogInfo((object)"[MANAGING MOMENTUM] Trying to update visuals..."); if (!((Object)(object)_energyImage == (Object)null)) { BepinexPlugin.log.LogInfo((object)"[MANAGING MOMENTUM] The image is not null"); BepinexPlugin.log.LogInfo((object)$"[MANAGING MOMENTUM] Our current energy is: {PlayerEnergyState.CurrentEnergy}"); switch (PlayerEnergyState.CurrentEnergy) { case 0: _energyImage.sprite = _spriteState0; break; case 1: _energyImage.sprite = _spriteState1; break; case 2: _energyImage.sprite = _spriteState2; break; default: _energyImage.sprite = _spriteState0; break; } } } } public static class PlayerEnergyState { public const int MaxEnergy = 2; public static int CurrentEnergy { get; private set; } public static void Reset() { CurrentEnergy = 0; } public static void SetEnergy(int amount) { CurrentEnergy = Mathf.Clamp(amount, 0, 2); BepinexPlugin.log.LogInfo((object)$"[MANAGING MOMENTUM: SETTING ENERGY] Player energy set to: {CurrentEnergy}/{2}"); } public static void AddEnergy(int amount) { SetEnergy(CurrentEnergy + amount); } public static void BroadcastVisualUpdate() { if (!PlayerTeamManager.IsInitialized) { return; } BepinexPlugin.log.LogInfo((object)"[MANAGING MOMENTUM: VISUAL UPDATE] Broadcasting energy visual update to all team members..."); foreach (UnitView teamMember in PlayerTeamManager.TeamMembers) { if ((Object)(object)teamMember != (Object)null) { BepinexPlugin.log.LogInfo((object)"[MANAGING MOMENTUM: VISUAL UPDATE] Found a member for visual update..."); EnergyBarController energyBarFor = PlayerTeamManager.GetEnergyBarFor(teamMember); if ((Object)(object)energyBarFor != (Object)null) { BepinexPlugin.log.LogInfo((object)"[MANAGING MOMENTUM: VISUAL UPDATE] Updating the visuals for a single object..."); energyBarFor.UpdateVisuals(); } } } } public static void SetBarsVisibility(bool visible) { if (!PlayerTeamManager.IsInitialized) { return; } BepinexPlugin.log.LogInfo((object)$"[MANAGING MOMENTUM: VISUAL UPDATE] Setting energy bar visibility to: {visible}"); foreach (UnitView teamMember in PlayerTeamManager.TeamMembers) { if ((Object)(object)teamMember != (Object)null) { BepinexPlugin.log.LogInfo((object)"[MANAGING MOMENTUM: VISUAL UPDATE] Found a member for visibility..."); EnergyBarController energyBarFor = PlayerTeamManager.GetEnergyBarFor(teamMember); if ((Object)(object)energyBarFor != (Object)null) { BepinexPlugin.log.LogInfo((object)"[MANAGING MOMENTUM: VISUAL UPDATE] Enabling a single object..."); ((Component)energyBarFor).gameObject.SetActive(visible); } } } } } public static class PerkConfig { public static int PassivePerkSunnyCTempFp = 3; public static int PassivePerkSunnyKineticDraw = 1; public static int PassivePerkSunnyPermFpEOT = 1; public static int PassivePerkSunnyColorCorrection = 2; public static int PassivePerkAstromancyScry = 2; public static int PassivePerkStarFocusedAimValue1 = 2; public static int PassivePerkRummageDrawDiscard = 1; public static int PassivePerkParallaxMirror = 1; public static int PassivePerkFrontGuardBlock = 4; public static int PassivePerkAnnotateCards = 1; public static int PassivePerkCommonSenseGain = 1; public static int PassivePerkCommonSenseThreshold = 3; public static int MomentumPerkSunnyBDamage = 4; public static int MomentumPerkSunnyBGun = 825; public static int MomentumPerkLunaBBlock = 4; public static int MomentumPerkStarBScry = 2; } [HarmonyPatch] public static class BattleLogicPatches { [HarmonyPatch(typeof(BattleController), "Leave")] [HarmonyPrefix] public static void ResetTeamOnBattleEnd() { if (PlayerTeamManager.IsInitialized) { foreach (UnitView teamMember in PlayerTeamManager.TeamMembers) { if ((Object)(object)teamMember != (Object)null) { PerkTooltipController component = ((Component)teamMember).GetComponent<PerkTooltipController>(); if ((Object)(object)component != (Object)null) { component.ForceHide(); } } teamMember.HideName(); } } if (PlayerTeamManager.IsInitialized && (Object)(object)PlayerTeamManager.EffectHost != (Object)null) { BepinexPlugin.log.LogInfo((object)"[VISUALS] Battle ending. Forcing visual effect cleanup on EffectHost."); FieldInfo fieldInfo = AccessTools.Field(typeof(UnitView), "_effectDictionary"); if (fieldInfo.GetValue(PlayerTeamManager.EffectHost) is Dictionary<string, EffectWidget> dictionary) { BepinexPlugin.log.LogInfo((object)$"[VISUALS] Found {dictionary.Count} looping effects on host. Clearing them."); foreach (KeyValuePair<string, EffectWidget> item in new Dictionary<string, EffectWidget>(dictionary)) { if ((Object)(object)item.Value != (Object)null) { Object.Destroy((Object)(object)((Component)item.Value).gameObject); } } dictionary.Clear(); } } ClownpieceManager.Clear(); if (PlayerTeamState.IsInitialized) { PlayerTeamState.ResetToDefault(); BepinexPlugin.log.LogInfo((object)"[VISUALS] Team logical state has been reset to the run's default formation."); } if (PlayerTeamManager.IsInitialized) { PlayerTeamManager.ResetToDefaultVisuals(); BepinexPlugin.log.LogInfo((object)"[VISUALS] Team visual state has been reset to default."); } } } public static class ClownpieceManager { [CompilerGenerated] private sealed class <SpawnAsync>d__6 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskVoidMethodBuilder <>t__builder; private Transform <parent>5__1; private SkeletonDataAsset <skeletonData>5__2; private SkeletonAnimation <skeletonAnim>5__3; private SkeletonDataAsset <>s__4; private Exception <e>5__5; private Awaiter<SkeletonDataAsset> <>u__1; private void MoveNext() { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0075: 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_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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; try { if (num != 0) { } try { Awaiter<SkeletonDataAsset> awaiter; if (num == 0) { awaiter = <>u__1; <>u__1 = default(Awaiter<SkeletonDataAsset>); num = (<>1__state = -1); goto IL_00ff; } <parent>5__1 = ((Component)PlayerTeamManager.ActiveMember).transform.parent; if (!((Object)(object)<parent>5__1 == (Object)null)) { _clownpieceGo = new GameObject("Visual_Clownpiece"); _clownpieceGo.transform.SetParent(<parent>5__1, false); _clownpieceGo.transform.localPosition = _positionOffset; _clownpieceGo.transform.localScale = ((Component)PlayerTeamManager.ActiveMember).transform.localScale; awaiter = ResourcesHelper.LoadSpineUnitAsync("Clownpiece").GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <SpawnAsync>d__6 <SpawnAsync>d__ = this; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter<SkeletonDataAsset>, <SpawnAsync>d__6>(ref awaiter, ref <SpawnAsync>d__); return; } goto IL_00ff; } goto end_IL_0010; IL_00ff: <>s__4 = awaiter.GetResult(); <skeletonData>5__2 = <>s__4; <>s__4 = null; if ((Object)(object)<skeletonData>5__2 == (Object)null) { BepinexPlugin.log.LogError((object)"Could not load Spine data for Clownpiece"); Clear(); } else { <skeletonAnim>5__3 = SkeletonAnimation.NewSkeletonAnimationGameObject(<skeletonData>5__2, false); ((Component)<skeletonAnim>5__3).transform.SetParent(_clownpieceGo.transform, false); if (<skeletonAnim>5__3.state != null) { <skeletonAnim>5__3.state.SetAnimation(0, "idle", true); } _clownpieceGo.transform.localScale = new Vector3(-1f, 1f, 1f); BepinexPlugin.log.LogInfo((object)"Clownpiece spawned via manual Spine loading."); <parent>5__1 = null; <skeletonData>5__2 = null; <skeletonAnim>5__3 = null; } end_IL_0010:; } catch (Exception ex) { <e>5__5 = ex; BepinexPlugin.log.LogError((object)$"Error spawning Clownpiece: {<e>5__5}"); Clear(); } } catch (Exception ex) { <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetException(ex); return; } <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } private static GameObject _clownpieceGo; private static readonly Vector3 _positionOffset = new Vector3(-1.8f, -1f, 0.1f); private const string ModelName = "Clownpiece"; public static bool IsSpawned => (Object)(object)_clownpieceGo != (Object)null; public static void Spawn() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (!IsSpawned && PlayerTeamManager.IsInitialized && !((Object)(object)PlayerTeamManager.ActiveMember == (Object)null)) { UniTaskVoid val = SpawnAsync(); ((UniTaskVoid)(ref val)).Forget(); } } [AsyncStateMachine(typeof(<SpawnAsync>d__6))] [DebuggerStepThrough] private static UniTaskVoid SpawnAsync() { //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_002b: Unknown result type (might be due to invalid IL or missing references) <SpawnAsync>d__6 <SpawnAsync>d__ = new <SpawnAsync>d__6(); <SpawnAsync>d__.<>t__builder = AsyncUniTaskVoidMethodBuilder.Create(); <SpawnAsync>d__.<>1__state = -1; ((AsyncUniTaskVoidMethodBuilder)(ref <SpawnAsync>d__.<>t__builder)).Start<<SpawnAsync>d__6>(ref <SpawnAsync>d__); return ((AsyncUniTaskVoidMethodBuilder)(ref <SpawnAsync>d__.<>t__builder)).Task; } public static void Clear() { if ((Object)(object)_clownpieceGo != (Object)null) { Object.Destroy((Object)(object)_clownpieceGo); _clownpieceGo = null; BepinexPlugin.log.LogInfo((object)"Clownpiece despawned."); } } } public class EffectRootProxy : MonoBehaviour { public UnitView OwnerView { get; set; } private void LateUpdate() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (!PlayerTeamManager.IsInitialized || (Object)(object)PlayerTeamManager.ActiveMember == (Object)null) { return; } UnitView activeMember = PlayerTeamManager.ActiveMember; if ((Object)(object)activeMember != (Object)(object)OwnerView) { if ((Object)(object)activeMember.EffectRoot != (Object)null) { ((Component)this).transform.position = ((Component)activeMember.EffectRoot).transform.position; } } else { ((Component)this).transform.localPosition = Vector3.zero; } } } public class FormationSaveData : CustomGameRunSaveData { public override string Name => "FairiesFormationData"; public Dictionary<TeamPosition, Fairy> DefaultFormation { get; set; } = new Dictionary<TeamPosition, Fairy>(); public override void Save(GameRunController gameRun) { if (gameRun.Player is TFOLModDef.TFOLMod && PlayerTeamState.IsInitialized) { BepinexPlugin.log.LogInfo((object)"[FORMATION] Saving default formation data..."); DefaultFormation = PlayerTeamState.GetDefaultFormation(); } } public override void Restore(GameRunController gameRun) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (gameRun.Player is TFOLModDef.TFOLMod) { if (DefaultFormation == null || DefaultFormation.Count == 0) { BepinexPlugin.log.LogWarning((object)"[FORMATION] Formation save data is missing. Initializing hardcoded default."); PlayerTeamState.Initialize(gameRun.PlayerType); } else { BepinexPlugin.log.LogInfo((object)$"[FORMATION] Save data found. Restoring default formation. Front will be: {DefaultFormation[TeamPosition.Front]}"); PlayerTeamState.LoadFromSave(DefaultFormation); } } } } [HarmonyPatch] internal class PlayerTeamSetupPatches { [CompilerGenerated] private sealed class <SpawnSidekickAsync>d__3 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskVoidMethodBuilder <>t__builder; public string modelName; private GameDirector <director>5__1; private FieldInfo <prefabField>5__2; private GameObject <unitPrefab>5__3; private GameObject <sidekickGo>5__4; private UnitView <sidekickView>5__5; private PlayerUnit <logicalPlayer>5__6; private UnitStatusHud <statusHud>5__7; private Station <currentStation>5__8; private bool <shouldHide>5__9; private Exception <e>5__10; private Awaiter <>u__1; private void MoveNext() { //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Invalid comparison between Unknown and I4 //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Invalid comparison between Unknown and I4 //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Invalid comparison between Unknown and I4 //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Invalid comparison between Unknown and I4 //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; try { if (num != 0) { } try { Awaiter awaiter; if (num == 0) { awaiter = <>u__1; <>u__1 = default(Awaiter); num = (<>1__state = -1); goto IL_0230; } <director>5__1 = Singleton<GameDirector>.Instance; if (!((Object)(object)Singleton<GameDirector>.Instance == (Object)null) && !((Object)(object)UiManager.Instance == (Object)null)) { <prefabField>5__2 = typeof(GameDirector).GetField("unitPrefab", BindingFlags.Instance | BindingFlags.NonPublic); ref GameObject reference = ref <unitPrefab>5__3; object? obj = <prefabField>5__2?.GetValue(<director>5__1); reference = (GameObject)((obj is GameObject) ? obj : null); if (!((Object)(object)<unitPrefab>5__3 == (Object)null)) { <sidekickGo>5__4 = Object.Instantiate<GameObject>(<unitPrefab>5__3, ((Component)PlayerTeamManager.TeamMembers[0]).transform.parent); ((Object)<sidekickGo>5__4).name = "Sidekick_" + modelName; <sidekickView>5__5 = <sidekickGo>5__4.GetComponent<UnitView>(); <logicalPlayer>5__6 = PlayerTeamManager.LogicalPlayer; if (<logicalPlayer>5__6 != null) { <sidekickView>5__5.Unit = (Unit)(object)<logicalPlayer>5__6; <statusHud>5__7 = UiManager.GetPanel<UnitStatusHud>(); <sidekickView>5__5.SetStatusWidget(<statusHud>5__7.CreateStatusWidget((Unit)(object)<logicalPlayer>5__6), 1f); <sidekickView>5__5.SetInfoWidget(<statusHud>5__7.CreateInfoWidget((Unit)(object)<logicalPlayer>5__6), 1f); <sidekickView>5__5.SetStatusVisible(false, true); if ((Object)(object)<sidekickView>5__5.SelectorCollider != (Object)null) { ((Component)<sidekickView>5__5.SelectorCollider).gameObject.SetActive(false); } UniTask val = <sidekickView>5__5.LoadUnitModelAsync(modelName, true, (float?)null); awaiter = ((UniTask)(ref val)).GetAwaiter(); if (!((Awaiter)(ref awaiter)).IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <SpawnSidekickAsync>d__3 <SpawnSidekickAsync>d__ = this; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter, <SpawnSidekickAsync>d__3>(ref awaiter, ref <SpawnSidekickAsync>d__); return; } goto IL_0230; } Object.Destroy((Object)(object)<sidekickGo>5__4); } } goto end_IL_0010; IL_0230: ((Awaiter)(ref awaiter)).GetResult(); PlayerTeamManager.AddSidekick(<sidekickView>5__5); GameMaster instance = Singleton<GameMaster>.Instance; object obj2; if (instance == null) { obj2 = null; } else { GameRunController currentGameRun = instance.CurrentGameRun; obj2 = ((currentGameRun != null) ? currentGameRun.CurrentStation : null); } <currentStation>5__8 = (Station)obj2; <shouldHide>5__9 = false; if (<currentStation>5__8 != null && ((int)<currentStation>5__8.Type == 4 || (int)<currentStation>5__8.Type == 6 || (int)<currentStation>5__8.Type == 9 || (int)<currentStation>5__8.Type == 3)) { <shouldHide>5__9 = true; } if (<shouldHide>5__9) { BepinexPlugin.log.LogInfo((object)("Sidekick " + modelName + " loaded in a hidden station. Hiding immediately.")); <sidekickGo>5__4.SetActive(false); } if (PlayerTeamManager.TeamMembers.Count >= 3) { GameMaster instance2 = Singleton<GameMaster>.Instance; object obj3; if (instance2 == null) { obj3 = null; } else { GameRunController currentGameRun2 = instance2.CurrentGameRun; obj3 = ((currentGameRun2 != null) ? currentGameRun2.Battle : null); } if (obj3 != null) { BepinexPlugin.log.LogInfo((object)"All sidekicks loaded (In Battle). Syncing positions only."); PlayerTeamManager.UpdateAllVisualPositions(); } else { BepinexPlugin.log.LogInfo((object)"All sidekicks loaded (Outside Battle). Performing full sync."); PlayerTeamManager.UpdateAllVisualPositionsAndUI(); } } <director>5__1 = null; <prefabField>5__2 = null; <unitPrefab>5__3 = null; <sidekickGo>5__4 = null; <sidekickView>5__5 = null; <logicalPlayer>5__6 = null; <statusHud>5__7 = null; <currentStation>5__8 = null; end_IL_0010:; } catch (Exception ex) { <e>5__10 = ex; BepinexPlugin.log.LogError((object)$"Error spawning sidekick {modelName}: {<e>5__10}"); } } catch (Exception ex) { <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetException(ex); return; } <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } private static bool isSpawningSidekicks; [HarmonyPatch(typeof(UnitView), "UpdateShieldColliders")] [HarmonyPrefix] private static bool SkipUpdateShieldCollidersForDummies(UnitView __instance) { if (__instance.Unit == null) { return false; } return true; } [HarmonyPatch(typeof(UnitView), "LoadUnitModelAsync")] [HarmonyPostfix] private static void SetupPlayerTeamPatch(UnitView __instance) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (isSpawningSidekicks || !(__instance.Unit is TFOLModDef.TFOLMod)) { return; } PlayerTeamManager.Initialize(__instance); Transform parent = ((Component)__instance).transform.parent; if ((Object)(object)parent != (Object)null && (Object)(object)((Component)parent).GetComponent<PositionController>() == (Object)null) { Vector3 offset = default(Vector3); ((Vector3)(ref offset))..ctor(0.8f, 0f, 0f); PlayerTeamManager.ActivatePositionController(parent, offset); } try { isSpawningSidekicks = true; for (int i = 0; i < BepinexPlugin.sidekickModels.Count; i++) { UniTaskVoid val = SpawnSidekickAsync(BepinexPlugin.sidekickModels[i]); ((UniTaskVoid)(ref val)).Forget(); } } finally { isSpawningSidekicks = false; } } [AsyncStateMachine(typeof(<SpawnSidekickAsync>d__3))] [DebuggerStepThrough] private static UniTaskVoid SpawnSidekickAsync(string modelName) { //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_0032: Unknown result type (might be due to invalid IL or missing references) <SpawnSidekickAsync>d__3 <SpawnSidekickAsync>d__ = new <SpawnSidekickAsync>d__3(); <SpawnSidekickAsync>d__.<>t__builder = AsyncUniTaskVoidMethodBuilder.Create(); <SpawnSidekickAsync>d__.modelName = modelName; <SpawnSidekickAsync>d__.<>1__state = -1; ((AsyncUniTaskVoidMethodBuilder)(ref <SpawnSidekickAsync>d__.<>t__builder)).Start<<SpawnSidekickAsync>d__3>(ref <SpawnSidekickAsync>d__); return ((AsyncUniTaskVoidMethodBuilder)(ref <SpawnSidekickAsync>d__.<>t__builder)).Task; } } public class PlayerTeamComponent : MonoBehaviour { private readonly Dictionary<TeamPosition, Fairy> _positions = new Dictionary<TeamPosition, Fairy>(); public static PlayerTeamComponent Instance { get; private set; } public Fairy ActiveFairy => _positions[TeamPosition.Front]; private void Awake() { Instance = this; ResetPositions(); BepinexPlugin.log.LogInfo((object)"PlayerTeamComponent has awoken and initialized team state."); } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } public Fairy GetFairyAt(TeamPosition position) { return _positions[position]; } public TeamPosition GetPositionOf(Fairy fairy) { return _positions.FirstOrDefault((KeyValuePair<TeamPosition, Fairy> kvp) => kvp.Value == fairy).Key; } public void ResetPositions() { _positions[TeamPosition.Front] = Fairy.Sunny; _positions[TeamPosition.Mid] = Fairy.Luna; _positions[TeamPosition.Back] = Fairy.Star; BepinexPlugin.log.LogInfo((object)"Logical team state has been reset to default formation."); } public void Rotate() { Fairy value = _positions[TeamPosition.Front]; Fairy value2 = _positions[TeamPosition.Mid]; Fairy value3 = _positions[TeamPosition.Back]; _positions[TeamPosition.Front] = value2; _positions[TeamPosition.Mid] = value3; _positions[TeamPosition.Back] = value; } } public static class PlayerTeamManager { private class AnimationSourceOverride : IDisposable { private readonly UnitView _originalView; public AnimationSourceOverride(UnitView forcedView) { BepinexPlugin.log.LogInfo((object)("[ANIMATION HIJACK] Overriding animation source to " + ((Object)forcedView).name)); _originalView = ActiveMember; _originalActiveView = _originalView; IsOverridden = true; ((Unit)LogicalPlayer).SetView((IUnitView)(object)forcedView); UpdateGameDirectorReference(forcedView); } public void Dispose() { BepinexPlugin.log.LogInfo((object)("[ANIMATION HIJACK] Restoring original animation source: " + ((Object)_originalView).name)); ((Unit)LogicalPlayer).SetView((IUnitView)(object)_originalView); UpdateGameDirectorReference(_originalView); object? value = _statusWidgetField.GetValue(_originalView); UnitStatusWidget val = (UnitStatusWidget)((value is UnitStatusWidget) ? value : null); if ((Object)(object)val != (Object)null) { BepinexPlugin.log.LogInfo((object)("Forcing UI refresh for restored view: " + ((Object)_originalView).name)); val.SetHpBar(); val.SetStatusEffects(); } _originalActiveView = null; IsOverridden = false; } } private class ActionDisposable : IDisposable { private readonly Action _onDispose; public ActionDisposable(Action onDispose) { _onDispose = onDispose; } public void Dispose() { _onDispose?.Invoke(); } } [CompilerGenerated] private sealed class <SafeSwapModelAsync>d__36 : IAsyncStateMachine { public int <>1__state; public AsyncUniTaskVoidMethodBuilder <>t__builder; public UnitView view; public string modelName; public float? customScale; private UnitModelConfig <config>5__1; private SkeletonDataAsset <skeletonData>5__2; private FieldInfo <spineSkeletonField>5__3; private FieldInfo <rendererParentField>5__4; private SkeletonAnimation <oldSkeleton>5__5; private Transform <rendererParent>5__6; private IList <allSpineAnimations>5__7; private IList <allAnimationsNames>5__8; private IList <allStates>5__9; private SkeletonAnimation <newSkeleton>5__10; private Vector3 <finalScale>5__11; private PropertyInfo <spineLoadedProp>5__12; private MethodInfo <spineInitMethod>5__13; private SkeletonDataAsset <>s__14; private Exception <e>5__15; private Awaiter<SkeletonDataAsset> <>u__1; private void MoveNext() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; try { if (num != 0) { } try { Awaiter<SkeletonDataAsset> awaiter; if (num == 0) { awaiter = <>u__1; <>u__1 = default(Awaiter<SkeletonDataAsset>); num = (<>1__state = -1); goto IL_009c; } <config>5__1 = UnitModelConfig.FromName(modelName); if (<config>5__1 != null) { awaiter = ResourcesHelper.LoadSpineUnitAsync(modelName).GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <SafeSwapModelAsync>d__36 <SafeSwapModelAsync>d__ = this; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<Awaiter<SkeletonDataAsset>, <SafeSwapModelAsync>d__36>(ref awaiter, ref <SafeSwapModelAsync>d__); return; } goto IL_009c; } goto end_IL_0010; IL_009c: <>s__14 = awaiter.GetResult(); <skeletonData>5__2 = <>s__14; <>s__14 = null; if (!((Object)(object)<skeletonData>5__2 == (Object)null)) { <spineSkeletonField>5__3 = AccessTools.Field(typeof(UnitView), "spineSkeleton"); <rendererParentField>5__4 = AccessTools.Field(typeof(UnitView), "rendererParent"); ref SkeletonAnimation reference = ref <oldSkeleton>5__5; object? value = <spineSkeletonField>5__3.GetValue(view); reference = (SkeletonAnimation)((value is SkeletonAnimation) ? value : null); ref Transform reference2 = ref <rendererParent>5__6; object? value2 = <rendererParentField>5__4.GetValue(view); reference2 = (Transform)((value2 is Transform) ? value2 : null); if (!((Object)(object)<rendererParent>5__6 == (Object)null)) { AccessTools.Field(typeof(UnitView), "_hasFly").SetValue(view, false); AccessTools.Field(typeof(UnitView), "_hasBlink").SetValue(view, false); AccessTools.Field(typeof(UnitView), "_hasPose").SetValue(view, false); AccessTools.Property(typeof(UnitView), "DoremySleeping").SetValue(view, false); <allSpineAnimations>5__7 = AccessTools.Property(typeof(UnitView), "AllSpineAnimations").GetValue(view) as IList; <allAnimationsNames>5__8 = AccessTools.Property(typeof(UnitView), "AllAnimationsNames").GetValue(view) as IList; <allStates>5__9 = AccessTools.Property(typeof(UnitView), "AllStates").GetValue(view) as IList; <allSpineAnimations>5__7?.Clear(); <allAnimationsNames>5__8?.Clear(); <allStates>5__9?.Clear(); if ((Object)(object)<oldSkeleton>5__5 != (Object)null && (Object)(object)((Component)<oldSkeleton>5__5).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)<oldSkeleton>5__5).gameObject); } <newSkeleton>5__10 = SkeletonAnimation.NewSkeletonAnimationGameObject(<skeletonData>5__2, false); ((Component)<newSkeleton>5__10).transform.SetParent(<rendererParent>5__6, false); <spineSkeletonField>5__3.SetValue(view, <newSkeleton>5__10); <rendererParent>5__6.localPosition = Vector3.zero; Transform obj = <rendererParent>5__6; obj.localPosition += new Vector3(<config>5__1.Offset.x, <config>5__1.Offset.y, 0f); if (customScale.HasValue) { <finalScale>5__11 = new Vector3(customScale.Value, customScale.Value, 1f); } else { <finalScale>5__11 = Vector3.one; } if (<config>5__1.Flip) { <finalScale>5__11.x *= -1f; } ((Component)<newSkeleton>5__10).transform.localScale = <finalScale>5__11; if (<newSkeleton>5__10.state != null) { <newSkeleton>5__10.state.SetAnimation(0, "idle", true); } <spineLoadedProp>5__12 = AccessTools.Property(typeof(UnitView), "SpineLoaded"); <spineLoadedProp>5__12.SetValue(view, false); <spineInitMethod>5__13 = AccessTools.Method(typeof(UnitView), "SpineInitialize", (Type[])null, (Type[])null); <spineInitMethod>5__13.Invoke(view, null); BepinexPlugin.log.LogInfo((object)"Safe model swap complete."); <config>5__1 = null; <skeletonData>5__2 = null; <spineSkeletonField>5__3 = null; <rendererParentField>5__4 = null; <oldSkeleton>5__5 = null; <rendererParent>5__6 = null; <allSpineAnimations>5__7 = null; <allAnimationsNames>5__8 = null; <allStates>5__9 = null; <newSkeleton>5__10 = null; <spineLoadedProp>5__12 = null; <spineInitMethod>5__13 = null; } } end_IL_0010:; } catch (Exception ex) { <e>5__15 = ex; BepinexPlugin.log.LogError((object)$"Error in SafeSwapModelAsync: {<e>5__15}"); } } catch (Exception ex) { <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetException(ex); return; } <>1__state = -2; ((AsyncUniTaskVoidMethodBuilder)(ref <>t__builder)).SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine(IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } private static readonly PropertyInfo _blockEffectProp = typeof(UnitView).GetProperty("BlockEffect", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly PropertyInfo _shieldEffectProp = typeof(UnitView).GetProperty("ShieldEffect", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo _hasBlockField = typeof(UnitView).GetField("_hasBlock", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo _hasShieldField = typeof(UnitView).GetField("_hasShield", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo _statusWidgetField = typeof(UnitView).GetField("_statusWidget", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly Vector3 _frontPositionOffset = new Vector3(0f, 0f, 0f); private static readonly Vector3 _midPositionOffset = new Vector3(-2.3f, -2f, 0.5f); private static readonly Vector3 _backPositionOffset = new Vector3(-3.2f, 1.2f, 0.2f); private static Dictionary<Fairy, string> _originalModels = new Dictionary<Fairy, string>(); private const float SWAP_DURATION = 0.5f; private static UnitView _originalActiveView = null; public static PlayerUnit LogicalPlayer { get; private set; } public static List<UnitView> TeamMembers { get; } = new List<UnitView>(); public static UnitView EffectHost { get; private set; } public static bool IsInitialized => LogicalPlayer != null; public static UnitView ActiveMember { get { if (!IsInitialized || !PlayerTeamState.IsInitialized) { return null; } Fairy fairyAt = PlayerTeamState.GetFairyAt(TeamPosition.Front); return GetViewForFairy(fairyAt); } } public static bool IsOverridden { get; private set; } = false; public static UnitView GetViewForFairy(Fairy fairy) { if (TeamMembers.Count < 3) { return null; } return (UnitView)(fairy switch { Fairy.Sunny => TeamMembers[0], Fairy.Luna => TeamMembers[1], Fairy.Star => TeamMembers[2], _ => null, }); } public static void Reset() { BepinexPlugin.log.LogInfo((object)"Resetting PlayerTeamManager (Visuals)."); foreach (UnitView teamMember in TeamMembers) { if ((Object)(object)teamMember != (Object)null && (Object)(object)((Component)teamMember).gameObject != (Object)null) { Object.Destroy((Object)(object)((Component)teamMember).gameObject); } } EffectHost = null; LogicalPlayer = null; TeamMembers.Clear(); } public static void Initialize(UnitView mainMember) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) Reset(); Unit unit = mainMember.Unit; LogicalPlayer = (PlayerUnit)(object)((unit is PlayerUnit) ? unit : null); if (LogicalPlayer == null) { return; } if (!PlayerTeamState.IsInitialized) { BepinexPlugin.log.LogWarning((object)"PlayerTeamState was not initialized. Forcing initialization. This is normal on first startup, but not on load."); GameRunController gameRun = ((GameEntity)LogicalPlayer).GameRun; if (gameRun != null) { PlayerTeamState.Initialize(gameRun.PlayerType); } else { BepinexPlugin.log.LogError((object)"Could not find GameRun from LogicalPlayer! Falling back to TypeA default formation."); PlayerTeamState.Initialize((PlayerType)0); } } EffectHost = mainMember; if ((Object)(object)((Component)EffectHost.EffectRoot).GetComponent<EffectRootProxy>() == (Object)null) { EffectRootProxy effectRootProxy = ((Component)EffectHost.EffectRoot).gameObject.AddComponent<EffectRootProxy>(); effectRootProxy.OwnerView = EffectHost; } object? value = _blockEffectProp.GetValue(EffectHost); EffectWidget val = (EffectWidget)((value is EffectWidget) ? value : null); if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).GetComponent<ShieldProxy>() == (Object)null) { ((Component)val).gameObject.AddComponent<ShieldProxy>(); } object? value2 = _shieldEffectProp.GetValue(EffectHost); EffectWidget val2 = (EffectWidget)((value2 is EffectWidget) ? value2 : null); if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).GetComponent<ShieldProxy>() == (Object)null) { ((Component)val2).gameObject.AddComponent<ShieldProxy>(); } TeamMembers.Add(mainMember); BepinexPlugin.log.LogInfo((object)"PlayerTeamManager Initialized."); } public static Tween UpdateAllVisualPositions() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) if (!IsInitialized || TeamMembers.Count < 3) { return null; } Transform parent = ((Component)TeamMembers[0]).transform.parent; if ((Object)(object)parent == (Object)null) { return null; } PositionController component = ((Component)parent).GetComponent<PositionController>(); if ((Object)(object)component == (Object)null) { BepinexPlugin.log.LogError((object)"Could not find PositionController on playerRoot!"); return null; } Vector3 targetPosition = component.TargetPosition; BepinexPlugin.log.LogInfo((object)$"Syncing all visual positions. Using anchor: {targetPosition}"); Sequence val = DOTween.Sequence(); Fairy fairyAt = PlayerTeamState.GetFairyAt(TeamPosition.Front); Fairy fairyAt2 = PlayerTeamState.GetFairyAt(TeamPosition.Mid); Fairy fairyAt3 = PlayerTeamState.GetFairyAt(TeamPosition.Back); UnitView viewForFairy = GetViewForFairy(fairyAt); UnitView viewForFairy2 = GetViewForFairy(fairyAt2); UnitView viewForFairy3 = GetViewForFairy(fairyAt3); if ((Object)(object)viewForFairy != (Object)null) { TweenSettingsExtensions.Join(val, (Tween)(object)TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOMove(((Component)viewForFairy).transform, targetPosition + _frontPositionOffset, 0.5f, false), (Ease)4)); } if ((Object)(object)viewForFairy2 != (Object)null) { TweenSettingsExtensions.Join(val, (Tween)(object)TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOMove(((Component)viewForFairy2).transform, targetPosition + _midPositionOffset, 0.5f, false), (Ease)4)); } if ((Object)(object)viewForFairy3 != (Object)null) { TweenSettingsExtensions.Join(val, (Tween)(object)TweenSettingsExtensions.SetEase<TweenerCore<Vector3, Vector3, VectorOptions>>(ShortcutExtensions.DOMove(((Component)viewForFairy3).transform, targetPosition + _backPositionOffset, 0.5f, false), (Ease)4)); } TweenSettingsExtensions.SetUpdate<Sequence>(val, true); return (Tween)(object)val; } public static void ActivatePositionController(Transform playerRoot, Vector3 offset) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)playerRoot == (Object)null)) { PositionController positionController = ((Component)playerRoot).gameObject.AddComponent<PositionController>(); positionController.Initialize(offset); BepinexPlugin.log.LogInfo((object)$"Attached and initialized PositionController. Target offset: {offset}"); } } public static void AddSidekick(UnitView sidekickView) { if (IsInitialized) { TeamMembers.Add(sidekickView); BepinexPlugin.log.LogInfo((object)$"Sidekick {((Object)sidekickView).name} added. Team size: {TeamMembers.Count}"); } } public static void SyncPointersAndUI() { if (!IsInitialized || !PlayerTeamState.IsInitialized) { return; } UnitView viewForFairy = GetViewForFairy(PlayerTeamState.GetFairyAt(TeamPosition.Front)); if ((Object)(object)viewForFairy == (Object)null) { BepinexPlugin.log.LogError((object)"SyncPointersAndUI: Could not find new active member!"); return; } BepinexPlugin.log.LogInfo((object)("Syncing core pointers and UI. New active leader is " + ((Object)viewForFairy).name)); ((Unit)LogicalPlayer).SetView((IUnitView)(object)viewForFairy); UpdateGameDirectorReference(viewForFairy); foreach (UnitView teamMember in TeamMembers) { if (!((Object)(object)teamMember == (Object)null)) { bool active = (Object)(object)teamMember == (Object)(object)EffectHost; if ((Object)(object)teamMember.EffectRoot != (Object)null) { ((Component)teamMember.EffectRoot).gameObject.SetActive(active); } } } foreach (UnitView teamMember2 in TeamMembers) { if (!((Object)(object)teamMember2 == (Object)null)) { bool flag = (Object)(object)teamMember2 == (Object)(object)viewForFairy; teamMember2.SetStatusVisible(flag, true); if ((Object)(object)teamMember2.SelectorCollider != (Object)null) { ((Component)teamMember2.SelectorCollider).gameObject.SetActive(true); } } } object? value = _statusWidgetField.GetValue(viewForFairy); UnitStatusWidget val = (UnitStatusWidget)((value is UnitStatusWidget) ? value : null); if ((Object)(object)val != (Object)null) { val.SetHpBar(); val.SetStatusEffects(); } PlayerEnergyState.BroadcastVisualUpdate(); } public static Tween UpdateAllVisualPositionsAndUI() { SyncPointersAndUI(); return UpdateAllVisualPositions(); } public static void SwapToNextMember() { if (IsInitialized && PlayerTeamState.IsInitialized && TeamMembers.Count >= 3) { PlayerTeamState.RotateTeam(); UnitView activeMember = ActiveMember; UnitView viewForFairy = GetViewForFairy(PlayerTeamState.GetFairyAt(TeamPosition.Back)); ((Unit)LogicalPlayer).SetView((IUnitView)(object)activeMember); UpdateGameDirectorReference(activeMember); UpdateAllVisualPositions(); if ((Object)(object)viewForFairy != (Object)null && (Object)(object)viewForFairy.SelectorCollider != (Object)null) { ((Component)viewForFairy.SelectorCollider).gameObject.SetActive(false); } if ((Object)(object)activeMember != (Object)null && (Object)(object)activeMember.SelectorCollider != (Object)null) { ((Component)activeMember.SelectorCollider).gameObject.SetActive(true); } if ((Object)(object)viewForFairy != (Object)null) { viewForFairy.SetStatusVisible(false, true); } if ((Object)(object)activeMember != (Object)null) { activeMember.SetStatusVisible(true, false); } object? value = _statusWidgetField.GetValue(activeMember); UnitStatusWidget val = (UnitStatusWidget)((value is UnitStatusWidget) ? value : null); if ((Object)(object)val != (Object)null) { val.SetHpBar(); val.SetStatusEffects(); } } } private static void UpdateGameDirectorReference(UnitView newActive) { try { FieldInfo field = typeof(GameDirector).GetField("<PlayerUnitView>k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(Singleton<GameDirector>.Instance, newActive); } else { BepinexPlugin.log.LogError((object)"Could not find backing field for GameDirector.PlayerUnitView!"); } } catch (Exception arg) { BepinexPlugin.log.LogError((object)$"Error updating GameDirector.PlayerUnitView: {arg}"); } } public static void SwapFairyModel(Fairy fairy, string newModelName) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) if (!IsInitialized) { return; } UnitView viewForFairy = GetViewForFairy(fairy); if ((Object)(object)viewForFairy == (Object)null) { return; } if (!_originalModels.ContainsKey(fairy)) { string value = ""; switch (fairy) { case Fairy.Sunny: value = BepinexPlugin.mainPlayerModel; break; case Fairy.Luna: value = BepinexPlugin.sidekickModels[0]; break; case Fairy.Star: value = BepinexPlugin.sidekickModels[1]; break; } _originalModels[fairy] = value; } BepinexPlugin.log.LogInfo((object)$"Swapping model for {fairy} to {newModelName}"); float? num = ((newModelName == "Kaguya") ? new float?(0.75f) : null); UniTaskVoid val = SafeSwapModelAsync(viewForFairy, newModelName); ((UniTaskVoid)(ref val)).Forget(); } [AsyncStateMachine(typeof(<SafeSwapModelAsync>d__36))] [DebuggerStepThrough] private static UniTaskVoid SafeSwapModelAsync(UnitView view, string modelName, float? customScale = null) { //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_0040: Unknown result type (might be due to invalid IL or missing references) <SafeSwapModelAsync>d__36 <SafeSwapModelAsync>d__ = new <SafeSwapModelAsync>d__36(); <SafeSwapModelAsync>d__.<>t__builder = AsyncUniTaskVoidMethodBuilder.Create(); <SafeSwapModelAsync>d__.view = view; <SafeSwapModelAsync>d__.modelName = modelName; <SafeSwapModelAsync>d__.customScale = customScale; <SafeSwapModelAsync>d__.<>1__state = -1; ((AsyncUniTaskVoidMethodBuilder)(ref <SafeSwapModelAsync>d__.<>t__builder)).Start<<SafeSwapModelAsync>d__36>(ref <SafeSwapModelAsync>d__); return ((AsyncUniTaskVoidMethodBuilder)(ref <SafeSwapModelAsync>d__.<>t__builder)).Task; } public static void ResetToDefaultVisuals() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if (!IsInitialized || !PlayerTeamState.IsInitialized || TeamMembers.Count == 0) { return; } if (_originalModels.Count > 0) { BepinexPlugin.log.LogInfo((object)"Reverting temporary model swaps..."); foreach (KeyValuePair<Fairy, string> originalModel in _originalModels) { Fairy key = originalModel.Key; string value = originalModel.Value; UnitView viewForFairy = GetViewForFairy(key); if ((Object)(object)viewForFairy != (Object)null) { UniTaskVoid val = SafeSwapModelAsync(viewForFairy, value); ((UniTaskVoid)(ref val)).Forget(); } } _originalModels.Clear(); } Fairy fairyAt = PlayerTeamState.GetFairyAt(TeamPosition.Front); UnitView viewForFairy2 = GetViewForFairy(fairyAt); if ((Object)(object)viewForFairy2 == (Object)null) { BepinexPlugin.log.LogError((object)"Could not find a UnitView for the default leader! Aborting visual reset."); return; } BepinexPlugin.log.LogInfo((object)("Resetting game's visual state to the run's default leader: " + ((Object)viewForFairy2).name)); if (LogicalPlayer != null) { ((Unit)LogicalPlayer).SetView((IUnitView)(object)viewForFairy2); } if ((Object)(object)Singleton<GameDirector>.Instance != (Object)null) { UpdateGameDirectorReference(viewForFairy2); } UpdateAllVisualPositions(); foreach (UnitView teamMember in TeamMembers) { if (!((Object)(object)teamMember == (Object)null)) { bool flag = (Object)(object)teamMember == (Object)(object)viewForFairy2; teamMember.SetStatusVisible(flag, true); if ((Object)(object)teamMember.SelectorCollider != (Object)null) { ((Component)teamMember.SelectorCollider).gameObject.SetActive(flag); } } } BepinexPlugin.log.LogInfo((object)"Visual state reset complete. UI and colliders synced to default formation."); } public static EnergyBarController GetEnergyBarFor(UnitView view) { if ((Object)(object)view == (Object)null) { BepinexPlugin.log.LogWarning((object)"GetEnergyBarFor: view was null."); return null; } object? value = _statusWidgetField.GetValue(view); UnitStatusWidget val = (UnitStatusWidget)((value is UnitStatusWidget) ? value : null); if ((Object)(object)val == (Object)null) { BepinexPlugin.log.LogWarning((object)("GetEnergyBarFor: Could not find StatusWidget on " + ((Object)view).name + ".")); return null; } return ((Component)val).GetComponentInChildren<EnergyBarController>(true); } public static IDisposable ForceAnimationSource(Fairy fairy) { UnitView viewForFairy = GetViewForFairy(fairy); if (!IsInitialized || IsOverridden || (Object)(object)viewForFairy == (Object)null || (Object)(object)viewForFairy == (Object)(object)ActiveMember) { return new ActionDisposable(delegate { }); } return new AnimationSourceOverride(viewForFairy); } } public static class PlayerTeamState { private static Dictionary<TeamPosition, Fairy> _positions = new Dictionary<TeamPosition, Fairy>(); private static Dictionary<TeamPosition, Fairy> _defaultFormation = new Dictionary<TeamPosition, Fairy>(); public static bool IsInitialized { get; private set; } = false; public static void Initialize(PlayerType playerType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)playerType == 0) { _defaultFormation[TeamPosition.Front] = Fairy.Luna; _defaultFormation[TeamPosition.Mid] = Fairy.Sunny; _defaultFormation[TeamPosition.Back] = Fairy.Star; BepinexPlugin.log.LogInfo((object)"[STARTUP] Initialized TypeA default formation."); } else { _defaultFormation[TeamPosition.Front] = Fairy.Sunny; _defaultFormation[TeamPosition.Mid] = Fairy.Luna; _defaultFormation[TeamPosition.Back] = Fairy.Star; BepinexPlugin.log.LogInfo((object)"[STARTUP] Initialized TypeB default formation."); } ResetToDefault(); IsInitialized = true; BepinexPlugin.log.LogInfo((object)"[STARTUP] Default formation initialization finished"); } public static void LoadFromSave(Dictionary<TeamPosition, Fairy> savedFormation) { _defaultFormation = new Dictionary<TeamPosition, Fairy>(savedFormation); ResetToDefault(); IsInitialized = true; BepinexPlugin.log.LogInfo((object)"PlayerTeamState loaded formation from save."); } public static void SetDefaultFormation(Dictionary<TeamPosition, Fairy> newFormation) { _defaultFormation = new Dictionary<TeamPosition, Fairy>(newFormation); BepinexPlugin.log.LogInfo((object)"New default formation has been set."); } public static Dictionary<TeamPosition, Fairy> GetDefaultFormation() { return new Dictionary<TeamPosition, Fairy>(_defaultFormation); } public static void ResetToDefault() { _positions = new Dictionary<TeamPosition, Fairy>(_defaultFormation); BepinexPlugin.log.LogInfo((object)$"PlayerTeamState reset to default formation. Front: {_positions[TeamPosition.Front]}. Mid: {_positions[TeamPosition.Mid]}. Back: {_positions[TeamPosition.Back]}"); } public static Fairy GetFairyAt(TeamPosition position) { if (_positions.TryGetValue(position, out var value)) { return value; } return Fairy.Sunny; } public static TeamPosition GetPositionOf(Fairy fairy) { return _positions.FirstOrDefault((KeyValuePair<TeamPosition, Fairy> kvp) => kvp.Value == fairy).Key; } public static IReadOnlyDictionary<TeamPosition, Fairy> GetCurrentPositions() { return new Dictionary<TeamPosition, Fairy>(_positions); } public static void RotateTeam() { if (IsInitialized) { Fairy fairy = _positions[TeamPosition.Front]; Fairy fairy2 = _positions[TeamPosition.Mid]; Fairy fairy3 = _positions[TeamPosition.Back]; _positions[TeamPosition.Front] = fairy3; _positions[TeamPosition.Mid] = fairy; _positions[TeamPosition.Back] = fairy2; BepinexPlugin.log.LogInfo((object)$"Team Rotated. New Front: {fairy2}, New Mid: {fairy3}, New Back: {fairy}"); } } private static void SwapAtPositions(TeamPosition pos1, TeamPosition pos2) { if (IsInitialized && pos1 != pos2) { Fairy fairy = _positions[pos1]; Fairy fairy2 = _positions[pos2]; _positions[pos1] = fairy2; _positions[pos2] = fairy; BepinexPlugin.log.LogInfo((object)$"Swapped positions {pos1} & {pos2}. New state: {fairy2} is at {pos1}, {fairy} is at {pos2}."); } } public static void SwapMembers(TeamPosition pos1, TeamPosition pos2) { SwapAtPositions(pos1, pos2); } public static void SwapMembers(Fairy fairy1, Fairy fairy2) { if (fairy1 != fairy2) { TeamPosition positionOf = GetPositionOf(fairy1); TeamPosition positionOf2 = GetPositionOf(fairy2); SwapAtPositions(positionOf, positionOf2); } } public static void SwapMembers(Fairy fairy, TeamPosition position) { TeamPosition positionOf = GetPositionOf(fairy); SwapAtPositions(positionOf, position); } public static void SwapMembers(TeamPosition position, Fairy fairy) { SwapMembers(fairy, position); } } public sealed class TFOLModDef : PlayerUnitTemplate { [EntityLogic(typeof(TFOLModDef))] public sealed class TFOLMod : PlayerUnit { [CompilerGenerated] private sealed class <OnBattleStarted>d__27 : IEnumerable<BattleAction>, IEnumerable, IEnumerator<BattleAction>, IEnumerator, IDisposable { private int <>1__state; private BattleAction <>2__current; private int <>l__initialThreadId; private GameEventArgs args; public GameEventArgs <>3__args; public TFOLMod <>4__this; private IEnumerator<EnemyUnit> <>s__1; private EnemyUnit <enemy>5__2; private UnitView <starView>5__3; private UnitView <sunnyView>5__4; private UnitView <lunaView>5__5; private UnitView <sunnyView>5__6; private UnitView <lunaView>5__7; private UnitView <starView>5__8; private UnitView <lunaView>5__9; private UnitView <starView>5__10; private UnitView <sunnyView>5__11; BattleAction IEnumerator<BattleAction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnBattleStarted>d__27(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 11u) { try { } finally { <>m__Finally1(); } } <>s__1 = null; <enemy>5__2 = null; <starView>5__3 = null; <sunnyView>5__4 = null; <lunaView>5__5 = null; <sunnyView>5__6 = null; <lunaView>5__7 = null; <starView>5__8 = null; <lunaView>5__9 = null; <starView>5__10 = null; <sunnyView>5__11 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>s__1 = ((Unit)<>4__this).Battle.AllAliveEnemies.GetEnumerator(); <>1__state = -3; goto IL_05e6; case 1: <>1__state = -3; goto IL_014c; case 2: <>1__state = -3; goto IL_01b2; case 3: <>1__state = -3; goto IL_0218; case 4: <>1__state = -3; goto IL_0272; case 5: <>1__state = -3; <sunnyView>5__6 = PlayerTeamManager.GetViewForFairy(Fairy.Sunny); if ((Object)(object)<sunnyView>5__6 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<sunnyView>5__6, <>4__this.LocShortcut("ChatVsCirno_Sunny")); <>1__state = 6; return true; } goto IL_0352; case 6: <>1__state = -3; goto IL_0352; case 7: <>1__state = -3; goto IL_03b6; case 8: <>1__state = -3; break; case 9: <>1__state = -3; <lunaView>5__9 = PlayerTeamManager.GetViewForFairy(Fairy.Luna); if ((Object)(object)<lunaView>5__9 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<lunaView>5__9, <>4__this.LocShortcut("ChatVsYuuka_Luna")); <>1__state = 10; return true; } goto IL_0500; case 10: <>1__state = -3; goto IL_0500; case 11: <>1__state = -3; goto IL_0565; case 12: { <>1__state = -3; goto IL_05c7; } IL_0500: <starView>5__10 = PlayerTeamManager.GetViewForFairy(Fairy.Star); if ((Object)(object)<starView>5__10 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<starView>5__10, <>4__this.LocShortcut("ChatVsYuuka_Star")); <>1__state = 11; return true; } goto IL_0565; IL_0272: <starView>5__3 = null; <sunnyView>5__4 = null; <lunaView>5__5 = null; goto IL_0288; IL_0565: <sunnyView>5__11 = PlayerTeamManager.GetViewForFairy(Fairy.Sunny); if ((Object)(object)<sunnyView>5__11 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<sunnyView>5__11, <>4__this.LocShortcut("ChatVsYuuka_Sunny")); <>1__state = 12; return true; } goto IL_05c7; IL_014c: <sunnyView>5__4 = PlayerTeamManager.GetViewForFairy(Fairy.Sunny); if ((Object)(object)<sunnyView>5__4 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<sunnyView>5__4, <>4__this.LocShortcut("ChatVsTFOL_Sunny"), 3f, 0f, 3f); <>1__state = 2; return true; } goto IL_01b2; IL_05c7: <lunaView>5__9 = null; <starView>5__10 = null; <sunnyView>5__11 = null; goto IL_05de; IL_0288: if (((GameEntity)<enemy>5__2).Id == "Cirno") { <>2__current = (BattleAction)(object)PerformAction.Chat((Unit)(object)<enemy>5__2, <>4__this.LocShortcut("ChatVsCirno_Cirno"), 3f, 0f, 1.5f, true); <>1__state = 5; return true; } if (<>4__this.isYuukaLoaded && ((object)<enemy>5__2).GetType() == YuukaIntegration.YuukaBossType) { <>2__current = (BattleAction)(object)PerformAction.Chat((Unit)(object)<enemy>5__2, <>4__this.LocShortcut("ChatVsYuuka_Yuuka"), 3f, 0f, 1.5f, true); <>1__state = 9; return true; } goto IL_05de; IL_0352: <lunaView>5__7 = PlayerTeamManager.GetViewForFairy(Fairy.Luna); if ((Object)(object)<lunaView>5__7 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<lunaView>5__7, <>4__this.LocShortcut("ChatVsCirno_Luna")); <>1__state = 7; return true; } goto IL_03b6; IL_01b2: <lunaView>5__5 = PlayerTeamManager.GetViewForFairy(Fairy.Luna); if ((Object)(object)<lunaView>5__5 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<lunaView>5__5, <>4__this.LocShortcut("ChatVsTFOL_Luna"), 3f, 0f, 4f); <>1__state = 3; return true; } goto IL_0218; IL_03b6: <starView>5__8 = PlayerTeamManager.GetViewForFairy(Fairy.Star); if ((Object)(object)<starView>5__8 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<starView>5__8, <>4__this.LocShortcut("ChatVsCirno_Star")); <>1__state = 8; return true; } break; IL_05de: <enemy>5__2 = null; goto IL_05e6; IL_05e6: if (!<>s__1.MoveNext()) { break; } <enemy>5__2 = <>s__1.Current; if (((GameEntity)<enemy>5__2).Id == "Sunny") { <starView>5__3 = PlayerTeamManager.GetViewForFairy(Fairy.Star); if ((Object)(object)<starView>5__3 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<starView>5__3, <>4__this.LocShortcut("ChatVsTFOL_Star"), 3f, 0f, 2.5f); <>1__state = 1; return true; } goto IL_014c; } goto IL_0288; IL_0218: if ((Object)(object)<sunnyView>5__4 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<sunnyView>5__4, <>4__this.LocShortcut("ChatVsTFOL_Sunny2"), 2f, 0f, 3f); <>1__state = 4; return true; } goto IL_0272; } <>m__Finally1(); <>s__1 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__1 != null) { <>s__1.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<BattleAction> IEnumerable<BattleAction>.GetEnumerator() { <OnBattleStarted>d__27 <OnBattleStarted>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <OnBattleStarted>d__ = this; } else { <OnBattleStarted>d__ = new <OnBattleStarted>d__27(0) { <>4__this = <>4__this }; } <OnBattleStarted>d__.args = <>3__args; return <OnBattleStarted>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<BattleAction>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <OnCardUsed>d__28 : IEnumerable<BattleAction>, IEnumerable, IEnumerator<BattleAction>, IEnumerator, IDisposable { private int <>1__state; private BattleAction <>2__current; private int <>l__initialThreadId; private CardUsingEventArgs args; public CardUsingEventArgs <>3__args; public TFOLMod <>4__this; private IEnumerator<EnemyUnit> <>s__1; private EnemyUnit <enemy>5__2; private UnitView <starView>5__3; private IEnumerator<EnemyUnit> <>s__4; private EnemyUnit <enemy>5__5; private UnitView <sunnyView>5__6; private UnitView <lunaView>5__7; private UnitView <starView>5__8; private UnitView <view>5__9; private UnitView <view>5__10; private UnitView <view>5__11; BattleAction IEnumerator<BattleAction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnCardUsed>d__28(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { switch (<>1__state) { case -3: case 1: case 2: try { } finally { <>m__Finally1(); } break; case -4: case 3: case 4: case 5: case 6: try { } finally { <>m__Finally2(); } break; } <>s__1 = null; <enemy>5__2 = null; <starView>5__3 = null; <>s__4 = null; <enemy>5__5 = null; <sunnyView>5__6 = null; <lunaView>5__7 = null; <starView>5__8 = null; <view>5__9 = null; <view>5__10 = null; <view>5__11 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (args.Card is TFOLClownpiece) { <>s__1 = ((Unit)<>4__this).Battle.AllAliveEnemies.GetEnumerator(); <>1__state = -3; goto IL_01b0; } goto IL_01cf; case 1: <>1__state = -3; <starView>5__3 = PlayerTeamManager.GetViewForFairy(Fairy.Star); if ((Object)(object)<starView>5__3 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<starView>5__3, <>4__this.LocShortcut("ChatSelfClownpiece_Star")); <>1__state = 2; return true; } goto IL_0193; case 2: <>1__state = -3; goto IL_0193; case 3: <>1__state = -4; <sunnyView>5__6 = PlayerTeamManager.GetViewForFairy(Fairy.Sunny); if ((Object)(object)<sunnyView>5__6 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<sunnyView>5__6, <>4__this.LocShortcut("ChatSelfCirno_Sunny")); <>1__state = 4; return true; } goto IL_02f1; case 4: <>1__state = -4; goto IL_02f1; case 5: <>1__state = -4; goto IL_0355; case 6: <>1__state = -4; goto IL_03b9; case 7: <>1__state = -1; goto IL_0490; case 8: <>1__state = -1; goto IL_0532; case 9: { <>1__state = -1; goto IL_05d2; } IL_03e4: if (<>s__4.MoveNext()) { <enemy>5__5 = <>s__4.Current; if (((GameEntity)<enemy>5__5).Id == "Cirno") { <>2__current = (BattleAction)(object)PerformAction.Chat((Unit)(object)<enemy>5__5, <>4__this.LocShortcut("ChatSelfCirno"), 3f, 0f, 1.5f, true); <>1__state = 3; return true; } goto IL_03dc; } <>m__Finally2(); <>s__4 = null; goto IL_0403; IL_02f1: <lunaView>5__7 = PlayerTeamManager.GetViewForFairy(Fairy.Luna); if ((Object)(object)<lunaView>5__7 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<lunaView>5__7, <>4__this.LocShortcut("ChatSelfCirno_Luna")); <>1__state = 5; return true; } goto IL_0355; IL_0490: <>4__this.SunnyFriendDialogueTriggered = true; <view>5__9 = null; goto IL_04a5; IL_0355: <starView>5__8 = PlayerTeamManager.GetViewForFairy(Fairy.Star); if ((Object)(object)<starView>5__8 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<starView>5__8, <>4__this.LocShortcut("ChatSelfCirno_Star")); <>1__state = 6; return true; } goto IL_03b9; IL_04a5: if (args.Card is LunaFriend && !<>4__this.LunaFriendDialogueTriggered) { <view>5__10 = PlayerTeamManager.GetViewForFairy(Fairy.Luna); if ((Object)(object)<view>5__10 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<view>5__10, <>4__this.LocShortcut("ChatLunaFriend")); <>1__state = 8; return true; } goto IL_0532; } goto IL_0547; IL_03b9: <>4__this.SelfDialogueTriggered = true; <sunnyView>5__6 = null; <lunaView>5__7 = null; <starView>5__8 = null; goto IL_03dc; IL_0547: if (!(args.Card is StarFriend) || <>4__this.StarFriendDialogueTriggered) { break; } <view>5__11 = PlayerTeamManager.GetViewForFairy(Fairy.Star); if ((Object)(object)<view>5__11 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<view>5__11, <>4__this.LocShortcut("ChatStarFriend")); <>1__state = 9; return true; } goto IL_05d2; IL_0193: <>4__this.SelfDialogueTriggered = true; <starView>5__3 = null; goto IL_01a8; IL_03dc: <enemy>5__5 = null; goto IL_03e4; IL_01b0: if (<>s__1.MoveNext()) { <enemy>5__2 = <>s__1.Current; if (((GameEntity)<enemy>5__2).Id == "Clownpiece") { <>2__current = (BattleAction)(object)PerformAction.Chat((Unit)(object)<enemy>5__2, <>4__this.LocShortcut("ChatSelfClownpiece"), 3f, 0f, 1.5f, true); <>1__state = 1; return true; } goto IL_01a8; } <>m__Finally1(); <>s__1 = null; goto IL_01cf; IL_0403: if (args.Card is SunnyFriend && !<>4__this.SunnyFriendDialogueTriggered) { <view>5__9 = PlayerTeamManager.GetViewForFairy(Fairy.Sunny); if ((Object)(object)<view>5__9 != (Object)null) { <>2__current = (BattleAction)(object)new PerformChatOnViewAction(<view>5__9, <>4__this.LocShortcut("ChatSunnyFriend")); <>1__state = 7; return true; } goto IL_0490; } goto IL_04a5; IL_05d2: <>4__this.StarFriendDialogueTriggered = true; <view>5__11 = null; break; IL_01a8: <enemy>5__2 = null; goto IL_01b0; IL_01cf: if (args.Card is TFOLCirno) { <>s__4 = ((Unit)<>4__this).Battle.AllAliveEnemies.GetEnumerator(); <>1__state = -4; goto IL_03e4; } goto IL_0403; IL_0532: <>4__this.LunaFriendDialogueTriggered = true; <view>5__10 = null; goto IL_0547; } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__1 != null) { <>s__1.Dispose(); } } private void <>m__Finally2() { <>1__state = -1; if (<>s__4 != null) { <>s__4.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<BattleAction> IEnumerable<BattleAction>.GetEnumerator() { <OnCardUsed>d__28 <OnCardUsed>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <OnCardUsed>d__ = this; } else { <OnCardUsed>d__ = new <OnCardUsed>d__28(0) { <>4__this = <>4__this }; } <OnCardUsed>d__.args = <>3__args; return <OnCardUsed>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<BattleAction>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <OnCardsAdded>d__29 : IEnumerable<BattleAction>, IEnumerable, IEnumerator<BattleAction>, IEnumerator, IDisposable { private int <>1__state; private BattleAction <>2__current; private int <>l__initialThreadId; private CardsEventArgs args; public CardsEventArgs <>3__args; public TFOLMod <>4__this; private IEnumerator<EnemyUnit> <>s__1; private EnemyUnit <enemy>5__2; private UnitView <starView>5__3; private UnitView <starView>5__4; private IEnumerator<EnemyUnit> <>s__5; private EnemyUnit <enemy>5__6; private UnitView <lunaView>5__7; private UnitView <lunaView>5__8; BattleAction IEnumerator<BattleAction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OnCardsAdded>d__29(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { switch (<>1__state) { case -3: case 1: case 2: case 3: case 4: try { } finally { <>m__Finally1(); } break; case -4: case 5: case 6: case 7: case 8: try { } finally { <>m__Finally2(); } break; } <>s__1 = null; <enemy>5__2 = null; <starView>5__3 = null; <starView>5__4 = null; <>s__5 = null; <enemy>5__6 = null; <lunaView>5__7 = null; <lunaView>5__8 = null; <>1__state = -2; } private bool MoveNext() { bool result; try { switch (<>1__state) { default: result = false; goto end_IL_0000; case 0: <>1__state = -1; if (args.Cards.Any((Card card) => card is TFOLTokenBomb) && !<>4__this.BombDialogueTriggered) { <>s__1 = ((Unit)<>4__this).Battle.AllAliveEnemies.GetEnumerator(); <>1__state = -3; while (true) { if (!<>s__1.MoveNext()) { <>m__Finally1(); <>s__1 = null; break; } <enemy>5__2 = <>s__1.Current; if (((GameEntity)<enemy>5__2).Id == "Reimu") { <>2__current = (BattleAction)(object)PerformAction.Chat((Unit)(object)<enemy>5__2, <>4__this.LocShortcut("ChatBomb_Reimu"), 3f, 0f, 1.5f, true); <>1__state = 1; result = true; } else { if (!(((GameEntity)<enemy>5__2).Id == "Marisa")) { <enemy>5__2 = null; continue; } <>2__current = (BattleAction)(object)PerformAction.Chat((Unit)(object)<enemy>5__2, <>4__this.LocShortcut("ChatBomb_Marisa"), 3f, 0f, 1.5f, true); <>1__state = 3; result = true; } goto end_IL_0000; } } if (args.Cards.Any((Card card) => card is TFOLTokenCoffee || card is TFOLTokenGapCoffee || card is TFOLTokenLunarCoffee || card is TFOLTokenMakaiCoffee) && !<>4__this.CoffeeDialogueTriggered) { <>s__5 = ((Unit)<>4__this).Battle.AllAliveEnemies.GetEnumerator(); <>1__state = -4; while (true) { if (!<