using System;
using System.Collections;
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 BepInEx;
using DiskCardGame;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("OnlyBattles")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Placeholder description")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OnlyBattles")]
[assembly: AssemblyTitle("OnlyBattles")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace OnlyBattles
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "OnlyBattles";
public const string PLUGIN_NAME = "OnlyBattles";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace ExampleMod
{
[BepInPlugin("tvflabs.inscryption.onlybattles", "OnlyBattles", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(MapGenerator), "CreateNode")]
private class NodePatch
{
private static void Postfix(ref NodeData __result, int x, int y, List<NodeData> nodesInRow, List<NodeData> previousNodes, int mapLength)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Expected O, but got Unknown
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Expected O, but got Unknown
NodeData val = null;
bool flag = y + 1 == mapLength;
bool flag2 = y + 2 == mapLength && SaveFile.IsAscension;
bool flag3 = (!flag2 && y % 3 == 0) || flag;
bool flag4 = !flag2 && y % 3 == 1;
if (y == 0)
{
val = new NodeData();
}
else
{
if (!flag)
{
val = (NodeData)((!nodesInRow.Exists((NodeData n) => n is CardBattleNodeData) && !AscensionSaveData.Data.ChallengeIsActive((AscensionChallenge)1)) ? ((object)new CardBattleNodeData()) : ((object)new TotemBattleNodeData()));
}
else
{
val = (NodeData)new BossBattleNodeData();
((BossBattleNodeData)((val is BossBattleNodeData) ? val : null)).bossType = RunState.CurrentMapRegion.bosses[Random.Range(0, RunState.CurrentMapRegion.bosses.Count)];
((CardBattleNodeData)((val is BossBattleNodeData) ? val : null)).specialBattleId = BossBattleSequencer.GetSequencerIdForBoss(((BossBattleNodeData)((val is BossBattleNodeData) ? val : null)).bossType);
}
((CardBattleNodeData)((val is CardBattleNodeData) ? val : null)).difficulty = RunState.Run.regionTier * 6 + (y + 1) / 3 - 1;
}
if (val == null)
{
val = (NodeData)new CardBattleNodeData();
}
val.gridX = x;
val.gridY = y;
((MapElementData)val).id = MapGenerator.GetNewID();
__result = val;
}
}
[HarmonyPatch(typeof(RunState), "GenerateMapDataForCurrentRegion")]
private class MapLengthPatch
{
private static void Postfix(RunState __instance, PredefinedNodes predefinedNodes = null)
{
int num = 5;
__instance.map = MapGenerator.GenerateMap(RunState.CurrentMapRegion, 3, num, (PredefinedNodes)null);
__instance.currentNodeId = ((MapElementData)__instance.map.RootNode).id;
}
}
[HarmonyPatch(typeof(MapGenerator), "GenerateMap")]
private class FinalMapPatch
{
private static void Postfix(RunState __instance, ref MapData __result, RegionData region, int gridWidth, int gridLength, PredefinedNodes predefinedNodes = null)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_004b: 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_0066: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
MapData val = __result;
if ((Object)(object)region == (Object)(object)RegionProgression.Instance.ascensionFinalRegion || (Object)(object)region == (Object)(object)RegionProgression.Instance.ascensionFinalBossRegion)
{
NodeData val2 = (NodeData)new BossBattleNodeData();
((CardBattleNodeData)((val2 is BossBattleNodeData) ? val2 : null)).difficulty = 20;
((BossBattleNodeData)((val2 is BossBattleNodeData) ? val2 : null)).bossType = (Type)7;
((CardBattleNodeData)((val2 is BossBattleNodeData) ? val2 : null)).specialBattleId = "LeshyBattleSequencer";
NodeData item = new NodeData();
PredefinedNodes val3 = new PredefinedNodes();
val3.nodeRows = new List<List<NodeData>>(2)
{
new List<NodeData>(1) { item },
new List<NodeData>(1) { val2 }
};
List<NodeData> list = MapGenerator.GenerateNodes(val3.nodeRows.Count, 1, val3);
MapGenerator.PositionNodes(list, val.mapLength, gridWidth, gridLength);
val.nodeData = list;
}
__result = val;
}
}
[HarmonyPatch(typeof(Part1BossOpponent), "BossDefeatedSequence")]
private class RareCardPatch
{
private static IEnumerator Postfix(IEnumerator values, Part1BossOpponent __instance)
{
LeshyAnimationController.Instance.SetMaskShown(false);
__instance.DestroyScenery();
__instance.SetSceneEffectsShown(false);
AudioController.Instance.StopAllLoops();
yield return (object)new WaitForSeconds(0.75f);
__instance.CleanUpBossBehaviours();
CustomCoroutine.WaitThenExecute(1f, (Action)LeshyAnimationController.Instance.HideArms, false);
if (ScriptDefines.STEAM_DEMO)
{
yield return __instance.SteamDemoEnd();
}
if (ScriptDefines.BITSUMMIT_DEMO)
{
yield return __instance.BitSummitDemoEnd();
}
Singleton<ViewManager>.Instance.SwitchToView((View)1, false, true);
yield return (object)new WaitForSeconds(0.8f);
if (RunState.Run.maxPlayerLives > 1)
{
yield return Singleton<TextDisplayer>.Instance.PlayDialogueEvent("ReplenishLives", (MessageAdvanceMode)1, (EventIntersectMode)0, (string[])null, (Action<Line>)null);
yield return (object)new WaitForSeconds(0.25f);
if (Random.value > 0.8f)
{
Singleton<VideoCameraRig>.Instance.PlayCameraAnim("refocus_quick");
}
yield return Singleton<CandleHolder>.Instance.ReplenishFlamesSequence(0.25f);
RunState.Run.playerLives = RunState.Run.maxPlayerLives;
}
Singleton<TurnManager>.Instance.PostBattleSpecialNode = null;
}
}
private Harmony harmony = new Harmony("tvflabs.inscryption.onlybattles");
private const string PluginGuid = "tvflabs.inscryption.onlybattles";
private const string PluginName = "OnlyBattles";
private const string PluginVersion = "1.0.0";
private const string PluginPrefix = "OnlyBattles";
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded OnlyBattles!");
harmony.PatchAll();
}
}
}