using System;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("LoreToken")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("LoreToken Overhaul with Integrated Shield")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0")]
[assembly: AssemblyProduct("LoreToken")]
[assembly: AssemblyTitle("LoreToken")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.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;
}
}
}
[BepInPlugin("com.justi.loretoken", "LoreToken Overhaul", "1.3.0")]
public class LoreTokenCore : BaseUnityPlugin
{
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
Harmony val = new Harmony("com.justi.loretoken.master");
try
{
MethodInfo method = typeof(Assembly).GetMethod("GetTypes", Type.EmptyTypes);
MethodInfo method2 = typeof(LoreTokenCore).GetMethod("ScannerShieldPrefix");
val.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Shield Integrated: Scanner protection active.");
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Shield failed: " + ex.Message));
}
ApplyCompatibilityPatches(val);
((BaseUnityPlugin)this).Logger.LogInfo((object)"LoreToken Systems: Initialized.");
}
private void ApplyCompatibilityPatches(Harmony harmony)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
try
{
MethodInfo methodInfo = AccessTools.Method("CardsPlusPlugin.Cards.Cyberpunk.CyberCardEffect:SetFont", (Type[])null, (Type[])null);
if (methodInfo != null)
{
MethodInfo method = typeof(LoreTokenCore).GetMethod("GenericSafetyPrefix");
harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
}
catch
{
}
}
public static bool ScannerShieldPrefix(Assembly __instance, ref Type[] __result)
{
string name = __instance.GetName().Name;
if (name.Contains("LoreToken") || name.Contains("Photon") || name.Contains("ScannerShield"))
{
__result = Array.Empty<Type>();
return false;
}
return true;
}
public static bool GenericSafetyPrefix(MonoBehaviour __instance)
{
if ((Object)(object)__instance == (Object)null || (Object)(object)((Component)__instance).transform == (Object)null)
{
return false;
}
return true;
}
}
namespace ScannerShield
{
[BepInPlugin("com.justi.shield.bouncer", "Scanner Bouncer", "1.0.0")]
public class BlacklistPatch : BaseUnityPlugin
{
private static readonly string[] BlacklistedAssemblies = new string[4] { "LoreToken", "LoreTokenOverhaul", "LoreTokenCore", "Skeletal_Void_Archive" };
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
Harmony val = new Harmony("com.justi.shield.bouncer");
MethodInfo method = typeof(Assembly).GetMethod("GetTypes", Type.EmptyTypes);
MethodInfo method2 = typeof(BlacklistPatch).GetMethod("GetTypesPrefix");
if (method != null)
{
val.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Shield Active: Problematic mods will be ignored by scanners.");
}
}
public static bool GetTypesPrefix(Assembly __instance, ref Type[] __result)
{
string name = __instance.GetName().Name;
if (BlacklistedAssemblies.Contains(name))
{
__result = Array.Empty<Type>();
return false;
}
return true;
}
}
}