using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using FancyFlashies.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FancyFlashies")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FancyFlashies")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1352bdd8-e48c-45f3-b62d-b5c225767479")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FancyFlashies
{
[BepInPlugin("Asylud.FancyFlashies", "Fancy Flashies", "1.0.0.0")]
public class FancyFlashiesBase : BaseUnityPlugin
{
private const string modGUID = "Asylud.FancyFlashies";
private const string modName = "Fancy Flashies";
private const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("Asylud.FancyFlashies");
private static FancyFlashiesBase Instance;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
harmony.PatchAll(typeof(FancyFlashiesBase));
harmony.PatchAll(typeof(FancyFlashlightPatch));
harmony.PatchAll(typeof(FancyPlayerControllerBPatch));
}
}
}
namespace FancyFlashies.Patches
{
public static class ColorManager
{
public static Color[] colorOrder = (Color[])(object)new Color[7]
{
new Color(1f, 0f, 0f, 1f),
new Color(1f, 1f, 0f, 1f),
new Color(0f, 1f, 1f, 1f),
new Color(0f, 1f, 0f, 1f),
new Color(0f, 1f, 1f, 1f),
new Color(0f, 0f, 1f, 1f),
new Color(1f, 0f, 1f, 1f)
};
public static int targetColorIndex = 0;
public static void ColorTick(int frame)
{
if (frame % 300 == 0)
{
if (targetColorIndex == colorOrder.Length - 1)
{
targetColorIndex = 0;
}
else
{
targetColorIndex++;
}
}
}
}
[HarmonyPatch(typeof(FlashlightItem))]
public class FancyFlashlightPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
public static void FlashlightColourPatch(FlashlightItem __instance)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
if (Time.frameCount % 3 == 0)
{
__instance.flashlightBulb.color = Color.Lerp(__instance.flashlightBulb.color, ColorManager.colorOrder[ColorManager.targetColorIndex], 0.75f * Time.fixedDeltaTime);
__instance.flashlightBulbGlow.color = Color.Lerp(__instance.flashlightBulbGlow.color, ColorManager.colorOrder[ColorManager.targetColorIndex], 0.75f * Time.fixedDeltaTime);
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
public class FancyPlayerControllerBPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
public static void HelmlightColourPatch(PlayerControllerB __instance)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (Time.frameCount % 3 == 0)
{
__instance.helmetLight.color = Color.Lerp(__instance.helmetLight.color, ColorManager.colorOrder[ColorManager.targetColorIndex], 0.75f * Time.deltaTime);
}
ColorManager.ColorTick(Time.frameCount);
}
}
}