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 HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.BDSayers.TeamLives")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("com.github.BDSayers.TeamLives")]
[assembly: AssemblyTitle("TeamLives")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace TeamLives
{
[BepInPlugin("com.github.BDSayers.TeamLives", "TeamLives", "0.1.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony _harmony = new Harmony("com.github.BDSayers.TeamLives");
public const string Id = "com.github.BDSayers.TeamLives";
internal static ManualLogSource Log { get; private set; }
public static string Name => "TeamLives";
public static string Version => "0.1.0";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
_harmony.PatchAll(Assembly.GetExecutingAssembly());
}
}
}
namespace TeamLives.Script
{
[HarmonyPatch]
internal class LivesTracker
{
public static GameObject teamLives;
public static int currentLives;
public static int playerCount;
public static int basePlayerCount;
[HarmonyPatch(typeof(Character), "Awake")]
[HarmonyPostfix]
private static void increasePlayerCount(Character __instance)
{
if (!__instance.isBot)
{
playerCount++;
}
}
[HarmonyPatch(typeof(Character), "OnDestroy")]
[HarmonyPostfix]
private static void decreasePlayerCount(Character __instance)
{
if (!__instance.isBot)
{
playerCount--;
}
}
[HarmonyPatch(typeof(GUIManager), "SetHeroTitle")]
[HarmonyPostfix]
private static void displayTeamLives()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)teamLives == (Object)null)
{
GameObject val = GameObject.Find("GAME/GUIManager/Canvas_HUD");
currentLives = playerCount;
basePlayerCount = playerCount;
teamLives = new GameObject("Team Lives");
teamLives.transform.SetParent(val.transform, false);
teamLives.AddComponent<TextMeshProUGUI>();
TextMeshProUGUI component = teamLives.GetComponent<TextMeshProUGUI>();
RectTransform component2 = teamLives.GetComponent<RectTransform>();
TMP_Text component3 = teamLives.GetComponent<TMP_Text>();
component2.anchoredPosition = new Vector2(-120f, -70f);
component2.anchorMax = new Vector2(1f, 1f);
component2.anchorMin = new Vector2(1f, 1f);
((TMP_Text)component).text = $"Lives Remaining: {currentLives}";
component3.autoSizeTextContainer = true;
component3.fontSize = 25f;
}
}
[HarmonyPatch(typeof(Character), "RPCA_Die")]
[HarmonyPostfix]
private static void handleCharacterDeath(ref Character __instance)
{
currentLives--;
TextMeshProUGUI component = teamLives.GetComponent<TextMeshProUGUI>();
((TMP_Text)component).text = $"Lives Remaining: {currentLives}";
if (currentLives == 0)
{
__instance.EndGame();
teamLives = null;
}
__instance.RPCA_Revive(true);
}
[HarmonyPatch(typeof(MountainProgressHandler), "TriggerReached")]
[HarmonyPostfix]
public static void resetCurrentLives()
{
currentLives = basePlayerCount;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}