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 BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("linkoid")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DarkRepo")]
[assembly: AssemblyTitle("DarkRepo")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 Linkoid.Repo.DarkRepo
{
[BepInPlugin("Linkoid.Repo.DarkRepo", "Dark REPO", "1.0")]
public class DarkRepo : BaseUnityPlugin
{
internal static DarkRepo Instance;
private bool buttonHeld;
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
private void Awake()
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID).PatchAll();
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
}
}
[HarmonyPatch(typeof(EnvironmentDirector))]
internal class EnvironmentDirectorPatches
{
internal static float FogColorFactor = 0.2f;
internal static float AmbientColorFactor = 0.2f;
internal static float AmbientColorAdaptationFactor = 0.2f;
[HarmonyPostfix]
[HarmonyPatch("Setup")]
private static void Setup_Postfix(EnvironmentDirector __instance)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
RenderSettings.fogColor *= FogColorFactor;
Camera mainCamera = __instance.MainCamera;
mainCamera.backgroundColor *= FogColorFactor;
}
[HarmonyTranspiler]
[HarmonyPatch("Update")]
private static IEnumerable<CodeInstruction> Update_Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Expected O, but got Unknown
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Expected O, but got Unknown
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Expected O, but got Unknown
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Expected O, but got Unknown
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Expected O, but got Unknown
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Expected O, but got Unknown
MethodInfo methodInfo = AccessTools.Method(typeof(Color), "op_Multiply", new Type[2]
{
typeof(Color),
typeof(float)
}, (Type[])null);
FieldInfo fieldInfo = AccessTools.Field(typeof(Level), "AmbientColor");
FieldInfo fieldInfo2 = AccessTools.Field(typeof(Level), "AmbientColorAdaptation");
FieldInfo fieldInfo3 = AccessTools.Field(typeof(EnvironmentDirectorPatches), "AmbientColorFactor");
FieldInfo fieldInfo4 = AccessTools.Field(typeof(EnvironmentDirectorPatches), "AmbientColorAdaptationFactor");
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
CodeMatch[] array = (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null)
};
val.MatchForward(true, array);
val.ThrowIfInvalid("Could not match ambientColorMatch");
val.Advance(1);
DarkRepo.Logger.LogDebug((object)val.Instruction.opcode);
val.Insert((CodeInstruction[])(object)new CodeInstruction[2]
{
new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo3),
new CodeInstruction(OpCodes.Call, (object)methodInfo)
});
CodeMatch[] array2 = (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo2, (string)null)
};
val.MatchForward(true, array2);
val.ThrowIfInvalid("Could not match ambientColorAdaptationMatch");
val.Advance(1);
DarkRepo.Logger.LogDebug((object)val.Instruction.opcode);
val.Insert((CodeInstruction[])(object)new CodeInstruction[2]
{
new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo4),
new CodeInstruction(OpCodes.Call, (object)methodInfo)
});
return val.InstructionEnumeration();
}
}
[HarmonyPatch(typeof(FlashlightController))]
internal class FlashlightControllerPatches
{
internal static float FlashlightFactor = 2f;
[HarmonyPostfix]
[HarmonyPatch("LightOn")]
private static void LightOn_Prefix(FlashlightController __instance)
{
__instance.baseIntensity *= FlashlightFactor;
}
}
[HarmonyPatch(typeof(LightManager))]
internal class LightManagerPatches
{
internal static float LightFactor = 0.25f;
internal static float EmissiveFactor = 0.75f;
[HarmonyPrefix]
[HarmonyPatch("FadeLightIntensity")]
private static void FadeLightIntensity_Prefix(ref float targetIntensity)
{
targetIntensity *= LightFactor;
}
[HarmonyPrefix]
[HarmonyPatch("FadeEmissionIntensity")]
private static void FadeEmissionIntensity_Prefix(ref Color targetColor)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
targetColor *= EmissiveFactor;
}
}
}