using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using DeadWarnMod;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyMod.Patches;
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("LethalCompanyMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalCompanyMod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("81dd94d3-8d35-4aa6-b47e-0019cdfce234")]
[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 DeadWarnMod
{
[BepInPlugin("Teteu.DeadWarn", "Dead Warn Mod", "1.0.0.0")]
public class DeadWarnModBase : BaseUnityPlugin
{
private const string modGuid = "Teteu.DeadWarn";
private const string modName = "Dead Warn Mod";
private const string modVersion = "1.0.0.0";
private readonly Harmony Harmony = new Harmony("Teteu.DeadWarn");
public static DeadWarnModBase Instance;
public static ManualLogSource ManualLogSource;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
ManualLogSource = Logger.CreateLogSource("Teteu.DeadWarn");
ManualLogSource.LogWarning((object)"Dead Warn has awaken");
Harmony.PatchAll(typeof(DeadWarnModBase));
Harmony.PatchAll(typeof(StartOfRoundPatch));
Harmony.PatchAll(typeof(PlayerControllerBPatch));
}
}
}
namespace LethalCompanyMod.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyPostfix]
private static void DieOnExausting(ref PlayerControllerB __instance)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
if (StartOfRoundPatch.RedLight && !__instance.isCrouching)
{
__instance.DamagePlayer(1, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
}
}
internal class StartOfRoundPatch
{
private static int Timer = 0;
private static int MaxTimer = 2000;
public static bool RedLight = false;
[HarmonyPatch(typeof(StartOfRound), "Awake")]
[HarmonyPostfix]
private static void OnStartRoundAwake(StartOfRound __instance)
{
Timer = 0;
RedLight = false;
DeadWarnModBase.ManualLogSource.LogDebug((object)"Round was reset");
}
[HarmonyPatch(typeof(StartOfRound), "Update")]
[HarmonyPostfix]
private static void OnStartRoundUpdate(StartOfRound __instance)
{
if (__instance.shipHasLanded && Timer < MaxTimer)
{
Timer++;
}
if (Timer >= MaxTimer)
{
Timer = 0;
RedLight = !RedLight;
HUDManager.Instance.DisplayTip("Atençao", "Teste", false, false, "LC_Tip1");
}
DeadWarnModBase.ManualLogSource.LogDebug((object)("Timer = " + Timer));
DeadWarnModBase.ManualLogSource.LogDebug((object)("Red Light = " + RedLight));
}
}
}