using System;
using System.Collections.Generic;
using System.Diagnostics;
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.Base;
using LBoL.Base.Extensions;
using LBoL.Presentation.UI.Panels;
using LBoLEntitySideloader;
using LBoLEntitySideloader.Resource;
using UnityEngine;
[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("AltAutoTapper")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AltAutoTapper")]
[assembly: AssemblyTitle("AltAutoTapper")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AltAutoTapper
{
[BepInPlugin("rmrfmaxx.lbol.AltAutoTapper", "AltAutoTapper", "0.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("LBoL.exe")]
public class BepinexPlugin : BaseUnityPlugin
{
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("rmrfmaxx.lbol.AltAutoTapper", "");
private void Awake()
{
log = ((BaseUnityPlugin)this).Logger;
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
EntityManager.RegisterSelf();
harmony.PatchAll();
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 = "rmrfmaxx.lbol.AltAutoTapper";
public const string Name = "AltAutoTapper";
public const string version = "0.0.1";
public static readonly Harmony harmony = new Harmony("rmrfmaxx.lbol.AltAutoTapper");
}
[HarmonyPatch]
internal class AltAutoTapperPatch
{
[HarmonyPatch(typeof(BattleManaPanel), "FillAnyCost")]
[HarmonyPrefix]
public static bool FillAnyCost(ref int any, ref ManaGroup available, in ManaGroup handRemainCost, out ManaGroup payment)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: 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_0097: 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_00d3: 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)
//IL_00ed: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: 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_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: 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)
payment = ManaGroup.Empty;
ManaGroup val = ManaGroup.Empty;
int colorless = ((ManaGroup)(ref available)).Colorless;
if (colorless >= any)
{
((ManaGroup)(ref available)).Colorless = ((ManaGroup)(ref available)).Colorless - any;
((ManaGroup)(ref payment)).Colorless = ((ManaGroup)(ref payment)).Colorless + any;
any = 0;
return false;
}
((ManaGroup)(ref available)).Colorless = 0;
((ManaGroup)(ref payment)).Colorless = ((ManaGroup)(ref payment)).Colorless + colorless;
any -= colorless;
List<ManaColor> list = new List<ManaColor>();
foreach (ManaColor item in ManaColors.WUBRG)
{
ManaGroup val2 = handRemainCost;
if (((ManaGroup)(ref val2))[item] == 0)
{
list.Add(item);
}
}
while (any > 0)
{
ManaColor val3 = CollectionsExtensions.MaxByOrDefault<ManaColor, int>((IEnumerable<ManaColor>)list, (Func<ManaColor, int>)((ManaGroup)(object)available).GetValue);
int num = (((int)val3 != 0) ? ((ManaGroup)(ref available))[val3] : 0);
if (num == 0)
{
val = available - handRemainCost;
val3 = ((((ManaGroup)(ref val)).MaxTrivialColorAmount <= 0) ? CollectionsExtensions.MaxBy<ManaColor, int>((IEnumerable<ManaColor>)ManaColors.WUBRG, (Func<ManaColor, int>)((ManaGroup)(object)available).GetValue) : ((ManaGroup)(ref val)).MaxTrivialColor);
num = ((ManaGroup)(ref available))[val3];
}
if (num == 0)
{
break;
}
((ManaGroup)(ref available))[val3] = num - 1;
ManaColor val4 = val3;
int num2 = ((ManaGroup)(ref payment))[val4] + 1;
((ManaGroup)(ref payment))[val4] = num2;
any--;
}
if (any != 0)
{
int philosophy = ((ManaGroup)(ref available)).Philosophy;
if (philosophy >= any)
{
((ManaGroup)(ref available)).Philosophy = ((ManaGroup)(ref available)).Philosophy - any;
((ManaGroup)(ref payment)).Philosophy = ((ManaGroup)(ref payment)).Philosophy + any;
any = 0;
}
else
{
((ManaGroup)(ref available)).Philosophy = 0;
((ManaGroup)(ref payment)).Philosophy = ((ManaGroup)(ref payment)).Philosophy + philosophy;
any -= philosophy;
}
}
return false;
}
[HarmonyPatch(typeof(BattleManaPanel), "FillHybridCost")]
[HarmonyPrefix]
public static bool FillHybridCost(ref int hybrid, List<ManaColor> hybridColors, ref ManaGroup available, in ManaGroup handRemainCost, out ManaGroup payment)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: 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_00c8: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
payment = ManaGroup.Empty;
ManaGroup val = ManaGroup.Empty;
List<ManaColor> list = new List<ManaColor>();
foreach (ManaColor hybridColor in hybridColors)
{
ManaGroup val2 = handRemainCost;
if (((ManaGroup)(ref val2))[hybridColor] == 0)
{
list.Add(hybridColor);
}
}
while (hybrid > 0)
{
ManaColor val3 = CollectionsExtensions.MaxByOrDefault<ManaColor, int>((IEnumerable<ManaColor>)list, (Func<ManaColor, int>)((ManaGroup)(object)available).GetValue);
int num = (((int)val3 != 0) ? ((ManaGroup)(ref available))[val3] : 0);
if (num == 0)
{
foreach (ManaColor hybridColor2 in hybridColors)
{
((ManaGroup)(ref val)).SetValue(hybridColor2, ((ManaGroup)(ref available))[hybridColor2]);
}
val -= handRemainCost;
val3 = ((((ManaGroup)(ref val)).MaxTrivialColorAmount <= 0) ? CollectionsExtensions.MaxBy<ManaColor, int>((IEnumerable<ManaColor>)hybridColors, (Func<ManaColor, int>)((ManaGroup)(object)available).GetValue) : ((ManaGroup)(ref val)).MaxTrivialColor);
num = ((ManaGroup)(ref available))[val3];
}
if (num == 0)
{
break;
}
((ManaGroup)(ref available))[val3] = num - 1;
ManaColor val4 = val3;
int num2 = ((ManaGroup)(ref payment))[val4] + 1;
((ManaGroup)(ref payment))[val4] = num2;
hybrid--;
}
if (hybrid != 0)
{
int philosophy = ((ManaGroup)(ref available)).Philosophy;
if (philosophy >= hybrid)
{
((ManaGroup)(ref available)).Philosophy = ((ManaGroup)(ref available)).Philosophy - hybrid;
((ManaGroup)(ref payment)).Philosophy = ((ManaGroup)(ref payment)).Philosophy + hybrid;
hybrid = 0;
}
else
{
((ManaGroup)(ref available)).Philosophy = 0;
((ManaGroup)(ref payment)).Philosophy = ((ManaGroup)(ref payment)).Philosophy + philosophy;
hybrid -= philosophy;
}
}
return false;
}
}
internal class WatermarkWrapper
{
[MethodImpl(MethodImplOptions.NoInlining)]
internal static void ActivateWatermark()
{
API.ActivateWatermark();
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}