using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using FullBright_byOndyDev.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LCModTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LCModTest")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("26671b60-35c8-48fa-9fce-0887e10771ef")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LCModTest
{
[BepInPlugin("Oreowich.LCModTest", "LC Mod Test", "1.0.0.0")]
public class ModBase : BaseUnityPlugin
{
private const string modGUID = "Oreowich.LCModTest";
private const string modName = "LC Mod Test";
private const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("Oreowich.LCModTest");
private static ModBase Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Oreowich.LCModTest");
mls.LogInfo((object)"The test mod has awaken :");
harmony.PatchAll(typeof(ModBase));
harmony.PatchAll(typeof(PlayerControllerBPatch));
}
}
}
namespace FullBright_byOndyDev.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPatch(typeof(TimeOfDay), "SetBuyingRateForDay")]
public class BuyingRate
{
[HarmonyPostfix]
public static void SetBuyingRate()
{
StartOfRound.Instance.companyBuyingRate = 1f;
}
}
[HarmonyPatch(typeof(TimeOfDay), "UpdateProfitQuotaCurrentTime")]
public class InfiniteDeadline
{
[HarmonyPostfix]
public static void SetInfiniteDeadline()
{
TimeOfDay.Instance.timeUntilDeadline = (int)((double)TimeOfDay.Instance.totalTime * (double)TimeOfDay.Instance.quotaVariables.deadlineDaysAmount);
}
}
[HarmonyPatch(typeof(KnifeItem))]
[HarmonyPatch("HitKnife")]
internal class KnifeItem_HitKnife_Patch
{
[HarmonyPostfix]
private static void Postfix(KnifeItem __instance)
{
FieldInfo field = typeof(KnifeItem).GetField("timeAtLastDamageDealt", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
field.SetValue(__instance, -1f);
}
}
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void texturePatch(ref float ___health, ref Light ___nightVision, KnifeItem __instance, ref float ___carryWeight, ref bool ___criticallyInjured, ref Light ___helmetLight, ref Light[] ___allHelmetLights, ref float ___grabDistance, ref float ___sprintMeter)
{
___criticallyInjured = false;
___grabDistance = 3f;
if (___carryWeight > 1f)
{
___sprintMeter = 0f;
}
else
{
___sprintMeter = 1f;
}
}
[HarmonyPatch(typeof(ShotgunItem), "ItemActivate")]
[HarmonyPostfix]
public static void PatchItemActivate(ShotgunItem __instance)
{
__instance.shellsLoaded = 999;
}
[HarmonyPatch(typeof(ShotgunItem), "ShootGun")]
[HarmonyPostfix]
public static void PatchShootGun(ShotgunItem __instance)
{
__instance.shellsLoaded = 999;
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void keyPress(ref Light ___nightVision, ref Light ___helmetLight)
{
bool flag = ((Component)___nightVision).gameObject.activeSelf;
if (((ButtonControl)Keyboard.current[(Key)20]).wasPressedThisFrame)
{
if (((Component)___nightVision).gameObject.activeSelf)
{
flag = false;
}
if (!((Component)___nightVision).gameObject.activeSelf)
{
flag = true;
}
}
if (!flag)
{
((Component)___nightVision).gameObject.SetActive(false);
}
((Component)___helmetLight).gameObject.SetActive(false);
if (flag)
{
((Component)___nightVision).gameObject.SetActive(true);
((Component)___helmetLight).gameObject.SetActive(true);
}
}
}
}