using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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.Logging;
using HarmonyLib;
using I2.Loc;
using MMTools;
using Microsoft.CodeAnalysis;
using MonoMod.Utils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyCompany("p1xel8ted")]
[assembly: AssemblyConfiguration("Release-Thunderstore")]
[assembly: AssemblyDescription("SkipOfTheLambLite")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1+b56d25329e0aa71085bc9fceb9ea5f71b887e4a4")]
[assembly: AssemblyProduct("SkipOfTheLambLite")]
[assembly: AssemblyTitle("SkipOfTheLambLite")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.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 SkipOfTheLambLite
{
[Harmony]
public static class Patches
{
private static bool _hasSkippedDevIntros;
[HarmonyPrefix]
[HarmonyPatch(typeof(LoadMainMenu), "Start")]
public static bool LoadMainMenu_Start()
{
if (_hasSkippedDevIntros)
{
return true;
}
Plugin.Log.LogInfo((object)"[LoadMainMenu.Start]: Skipping dev intros");
_hasSkippedDevIntros = true;
((Behaviour)AudioManager.Instance).enabled = true;
GameManager.ForceFontReload();
LocalizationManager.SetupFonts();
MMTransition.Play((TransitionType)0, (Effect)0, "Main Menu", 0f, "", (Action)null, (Action)null);
return false;
}
}
[BepInPlugin("p1xel8ted.cotl.skipofthelamblite", "Skip of the Lamb Lite", "0.1.1")]
[BepInIncompatibility("p1xel8ted.cotl.skipofthelamb")]
public class Plugin : BaseUnityPlugin
{
private const string PluginGuid = "p1xel8ted.cotl.skipofthelamblite";
private const string PluginName = "Skip of the Lamb Lite";
private const string PluginVer = "0.1.1";
internal static ManualLogSource Log { get; private set; }
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "p1xel8ted.cotl.skipofthelamblite");
Log.LogInfo((object)"Skip of the Lamb Lite loaded.");
}
}
}
namespace Shared
{
public static class Helpers
{
private static class StorefrontDetector
{
private static readonly string[] PiracyFiles = new string[65]
{
"SmartSteamEmu.ini", "codex.ini", "steam_emu.ini", "goldberg_emulator.dll", "steamclient_loader.dll", "steam_api64_o.dll", "steam_api.cdx", "steam_api64.cdx.dll", "steam_interfaces.txt", "local_save.txt",
"valve.ini", "codex64.dll", "coldclient.dll", "ColdClientLoader.ini", "steamless.dll", "GreenLuma", "CreamAPI.dll", "cream_api.ini", "ScreamAPI.dll", "OnlineFix.dll",
"OnlineFix.url", "online-fix.me", "CODEX", "SKIDROW", "CPY", "PLAZA", "HOODLUM", "EMPRESS", "TENOKE", "PROPHET",
"REVOLT", "DARKSiDERS", "RAZOR1911", "FLT", "FLT.dll", "RUNE", "RUNE.ini", "TiNYiSO", "RELOADED", "RLD!",
"DOGE", "BAT", "P2P", "ElAmigos", "FitGirl", "DODI", "xatab", "KaOs", "IGG", "Masquerade",
"3dmgame.dll", "ALI213.dll", "crack", "crack.exe", "Crack.nfo", "crackfix", "CrackOnly", "fix.exe", "gamefix.dll", "SKIDROW.ini",
"nosTEAM", "NoSteam", "FCKDRM", "Goldberg", "VALVEEMPRESS"
};
public static string DetectStorefront()
{
string dir = Directory.GetCurrentDirectory();
string text = "Unknown";
if (File.Exists(Path.Combine(dir, "steam_api.dll")) || File.Exists(Path.Combine(dir, "steam_api64.dll")) || File.Exists(Path.Combine(dir, "steam_appid.txt")) || Directory.Exists(Path.Combine(dir, "steam_settings")))
{
text = "Steam";
}
else if (Directory.GetFiles(dir, "goggame-*.info").Any() || File.Exists(Path.Combine(dir, "galaxy.dll")))
{
text = "GOG";
}
else if (File.Exists(Path.Combine(dir, "EOSSDK-Win64-Shipping.dll")) || File.Exists(Path.Combine(dir, "EpicOnlineServices.dll")) || Directory.Exists(Path.Combine(dir, ".egstore")))
{
text = "Epic";
}
else if (IsProcessRunning("steam"))
{
text = "Steam (process only)";
}
else if (IsProcessRunning("GalaxyClient"))
{
text = "GOG (process only)";
}
else if (IsProcessRunning("EpicGamesLauncher"))
{
text = "Epic (process only)";
}
if (PiracyFiles.Any((string pirate) => File.Exists(Path.Combine(dir, pirate)) || Directory.Exists(Path.Combine(dir, pirate))))
{
text += " + Possible Pirated/Cracked Files Found!";
}
return text;
}
private static bool IsProcessRunning(string name)
{
return Process.GetProcessesByName(name).Length != 0;
}
}
[CompilerGenerated]
private sealed class <FilterEnumerator>d__6 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public IEnumerator original;
public Type[] typesToRemove;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FilterEnumerator>d__6(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
while (original.MoveNext())
{
object current = original.Current;
if (current != null && !ArrayExtensions.Contains<Type>(typesToRemove, current.GetType()))
{
<>2__current = current;
<>1__state = 1;
return true;
}
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
internal static List<Follower> AllFollowers => FollowerManager.Followers.SelectMany((KeyValuePair<FollowerLocation, List<Follower>> followerList) => followerList.Value).ToList();
private static bool ContainsIgnoreCase(this string source, string value)
{
if (source == null)
{
return false;
}
return source.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0;
}
public static void PrintModLoaded(string plugin, ManualLogSource logger)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
string text = Application.version.Replace("\r", "").Replace("\n", "");
string buildGUID = Application.buildGUID;
Platform current = PlatformHelper.Current;
string text2 = StorefrontDetector.DetectStorefront();
logger.LogInfo((object)"==========================================");
logger.LogInfo((object)(" Plugin Loaded: " + plugin));
logger.LogInfo((object)(" Version : " + text + " (BuildGUID: " + buildGUID + ")"));
logger.LogInfo((object)$" Platform : {current}");
logger.LogInfo((object)(" Storefront: " + text2));
logger.LogInfo((object)"==========================================");
}
public static bool IsMultiplierActive(float value)
{
return !Mathf.Approximately(value, 1f);
}
[IteratorStateMachine(typeof(<FilterEnumerator>d__6))]
public static IEnumerator FilterEnumerator(IEnumerator original, Type[] typesToRemove)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FilterEnumerator>d__6(0)
{
original = original,
typesToRemove = typesToRemove
};
}
public static void LogCallStack(ManualLogSource logger, int skipFrames = 3, int maxFrames = 10)
{
StackTrace stackTrace = new StackTrace(fNeedFileInfo: false);
int frameCount = stackTrace.FrameCount;
for (int i = skipFrames; i < frameCount && i < maxFrames; i++)
{
MethodBase methodBase = stackTrace.GetFrame(i)?.GetMethod();
logger.LogWarning((object)string.Format(arg1: (methodBase?.DeclaringType)?.FullName, format: "[Frame {0}] {1}.{2}", arg0: i, arg2: methodBase?.Name));
}
}
public static Type GetCallingType(ICollection<Type> targetTypes, int skipFrames = 3, int maxFrames = 10)
{
StackTrace stackTrace = new StackTrace(fNeedFileInfo: false);
int frameCount = stackTrace.FrameCount;
for (int i = skipFrames; i < frameCount && i < maxFrames; i++)
{
Type type = stackTrace.GetFrame(i)?.GetMethod()?.DeclaringType;
if (type != null && targetTypes.Contains(type))
{
return type;
}
}
return null;
}
public static bool IsCalledFrom(string typeNameContains, string methodNameContains = null, int skipFrames = 3, int maxFrames = 10)
{
StackTrace stackTrace = new StackTrace(fNeedFileInfo: false);
int frameCount = stackTrace.FrameCount;
for (int i = skipFrames; i < frameCount && i < maxFrames; i++)
{
MethodBase methodBase = stackTrace.GetFrame(i)?.GetMethod();
Type type = methodBase?.DeclaringType;
if (!(type == null))
{
bool num = type.FullName.ContainsIgnoreCase(typeNameContains);
bool flag = methodNameContains == null || methodBase.Name.ContainsIgnoreCase(methodNameContains);
if (num && flag)
{
return true;
}
}
}
return false;
}
}
}