using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.InputSystem;
using UnityEngine.UI;
[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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("BalancePlayerValues")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BalancePlayerValues")]
[assembly: AssemblyTitle("BalancePlayerValues")]
[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 BalancePlayerValues
{
[BepInPlugin("BalancePlayerValues", "BalancePlayerValues", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Patch();
Logger.LogInfo((object)"BalancePlayerValues v1.0.0 has loaded!");
}
internal static void Patch()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("BalancePlayerValues");
}
Logger.LogInfo((object)"Patching...");
Harmony.PatchAll();
Logger.LogInfo((object)"Finished patching!");
}
private void OnDestroy()
{
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "BalancePlayerValues";
public const string PLUGIN_NAME = "BalancePlayerValues";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace BalancePlayerValues.Patches
{
public class SprintButtonClass : LcInputActions
{
public static readonly SprintButtonClass Instance = new SprintButtonClass();
[InputAction("<Keyboard>/f", Name = "Sprinting")]
public InputAction SprintingKey { get; set; }
}
[HarmonyPatch(typeof(StartOfRound))]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class NewPlayerNum
{
private static PlayerControllerB playerControllerB;
private static HUDManager HUDManager;
private static TextMeshProUGUI _BalanceText;
private static bool StartGameBool = false;
private static float SGtime = 0f;
private static bool OrisSprinting = false;
private static int OrPlayerHealth = 200;
private static float OrSprintTime = 22f;
private static float OrsprintMultiplier = 2.55f;
private static float OrsprintMeter = 0.0001f;
private static int AppendHealth = 25;
private static float AppendSprint = 2.75f;
private static float AppendSprintMultiplier = 0.05f;
private static float AppendSprintMeter = 0.0001f;
private static Color OrSprintColor = new Color(1f, 0.463f, 0f);
private static Color OrisSprintColor = new Color(1f, 0f, 0f);
[HarmonyPatch("StartGame")]
[HarmonyPostfix]
private static void StartGames(StartOfRound __instance)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
int connectedPlayersAmount = __instance.connectedPlayersAmount;
SGtime = 0f;
playerControllerB = GameNetworkManager.Instance.localPlayerController;
HUDManager = Object.FindObjectOfType<HUDManager>();
GameObject val = new GameObject("HealthHUDDisplay");
val.AddComponent<RectTransform>();
TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
RectTransform rectTransform = ((TMP_Text)val2).rectTransform;
((Transform)rectTransform).SetParent(((Component)HUDManager.PTTIcon).transform, false);
rectTransform.anchoredPosition = new Vector2(430f, -120f);
((TMP_Text)val2).font = ((TMP_Text)HUDManager.controlTipLines[0]).font;
((TMP_Text)val2).fontSize = 8f;
((TMP_Text)val2).text = "None";
((Graphic)val2).color = new Color(1f, 1f, 1f);
((TMP_Text)val2).overflowMode = (TextOverflowModes)0;
((Behaviour)val2).enabled = true;
_BalanceText = val2;
if (connectedPlayersAmount == 0)
{
AppendHealth = 0;
AppendSprint = 0f;
AppendSprintMultiplier = 0f;
AppendSprintMeter = 0f;
}
if (connectedPlayersAmount < 3)
{
OrPlayerHealth -= AppendHealth * connectedPlayersAmount;
OrSprintTime -= AppendSprint * (float)connectedPlayersAmount;
int orPlayerHealth = OrPlayerHealth;
string text = (OrSprintTime - playerControllerB.sprintTime) / playerControllerB.sprintTime * 100f + "%";
string text2 = (OrsprintMultiplier + AppendSprintMultiplier * (float)connectedPlayersAmount - OrsprintMultiplier) / OrsprintMultiplier * 100f + "%";
string text3 = (OrsprintMeter + AppendSprintMeter * (float)connectedPlayersAmount - OrsprintMeter) / OrsprintMeter * 100f + "%";
playerControllerB.health = OrPlayerHealth;
playerControllerB.sprintTime = OrSprintTime;
OrsprintMultiplier += AppendSprintMultiplier * (float)connectedPlayersAmount;
OrsprintMeter += AppendSprintMeter * (float)connectedPlayersAmount;
Plugin.Logger.LogInfo((object)("OrsprintMultiplier:" + OrsprintMultiplier));
((TMP_Text)_BalanceText).text = "Health: " + orPlayerHealth + "\nSprintTime: " + text + "\nSprintMultiplier: " + text2 + "\nSprintMeter: " + text3;
StartGameBool = true;
}
Plugin.Logger.LogInfo((object)("Health:" + playerControllerB.health));
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void StTGame()
{
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
if (StartGameBool)
{
SGtime += Time.unscaledDeltaTime;
if (SGtime >= 5f)
{
((TMP_Text)_BalanceText).alpha = Mathf.Lerp(((TMP_Text)_BalanceText).alpha, 0f, 7f * Time.deltaTime);
if (((TMP_Text)_BalanceText).alpha <= 0f)
{
((UIBehaviour)_BalanceText).IsDestroyed();
StartGameBool = false;
Plugin.Logger.LogInfo((object)"BalanceText Destroyed");
}
}
}
playerControllerB = GameNetworkManager.Instance.localPlayerController;
if (playerControllerB.isSprinting && SprintButtonClass.Instance.SprintingKey.IsPressed())
{
PlayerControllerB obj = playerControllerB;
obj.sprintMeter -= OrsprintMeter;
playerControllerB.sprintMultiplier = OrsprintMultiplier;
if (((Graphic)playerControllerB.sprintMeterUI).color != OrisSprintColor)
{
((Graphic)playerControllerB.sprintMeterUI).color = OrisSprintColor;
}
OrisSprinting = true;
}
else if (!playerControllerB.isSprinting)
{
if (((Graphic)playerControllerB.sprintMeterUI).color != OrSprintColor)
{
((Graphic)playerControllerB.sprintMeterUI).color = OrSprintColor;
}
OrisSprinting = false;
}
if (OrisSprinting)
{
PlayerControllerB obj2 = playerControllerB;
obj2.sprintMeter -= OrsprintMeter;
if (((Graphic)playerControllerB.sprintMeterUI).color != OrisSprintColor)
{
((Graphic)playerControllerB.sprintMeterUI).color = OrisSprintColor;
}
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}