using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EliteVariety.Elites;
using HG;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MysticsRisky2Utils.BaseAssetTypes;
using On.RoR2;
using R2API;
using RoR2;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FixElites")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FixElites")]
[assembly: AssemblyTitle("FixElites")]
[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 FixElites
{
[BepInPlugin("_score.FixMysticsElites", "FixMysticsElites", "0.0.1")]
public class FixElitesPlugin : BaseUnityPlugin
{
public const string PluginGUID = "_score.FixMysticsElites";
public const string PluginAuthor = "score";
public const string PluginName = "FixMysticsElites";
public const string PluginVersion = "0.0.1";
public void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
Harmony val = new Harmony("_score.FixMysticsElites");
try
{
val.CreateClassProcessor(typeof(FixBase)).Patch();
}
catch (Exception)
{
}
try
{
val.CreateClassProcessor(typeof(FixVariety)).Patch();
}
catch (Exception)
{
}
}
}
[HarmonyPatch]
public class FixBase
{
[HarmonyPatch(typeof(BaseElite), "CombatDirector_Init")]
[HarmonyPrefix]
public static bool FixBaseElite(orig_Init orig)
{
orig.Invoke();
foreach (BaseElite elite in BaseElite.elites)
{
switch (elite.vanillaTier)
{
case 1:
ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[1].eliteTypes, ref elite.eliteDef);
ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[4].eliteTypes, ref elite.eliteDef);
break;
case 2:
ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[5].eliteTypes, ref elite.eliteDef);
break;
}
if (elite.isHonor)
{
ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[2].eliteTypes, ref elite.eliteDef);
ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[3].eliteTypes, ref elite.eliteDef);
}
}
return false;
}
}
[HarmonyPatch]
public class FixVariety
{
[HarmonyPatch("EliteVariety.Elites.Pillaging+<>c__DisplayClass1_0, EliteVariety, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "<OnLoad>b__3")]
[HarmonyPrefix]
public static bool FixPillage(EliteRules rules, ref bool __result)
{
//IL_001b: 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)
if (Pillaging.CanSpawnPillagingMoreOften() && Pillaging.PillagingMoreOftenChance())
{
__result = EliteAPI.VanillaEliteTiers[4].isAvailable(rules) || EliteAPI.VanillaFirstTierDef.isAvailable(rules);
}
else
{
__result = false;
}
return false;
}
[HarmonyPatch("EliteVariety.Elites.Pillaging+<>c__DisplayClass1_0, EliteVariety, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "<OnLoad>b__4")]
[HarmonyPrefix]
public static bool FixPillageHonor(EliteRules rules, ref bool __result)
{
//IL_001b: 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)
if (Pillaging.CanSpawnPillagingMoreOften() && Pillaging.PillagingMoreOftenChance())
{
__result = EliteAPI.VanillaEliteTiers[3].isAvailable(rules) || EliteAPI.VanillaEliteOnlyFirstTierDef.isAvailable(rules);
}
else
{
__result = false;
}
return false;
}
}
}