Decompiled source of LetMeShop v1.1.2

bin/Debug/netstandard2.1/LetMeShop.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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("endersaltz")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LetMeShop")]
[assembly: AssemblyTitle("LetMeShop")]
[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 LetMeShop
{
	[BepInPlugin("endersaltz.LetMeShop", "LetMeShop", "1.0")]
	public class LetMeShop : BaseUnityPlugin
	{
		public static ConfigEntry<float> configRespawnTime;

		internal static LetMeShop Instance { get; private set; }

		internal ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
			configRespawnTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "RespawnTime", 4.5f, "Inputting numbers above 4.5 won't respawn players if all players die at once.");
		}

		private void Update()
		{
			ReviveChecks.Update();
		}
	}
	public class ReviveChecks
	{
		private static Dictionary<string, float> _deathTimers = new Dictionary<string, float>();

		private static Dictionary<string, bool> _deathStates = new Dictionary<string, bool>();

		public static void Update()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.RunIsShop())
			{
				FetchPlayerStates();
				TryReviving();
			}
		}

		private static void FetchPlayerStates()
		{
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				_deathStates.TryAdd(player.steamID, player.playerHealth.health <= 0);
				_deathStates[player.steamID] = player.playerHealth.health <= 0;
			}
		}

		private static void TryReviving()
		{
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				_deathTimers.TryAdd(player.steamID, 0f);
				bool flag = _deathStates[player.steamID];
				if (!flag)
				{
					_deathTimers[player.steamID] = 0f;
				}
				if (flag)
				{
					_deathTimers[player.steamID] += Time.deltaTime;
					float num = _deathTimers[player.steamID];
					if (num > LetMeShop.configRespawnTime.Value)
					{
						player.Revive(false);
						_deathStates[player.steamID] = false;
						_deathTimers[player.steamID] = 0f;
					}
				}
			}
		}
	}
}

obj/Debug/netstandard2.1/LetMeShop.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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("endersaltz")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LetMeShop")]
[assembly: AssemblyTitle("LetMeShop")]
[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 LetMeShop
{
	[BepInPlugin("endersaltz.LetMeShop", "LetMeShop", "1.0")]
	public class LetMeShop : BaseUnityPlugin
	{
		public static ConfigEntry<float> configRespawnTime;

		internal static LetMeShop Instance { get; private set; }

		internal ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
			configRespawnTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "RespawnTime", 4.5f, "Inputting numbers above 4.5 won't respawn players if all players die at once.");
		}

		private void Update()
		{
			ReviveChecks.Update();
		}
	}
	public class ReviveChecks
	{
		private static Dictionary<string, float> _deathTimers = new Dictionary<string, float>();

		private static Dictionary<string, bool> _deathStates = new Dictionary<string, bool>();

		public static void Update()
		{
			if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.RunIsShop())
			{
				FetchPlayerStates();
				TryReviving();
			}
		}

		private static void FetchPlayerStates()
		{
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				_deathStates.TryAdd(player.steamID, player.playerHealth.health <= 0);
				_deathStates[player.steamID] = player.playerHealth.health <= 0;
			}
		}

		private static void TryReviving()
		{
			foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
			{
				_deathTimers.TryAdd(player.steamID, 0f);
				bool flag = _deathStates[player.steamID];
				if (!flag)
				{
					_deathTimers[player.steamID] = 0f;
				}
				if (flag)
				{
					_deathTimers[player.steamID] += Time.deltaTime;
					float num = _deathTimers[player.steamID];
					if (num > LetMeShop.configRespawnTime.Value)
					{
						player.Revive(false);
						_deathStates[player.steamID] = false;
						_deathTimers[player.steamID] = 0f;
					}
				}
			}
		}
	}
}