Decompiled source of DreamStartOfTurn v1.0.1

DreamStartOfTurnMod_Windows.dll

Decompiled 2 weeks ago
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 AddWatermark;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using LBoL.Core;
using LBoL.Core.Battle;
using LBoL.Core.Battle.BattleActions;
using LBoL.Core.Battle.Interactions;
using LBoL.Core.Cards;
using LbolDreamStartOfTurnMod.BattleActions;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[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("DreamStartOfTurnMod_Windows")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6a38f49264ada0401f4fb520ff5075cbccbfd19c")]
[assembly: AssemblyProduct("DreamStartOfTurnMod_Windows")]
[assembly: AssemblyTitle("DreamStartOfTurnMod_Windows")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LbolDreamStartOfTurnMod
{
	[BepInPlugin("rokk.lbol.gameplay.DreamStartOfTurn", "DreamStartOfTurn", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("LBoL.exe")]
	public class BepinexPlugin : BaseUnityPlugin
	{
		public static string modUniqueID = "DreamStartOfTurnMod";

		private static readonly Harmony harmony = PInfo.harmony;

		internal static ManualLogSource log;

		private void Awake()
		{
			log = ((BaseUnityPlugin)this).Logger;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			log.LogInfo((object)"Running Harmony patches for LbolDreamStartOfTurnMod");
			harmony.PatchAll();
			log.LogInfo((object)"Harmony patches for LbolDreamStartOfTurnMod run");
			if (Chainloader.PluginInfos.ContainsKey("neo.lbol.tools.watermark"))
			{
				WatermarkWrapper.ActivateWatermark();
			}
		}

		private void OnDestroy()
		{
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	public static class PInfo
	{
		public const string GUID = "rokk.lbol.gameplay.DreamStartOfTurn";

		public const string Name = "DreamStartOfTurn";

		public const string version = "1.0.1";

		public static readonly Harmony harmony = new Harmony("rokk.lbol.gameplay.DreamStartOfTurn");
	}
	internal class WatermarkWrapper
	{
		[MethodImpl(MethodImplOptions.NoInlining)]
		internal static void ActivateWatermark()
		{
			API.ActivateWatermark();
		}
	}
}
namespace LbolDreamStartOfTurnMod.Patches
{
	[HarmonyPatch(typeof(BattleController), "StartPlayerTurn")]
	internal class BattleControllerPatches
	{
		private static void Postfix(BattleController __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			__instance.React(new Reactor((BattleAction)(object)new DreamToHandStartOfTurnAction()), (GameEntity)null, (ActionCause)12);
		}
	}
}
namespace LbolDreamStartOfTurnMod.BattleActions
{
	public sealed class DreamToHandStartOfTurnAction : SimpleAction
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass0_0
		{
			public DreamToHandStartOfTurnAction <>4__this;

			public SelectCardInteraction interaction;

			public IReadOnlyList<Card> selected;

			internal void <GetPhases>b__1()
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				((BattleAction)<>4__this).React(Reactor.op_Implicit((BattleAction)new InteractionAction((Interaction)(object)interaction, false)), (GameEntity)null, (ActionCause?)null);
			}

			internal void <GetPhases>b__2()
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				foreach (Card item in selected)
				{
					((BattleAction)<>4__this).React(Reactor.op_Implicit((BattleAction)new MoveCardAction(item, (CardZone)2)), (GameEntity)null, (ActionCause?)null);
				}
			}
		}

		[CompilerGenerated]
		private sealed class <GetPhases>d__0 : IEnumerable<Phase>, IEnumerable, IEnumerator<Phase>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private Phase <>2__current;

			private int <>l__initialThreadId;

			public DreamToHandStartOfTurnAction <>4__this;

			private <>c__DisplayClass0_0 <>8__1;

			Phase IEnumerator<Phase>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetPhases>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>8__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Expected O, but got Unknown
				int num = <>1__state;
				DreamToHandStartOfTurnAction dreamToHandStartOfTurnAction = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass0_0();
					<>8__1.<>4__this = <>4__this;
					List<Card> list = (from card in ((BattleAction)dreamToHandStartOfTurnAction).Battle.DrawZone.Union(((BattleAction)dreamToHandStartOfTurnAction).Battle.DiscardZone)
						where card.IsDreamCard
						select card).ToList();
					if (list.Count > 0)
					{
						<>8__1.interaction = new SelectCardInteraction(0, 1, (IEnumerable<Card>)list, (SelectedCardHandling)0)
						{
							Description = LocalizationExtensions.Localize("SelectCard.DreamCardsToHand", true)
						};
						<>2__current = ((BattleAction)dreamToHandStartOfTurnAction).CreatePhase("Select", (Action)delegate
						{
							//IL_000d: Unknown result type (might be due to invalid IL or missing references)
							//IL_0017: Expected O, but got Unknown
							((BattleAction)<>8__1.<>4__this).React(Reactor.op_Implicit((BattleAction)new InteractionAction((Interaction)(object)<>8__1.interaction, false)), (GameEntity)null, (ActionCause?)null);
						}, false);
						<>1__state = 1;
						return true;
					}
					break;
				}
				case 1:
					<>1__state = -1;
					<>8__1.selected = <>8__1.interaction.SelectedCards;
					if (<>8__1.selected.Count <= 0)
					{
						break;
					}
					<>2__current = ((BattleAction)dreamToHandStartOfTurnAction).CreatePhase("MoveToHand", (Action)delegate
					{
						//IL_001d: Unknown result type (might be due to invalid IL or missing references)
						//IL_0027: Expected O, but got Unknown
						foreach (Card item in <>8__1.selected)
						{
							((BattleAction)<>8__1.<>4__this).React(Reactor.op_Implicit((BattleAction)new MoveCardAction(item, (CardZone)2)), (GameEntity)null, (ActionCause?)null);
						}
					}, false);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					break;
				}
				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();
			}

			[DebuggerHidden]
			IEnumerator<Phase> IEnumerable<Phase>.GetEnumerator()
			{
				<GetPhases>d__0 result;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					result = this;
				}
				else
				{
					result = new <GetPhases>d__0(0)
					{
						<>4__this = <>4__this
					};
				}
				return result;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<Phase>)this).GetEnumerator();
			}
		}

		[IteratorStateMachine(typeof(<GetPhases>d__0))]
		public override IEnumerable<Phase> GetPhases()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetPhases>d__0(-2)
			{
				<>4__this = this
			};
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}