using System;
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using HutongGames.PlayMaker;
using HutongGames.PlayMaker.Actions;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[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: AssemblyCompany("SkipKarmelitaArena")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+39f685c10067be14c9b5ee8a204751eced667ea3")]
[assembly: AssemblyProduct("SkipKarmelitaArena")]
[assembly: AssemblyTitle("SkipCarmelitaArena")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace SkipKarmelitaArena
{
[HarmonyPatch]
[BepInPlugin("io.github.randomscorp.skipkarmelitaarena", "Skip Karmelita Arena", "1.2.0")]
public class SkipKarmelitaArenaPlugin : BaseUnityPlugin
{
public class CustomFSMAction : FsmStateAction
{
private Action action;
public CustomFSMAction(Action action)
{
this.action = action;
}
public override void OnEnter()
{
action();
((FsmStateAction)this).OnEnter();
}
}
public static ConfigEntry<bool> skipKarmelitaArena;
public static ConfigEntry<bool> skipCrawFatherArena;
public static ConfigEntry<bool> skipUnravelledArena;
public static ConfigEntry<bool> skipBroodingMotherArena;
public static ConfigEntry<bool> skipChefLugoliArena;
public static ConfigEntry<bool> skipGroalArena;
public static ManualLogSource logger;
private Harmony harmony = new Harmony("io.github.randomscorp.skipkarmelitaarena");
private void Awake()
{
logger = ((BaseUnityPlugin)this).Logger;
skipKarmelitaArena = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Skip Karmelita Arena?", true, (ConfigDescription)null);
skipCrawFatherArena = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Skip Craw Father Arena?", true, (ConfigDescription)null);
skipUnravelledArena = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Skip Unravelled Arena?", true, (ConfigDescription)null);
skipBroodingMotherArena = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Skip Brooding Mother Arena?", true, (ConfigDescription)null);
skipChefLugoliArena = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Skip Chef Lugoli Arena?", true, (ConfigDescription)null);
skipGroalArena = ((BaseUnityPlugin)this).Config.Bind<bool>("Gameplay", "Skip Groal The Great Arena?", true, (ConfigDescription)null);
harmony.PatchAll();
}
[HarmonyPatch(typeof(PlayMakerFSM), "OnEnable")]
[HarmonyPrefix]
private static void PatchFsmArenas(PlayMakerFSM __instance)
{
//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_036a: Unknown result type (might be due to invalid IL or missing references)
//IL_036f: Unknown result type (might be due to invalid IL or missing references)
//IL_043a: Unknown result type (might be due to invalid IL or missing references)
//IL_043f: Unknown result type (might be due to invalid IL or missing references)
PlayMakerFSM __instance2 = __instance;
if (skipKarmelitaArena.Value && __instance2.FsmName == "Control" && ((Object)((Component)__instance2).gameObject).name == "Hunter Queen Boss")
{
FsmState val = __instance2.FsmStates.First((FsmState state) => state.name == "Battle Dance");
val.Actions.First((FsmStateAction action) => ((object)action).GetType() == typeof(SendMessage)).Enabled = false;
val.Actions = CollectionExtensions.AddToArray<FsmStateAction>(val.Actions, (FsmStateAction)(object)new CustomFSMAction(delegate
{
__instance2.SendEvent("BATTLE END");
}));
val.Actions.First((FsmStateAction action) => ((object)action).GetType() == typeof(Wait)).Enabled = false;
return;
}
Scene scene;
if (skipUnravelledArena.Value)
{
scene = ((Component)__instance2).gameObject.scene;
if (((Scene)(ref scene)).name == "Ward_02_boss" && __instance2.FsmName == "Control" && ((Object)((Component)__instance2).gameObject).name == "Boss Scene")
{
FsmState val2 = __instance2.FsmStates.First((FsmState state) => state.name == "First Slasher");
val2.Actions = (FsmStateAction[])(object)new FsmStateAction[1]
{
new CustomFSMAction(delegate
{
__instance2.SetState("P3 Shake");
})
};
__instance2.FsmStates.First((FsmState state) => state.name == "Boss Title").Actions.First((FsmStateAction action) => ((object)action).GetType() == typeof(Wait)).Enabled = false;
__instance2.FsmStates.First((FsmState state) => state.name == "Arena Start").Actions.First((FsmStateAction action) => ((object)action).GetType() == typeof(Wait)).Enabled = false;
__instance2.FsmStates.First((FsmState state) => state.name == "Encountered Pause").Actions.First((FsmStateAction action) => ((object)action).GetType() == typeof(Wait)).Enabled = false;
__instance2.FsmStates.First((FsmState state) => state.name == "Encountered Start").Actions.First((FsmStateAction action) => ((object)action).GetType() == typeof(Wait)).Enabled = false;
return;
}
}
if (skipGroalArena.Value)
{
scene = ((Component)__instance2).gameObject.scene;
if (((Scene)(ref scene)).name == "Shadow_18" && __instance2.FsmName == "Control" && ((Object)((Component)__instance2).gameObject).name == "Swamp Shaman")
{
FSMUtility.LocateMyFSM(((Component)__instance2).gameObject, "Control").FsmStates.First((FsmState state) => state.name == "Fake Battle End").Actions = (FsmStateAction[])(object)new FsmStateAction[1]
{
new CustomFSMAction(delegate
{
__instance2.SendEvent("FINISHED");
})
};
return;
}
}
if (!skipCrawFatherArena.Value)
{
return;
}
scene = ((Component)__instance2).gameObject.scene;
if (!(((Scene)(ref scene)).name == "Room_CrowCourt_02"))
{
return;
}
if (__instance2.FsmName == "Control" && ((Object)((Component)__instance2).gameObject).name == "Crawfather")
{
__instance2.FsmStates.First((FsmState state) => state.name == "Emerge Announce").Actions = (FsmStateAction[])(object)new FsmStateAction[1]
{
new CustomFSMAction(delegate
{
__instance2.SendEvent("FINISHED");
})
};
}
else if (__instance2.FsmName == "Battle Start" && ((Object)((Component)__instance2).gameObject).name == "Battle Start")
{
__instance2.FsmStates.First((FsmState state) => state.name == "Crowd Roar").Actions = (FsmStateAction[])(object)new FsmStateAction[1]
{
new CustomFSMAction(delegate
{
__instance2.SetState("Battle Start");
})
};
__instance2.FsmStates.First((FsmState state) => state.name == "Lights Up").Actions.First((FsmStateAction action) => ((object)action).GetType() == typeof(Wait)).Enabled = false;
}
}
[HarmonyPatch(typeof(BattleScene), "Awake")]
[HarmonyPrefix]
private static void PatchBattleSceneArenas(BattleScene __instance)
{
//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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
Scene scene = ((Component)__instance).gameObject.scene;
if (!(((Scene)(ref scene)).name == "Room_CrowCourt_02") || !skipCrawFatherArena.Value)
{
scene = ((Component)__instance).gameObject.scene;
if (!(((Scene)(ref scene)).name == "Dust_Chef") || !skipChefLugoliArena.Value)
{
scene = ((Component)__instance).gameObject.scene;
if (!(((Scene)(ref scene)).name == "Shadow_18") || !skipGroalArena.Value)
{
scene = ((Component)__instance).gameObject.scene;
if (!(((Scene)(ref scene)).name == "Slab_16b") || !skipBroodingMotherArena.Value)
{
return;
}
}
}
}
__instance.waves = new List<BattleWave> { __instance.waves[__instance.waves.Count() - 1] };
}
}
}