using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using DunGen.Graph;
using HarmonyLib;
using MansionOnly.Patches;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OnlyFacility")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OnlyFacility")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("de6ef450-8df9-48d3-b5ad-7ed7166636af")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MansionOnly
{
[BepInPlugin("Ralawre.FacilityOnly", "Facility Only Mod", "1.0.0")]
public class MansionModBase : BaseUnityPlugin
{
private const string modGUID = "Ralawre.FacilityOnly";
private const string modName = "Facility Only Mod";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Ralawre.FacilityOnly");
public static MansionModBase Instance { get; private set; }
public static ManualLogSource mls { get; private set; }
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
if ((Object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Ralawre.FacilityOnly");
mls.LogInfo((object)"The Facility Only mod has awakened!");
harmony.PatchAll(typeof(DungeonFlowTypePatch));
}
}
}
namespace MansionOnly.Patches
{
internal class DungeonFlowTypePatch
{
[HarmonyPatch(typeof(RoundManager), "Awake")]
[HarmonyPriority(250)]
[HarmonyPostfix]
private static void onStartPrefix(RoundManager __instance)
{
List<DungeonFlow> list = new List<DungeonFlow>();
MansionModBase.mls.LogInfo((object)"Inserting missing dungeon flows into the RoundManager");
List<DungeonFlow> list2 = __instance.dungeonFlowTypes.ToList();
list.AddRange(Resources.FindObjectsOfTypeAll<DungeonFlow>());
for (int i = 0; i < list.Count; i++)
{
DungeonFlow item = list[i];
list2.Add(item);
}
__instance.dungeonFlowTypes = list2.ToArray();
}
[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
[HarmonyPrefix]
private static void FlowTypeUpdate(RoundManager __instance)
{
SelectableLevel currentLevel = __instance.currentLevel;
MansionModBase.mls.LogInfo((object)"Changing dungeon flow values");
currentLevel.dungeonFlowTypes = __instance.setDungeonFlowTypeRarity();
}
}
public static class DungeonFlowTypeExtensions
{
public static IntWithRarity[] setDungeonFlowTypeRarity(this RoundManager manager)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
MansionModBase.mls.LogInfo((object)"Entered setDungeonFlowTypeRarity");
List<IntWithRarity> list = new List<IntWithRarity>();
for (int i = 0; i < manager.dungeonFlowTypes.Length; i++)
{
IntWithRarity val = new IntWithRarity();
val.id = i;
MansionModBase.mls.LogInfo((object)("DungeonFlow Name = " + ((Object)manager.dungeonFlowTypes[i]).name));
if (((Object)manager.dungeonFlowTypes[i]).name == "Level2Flow")
{
val.rarity = 0;
}
else
{
val.rarity = 300;
}
MansionModBase.mls.LogInfo((object)$"New Rarity = {val.rarity}");
list.Add(val);
}
return list.ToArray();
}
}
}