using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AssholeCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AssholeCompany")]
[assembly: AssemblyTitle("AssholeCompany")]
[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 AssholeCompany
{
internal class ModInfo
{
public const string GUID = "x8c8r.AssholeCompany";
public const string NAME = "Asshole Company";
public const string VER = "1.0.0";
}
[BepInPlugin("x8c8r.AssholeCompany", "Asshole Company", "1.0.0")]
public class AssholeCompany : BaseUnityPlugin
{
internal Harmony harmony = new Harmony("x8c8r.AssholeCompany");
internal static ManualLogSource ALogger = Logger.CreateLogSource("x8c8r.AssholeCompany");
private void Awake()
{
Logger.Sources.Add((ILogSource)(object)ALogger);
ALogger.LogInfo((object)"Mod Asshole Company (x8c8r.AssholeCompany) is loaded!");
harmony.PatchAll(typeof(SOR_MapScreen_Patch));
harmony.PatchAll(typeof(Term_TextPostProcess_Patch));
}
}
public static class AssUtils
{
public static string GetNumAsHex(int i)
{
string s = i.ToString();
byte[] bytes = Encoding.Default.GetBytes(s);
string text = BitConverter.ToString(bytes);
return text.Replace("-", "");
}
}
[HarmonyPatch]
public class SOR_MapScreen_Patch
{
[HarmonyPatch(typeof(StartOfRound))]
[HarmonyPatch("SetMapScreenInfoToCurrentLevel")]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
FieldInfo fieldInfo = AccessTools.Field(typeof(StartOfRound), "currentLevel");
FieldInfo fieldInfo2 = AccessTools.Field(typeof(SelectableLevel), "currentWeather");
val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[4]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo2, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_I4_M1, (object)null, (string)null)
});
for (int i = 0; i < 4; i++)
{
val.SetAndAdvance(OpCodes.Nop, (object)null);
}
val.SetOpcodeAndAdvance(OpCodes.Br_S);
return val.InstructionEnumeration();
}
}
[HarmonyPatch]
public class Term_TextPostProcess_Patch
{
[HarmonyPatch(typeof(Terminal))]
[HarmonyPatch("TextPostProcess")]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
FieldInfo fieldInfo = AccessTools.Field(typeof(Terminal), "moonsCatalogueList");
FieldInfo fieldInfo2 = AccessTools.Field(typeof(SelectableLevel), "lockedForDemo");
val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[4]
{
new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldloc_3, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldelem_Ref, (object)null, (string)null)
}).Advance(7);
for (int i = 0; i < 17; i++)
{
val.SetAndAdvance(OpCodes.Nop, (object)null);
}
return val.InstructionEnumeration();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "AssholeCompany";
public const string PLUGIN_NAME = "AssholeCompany";
public const string PLUGIN_VERSION = "1.0.0";
}
}