Decompiled source of CheatDeath v1.0.8

CheatDeath.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using ConditionalConfigSync;
using HarmonyLib;
using JetBrains.Annotations;
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: AssemblyTitle("Cheat Death")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Cheat Death")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("af170857-02f8-4a20-9c72-4005b1a677a3")]
[assembly: AssemblyFileVersion("1.0.8")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.8.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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;
		}
	}
}
internal class CustomPrefabs
{
	[HarmonyPatch(typeof(ZNetView), "Awake")]
	public static class ZNetView_Awake_AddPrefab
	{
		[HarmonyPriority(800)]
		private static bool Prefix()
		{
			return !prefabInit;
		}
	}

	[HarmonyPatch(typeof(ZSyncTransform), "Awake")]
	public static class ZSyncTransform_Awake_AddPrefab
	{
		[HarmonyPriority(800)]
		private static bool Prefix()
		{
			return !prefabInit;
		}
	}

	[HarmonyPatch(typeof(ZSyncTransform), "OnEnable")]
	public static class ZSyncTransform_OnEnable_AddPrefab
	{
		[HarmonyPriority(800)]
		private static bool Prefix()
		{
			return !prefabInit;
		}
	}

	[HarmonyPatch(typeof(ItemDrop), "Awake")]
	public static class ItemDrop_Awake_AddPrefab
	{
		[HarmonyPriority(800)]
		private static bool Prefix()
		{
			return !prefabInit;
		}
	}

	[HarmonyPatch(typeof(ItemDrop), "Start")]
	public static class ItemDrop_Start_AddPrefab
	{
		[HarmonyPriority(800)]
		private static bool Prefix()
		{
			return !prefabInit;
		}
	}

	[HarmonyPatch(typeof(Piece), "Awake")]
	public static class Piece_Awake_AddPrefab
	{
		[HarmonyPriority(800)]
		private static bool Prefix()
		{
			return !prefabInit;
		}
	}

	[HarmonyPatch(typeof(WearNTear), "Awake")]
	public static class WearNTear_Awake_AddPrefab
	{
		[HarmonyPriority(800)]
		private static bool Prefix()
		{
			return !prefabInit;
		}
	}

	[HarmonyPatch(typeof(WearNTear), "Start")]
	public static class WearNTear_Start_AddPrefab
	{
		[HarmonyPriority(800)]
		private static bool Prefix()
		{
			return !prefabInit;
		}
	}

	[HarmonyPatch(typeof(GuidePoint), "Start")]
	public static class GuidePoint_Start_AddPrefab
	{
		[HarmonyPriority(800)]
		private static bool Prefix()
		{
			return !prefabInit;
		}
	}

	[HarmonyPatch(typeof(TimedDestruction), "Awake")]
	public static class TimedDestruction_Awake_AddPrefab
	{
		[HarmonyPriority(800)]
		private static bool Prefix()
		{
			return !prefabInit;
		}
	}

	private const string c_rootObjectName = "_shudnalRoot";

	private const string c_rootPrefabsName = "Prefabs";

	private static GameObject rootObject;

	private static GameObject rootPrefabs;

	public static bool prefabInit;

	private static void InitRootObject()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Expected O, but got Unknown
		if ((Object)(object)rootObject == (Object)null)
		{
			rootObject = (GameObject)(((object)GameObject.Find("_shudnalRoot")) ?? ((object)new GameObject("_shudnalRoot")));
		}
		Object.DontDestroyOnLoad((Object)(object)rootObject);
		if ((Object)(object)rootPrefabs == (Object)null)
		{
			Transform obj = rootObject.transform.Find("Prefabs");
			rootPrefabs = ((obj != null) ? ((Component)obj).gameObject : null);
			if ((Object)(object)rootPrefabs == (Object)null)
			{
				rootPrefabs = new GameObject("Prefabs");
				rootPrefabs.transform.SetParent(rootObject.transform, false);
				rootPrefabs.SetActive(false);
			}
		}
	}

	internal static GameObject InitPrefabClone(GameObject prefabToClone, string prefabName)
	{
		InitRootObject();
		if ((Object)(object)rootPrefabs.transform.Find(prefabName) != (Object)null)
		{
			return ((Component)rootPrefabs.transform.Find(prefabName)).gameObject;
		}
		prefabInit = true;
		GameObject val = Object.Instantiate<GameObject>(prefabToClone, rootPrefabs.transform, false);
		prefabInit = false;
		((Object)val).name = prefabName;
		return val;
	}

	internal static Component AddComponent(GameObject gameObject, Type type)
	{
		prefabInit = true;
		Component result = gameObject.AddComponent(type);
		prefabInit = false;
		return result;
	}
}
namespace CheatDeath
{
	[BepInPlugin("shudnal.CheatDeath", "Cheat Death", "1.0.8")]
	[BepInDependency("_shudnal.ConditionalConfigSync", "1.0.5")]
	public class CheatDeath : BaseUnityPlugin
	{
		public enum CooldownTime
		{
			WorldTime,
			GlobalTime
		}

		public enum HealthThreshold
		{
			Percent,
			HealthPoints
		}

		[HarmonyPatch(typeof(Character), "SetHealth")]
		public static class Character_SetHealth_CheatDeathActivation
		{
			[HarmonyPriority(800)]
			public static void Prefix(Character __instance, ref float health)
			{
				if (modEnabled.Value && __instance.IsPlayer() && Object.op_Implicit((Object)(object)Player.m_localPlayer) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && !(health > 0.1f) && !(__instance.GetHealthPercentage() < procHealthThreshold.Value))
				{
					bool flag = false;
					if (__instance.GetSEMan().GetStatusEffect(SE_CheatDeath.statusEffectHash) is SE_CheatDeath sE_CheatDeath && (flag = sE_CheatDeath.m_freeProc))
					{
						health = sE_CheatDeath.GetCharacterHealth();
					}
					if (__instance.GetSEMan().AddStatusEffect(SE_CheatDeath.statusEffectHash, flag, 0, 0f, (short)(-1)) is SE_CheatDeath sE_CheatDeath2)
					{
						health = sE_CheatDeath2.GetCharacterHealth();
					}
				}
			}
		}

		[HarmonyPatch(typeof(Player), "Save")]
		public static class Player_Save_SaveCheatDeathCooldown
		{
			private static void Prefix(Player __instance)
			{
				if (modEnabled.Value && Object.op_Implicit((Object)(object)Player.m_localPlayer) && !((Object)(object)Player.m_localPlayer != (Object)(object)__instance))
				{
					StatusEffect statusEffect = ((Character)__instance).m_seman.GetStatusEffect(SE_CheatDeath.statusEffectHash);
					if (!((Object)(object)statusEffect == (Object)null))
					{
						CooldownData.SetCooldown(statusEffect.m_ttl - statusEffect.m_time);
					}
				}
			}
		}

		[HarmonyPatch(typeof(Player), "Load")]
		public static class Player_Load_LoadCheatDeathCooldown
		{
			private static void Postfix(Player __instance)
			{
				if (modEnabled.Value && Object.op_Implicit((Object)(object)Player.m_localPlayer) && !((Object)(object)Player.m_localPlayer != (Object)(object)__instance) && CooldownData.IsOnCooldown())
				{
					StatusEffect statusEffect = ((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(SE_CheatDeath.statusEffectHash, false, 0, 0f, (short)(-1));
					UpdateStatusEffectTime(statusEffect);
				}
			}
		}

		[HarmonyPatch(typeof(Player), "OnSpawned")]
		public static class Player_OnSpawned_LoadCheatDeathCooldown
		{
			private static void Postfix(Player __instance)
			{
				if (modEnabled.Value && Object.op_Implicit((Object)(object)Player.m_localPlayer) && !((Object)(object)Player.m_localPlayer != (Object)(object)__instance) && CooldownData.IsOnCooldown())
				{
					StatusEffect statusEffect = ((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(SE_CheatDeath.statusEffectHash, false, 0, 0f, (short)(-1));
					UpdateStatusEffectTime(statusEffect);
				}
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static ConsoleEvent <>9__48_0;

			internal void <InitCommands>b__48_0(ConsoleEventArgs args)
			{
				CooldownData.SetCooldown(args.TryParameterInt(1, 0));
				if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(SE_CheatDeath.statusEffectHash))
				{
					UpdateStatusEffectTime(((Character)Player.m_localPlayer).GetSEMan().GetStatusEffect(SE_CheatDeath.statusEffectHash));
				}
			}
		}

		public const string pluginID = "shudnal.CheatDeath";

		public const string pluginName = "Cheat Death";

		public const string pluginVersion = "1.0.8";

		private readonly Harmony harmony = new Harmony("shudnal.CheatDeath");

		internal static readonly ConfigSync configSync = new ConfigSync("shudnal.CheatDeath")
		{
			DisplayName = "Cheat Death",
			CurrentVersion = "1.0.8",
			MinimumRequiredVersion = "1.0.8"
		};

		internal static CheatDeath instance;

		public static ConfigEntry<bool> modEnabled;

		internal static ConfigEntry<bool> configLocked;

		internal static ConfigEntry<bool> loggingEnabled;

		internal static ConfigEntry<CooldownTime> cooldownTime;

		internal static ConfigEntry<int> cooldown;

		internal static ConfigEntry<float> protectionSeconds;

		internal static ConfigEntry<string> statusEffectLocalization;

		internal static ConfigEntry<bool> cleanseOnProc;

		internal static ConfigEntry<string> statusEffectStartMessageServer;

		internal static ConfigEntry<string> statusEffectStartMessageClient;

		internal static ConfigEntry<float> chanceForReproc;

		internal static ConfigEntry<string> reprocMessage;

		internal static ConfigEntry<string> vfxOverride;

		internal static ConfigEntry<float> procHealthThreshold;

		internal static ConfigEntry<bool> healToThreshold;

		internal static ConfigEntry<float> healthThresholdPercent;

		internal static ConfigEntry<float> healthThresholdValue;

		internal static ConfigEntry<HealthThreshold> healthThreshold;

		internal static ConfigEntry<DamageModifier> protectionModifier;

		internal static ConfigEntry<DamageType> protectionDamageType;

		internal static ConfigEntry<float> staminaModifier;

		internal static ConfigEntry<float> healthOverTime;

		internal static ConfigEntry<float> healthPerSecond;

		internal static ConfigEntry<float> addMaxCarryWeight;

		internal static ConfigEntry<float> maxMaxFallSpeed;

		internal static ConfigEntry<float> fallDamageModifier;

		internal static ConfigEntry<bool> postProtectionEnabled;

		internal static ConfigEntry<float> postProtectionLength;

		internal static ConfigEntry<DamageModifier> postProtectionProtectionModifier;

		internal static ConfigEntry<DamageType> postProtectionProtectionDamageType;

		internal static ConfigEntry<float> postProtectionStaminaModifier;

		internal static ConfigEntry<float> postProtectionHealthPerSecond;

		internal static ConfigEntry<float> postProtectionAddMaxCarryWeight;

		internal static ConfigEntry<float> postProtectionMaxFallSpeed;

		internal static ConfigEntry<float> postProtectionFallDamageModifier;

		internal static ConfigEntry<string> postProtectionStatusEffect;

		private void Awake()
		{
			harmony.PatchAll();
			instance = this;
			ConfigInit();
			((ConditionalConfigSync)configSync).AddLockingConfigEntry<bool>(configLocked);
			Game.isModded = true;
			LoadIcons();
			CustomConfigs.Awake();
		}

		public void ConfigInit()
		{
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Expected O, but got Unknown
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Expected O, but got Unknown
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Expected O, but got Unknown
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Expected O, but got Unknown
			modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable the mod.");
			((ConditionalConfigSync)configSync).AddConfigEntry<bool>(modEnabled, (ConfigSyncMode)2, false);
			configLocked = config("General", "Lock Configuration", defaultValue: true, "Configuration is locked and can be changed by server admins only.");
			loggingEnabled = config("General", "Logging enabled", defaultValue: false, "Enable logging. [Not Synced with Server]", synchronizedSetting: false);
			cooldownTime = config("Status effect - Cooldown", "Time", CooldownTime.WorldTime, "Time type to calculate cooldown between game sessions.\nWorld time - calculate from time passed in game world\nGlobal time - calculate from real world time");
			cooldown = config("Status effect - Cooldown", "Cooldown", 600, "Cooldown to be set after proc");
			cooldown.SettingChanged += UpdateConfigurableValues;
			protectionSeconds = config("Status effect - General", "Protection seconds", 10f, "Seconds of protection after activation");
			statusEffectLocalization = config("Status effect - General", "Name", "Cheat death", "Name of status effect");
			cleanseOnProc = config("Status effect - General", "Cleanse of DoT on proc", defaultValue: true, "Remove DoT effects on proc");
			statusEffectStartMessageServer = config("Status effect - General", "Message on proc synced", "$tutorial_death_topic&&YOU DIED!.. But not yet.", new ConfigDescription("&& separated messages showing on effect proc which is synced from server", (AcceptableValueBase)null, new object[1]
			{
				new CustomConfigs.ConfigurationManagerAttributes
				{
					CustomDrawer = CustomConfigs.DrawSeparatedStrings("&&")
				}
			}));
			statusEffectStartMessageClient = config("Status effect - General", "Message on proc local", "Did it hurt? I guess so...", new ConfigDescription("&& separated messages showing on effect proc [Not Synced with Server]", (AcceptableValueBase)null, new object[1]
			{
				new CustomConfigs.ConfigurationManagerAttributes
				{
					CustomDrawer = CustomConfigs.DrawSeparatedStrings("&&")
				}
			}), synchronizedSetting: false);
			chanceForReproc = config("Status effect - General", "Change for free proc", 0.05f, new ConfigDescription("Chance for status effect to not going on cooldown on proc. Effect can also proc again while current effect is active.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), new object[1]
			{
				new CustomConfigs.ConfigurationManagerAttributes
				{
					ShowRangeAsPercent = true
				}
			}));
			reprocMessage = config("Status effect - General", "Message on free proc", "$msg_softdeath", new ConfigDescription("&& separated messages showing on effect reproc", (AcceptableValueBase)null, new object[1]
			{
				new CustomConfigs.ConfigurationManagerAttributes
				{
					CustomDrawer = CustomConfigs.DrawSeparatedStrings("&&")
				}
			}));
			vfxOverride = config("Status effect - General", "Visual effect prefab override", "", "Name of visual effect prefab available via ZNetScene.instance.GetPrefab to use instead of default cheat death effect.");
			procHealthThreshold = config("Status effect - General", "Proc health threshold", 0f, new ConfigDescription("Cheat Death will only proc if your current health is above the set percentage.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), new object[1]
			{
				new CustomConfigs.ConfigurationManagerAttributes
				{
					ShowRangeAsPercent = true
				}
			}));
			protectionSeconds.SettingChanged += UpdateConfigurableValues;
			statusEffectLocalization.SettingChanged += UpdateConfigurableValues;
			healthThresholdPercent = config("Status effect - Health threshold", "Health threshold in percents", 5f, new ConfigDescription("Percent of hp left on proc.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>()));
			healthThresholdValue = config("Status effect - Health threshold", "Health threshold in health points", 10f, "Health points left on proc.");
			healthThreshold = config("Status effect - Health threshold", "Health threshold", HealthThreshold.Percent, "What value to use, percentage or fixed amount.");
			healToThreshold = config("Status effect - Health threshold", "Heal to health threshold", defaultValue: true, "If damage taken while current hp is less then threshold hp will be instantly restored to threshold value.\nIf disabled then if you had more hp than threshold hp will be reduced to threshold\nand if you had less hp then threshold your HP will remain the same.");
			protectionModifier = config<DamageModifier>("Status effect - Protection", "Damage modifier", (DamageModifier)1, "Resistant = -50% VeryResistant = -75%\nWeak = +50% VeryWeak = +100%");
			protectionDamageType = config<DamageType>("Status effect - Protection", "Damage types", (DamageType)999, "Set type of damage to be protected from");
			fallDamageModifier = config("Status effect - Protection", "Fall damage protection", -0.75f, "Multiplier of fall damage");
			maxMaxFallSpeed = config("Status effect - Protection", "Max fall speed", 6f, "Slow Fall given by Feather Cape is 5.");
			staminaModifier = config("Status effect - Protection", "Movement stamina modifier", -0.75f, "Multiplier of jump and run stamina drain");
			healthOverTime = config("Status effect - Protection", "Health over time", 25f, "Amount of health to be healed in protection duration");
			healthPerSecond = config("Status effect - Protection", "Health per second", 5f, "Health per second while protection is active");
			addMaxCarryWeight = config("Status effect - Protection", "Add max carry weight", 50f, "Amount of max carry weight added while protection is active");
			protectionModifier.SettingChanged += UpdateConfigurableValues;
			protectionDamageType.SettingChanged += UpdateConfigurableValues;
			fallDamageModifier.SettingChanged += UpdateConfigurableValues;
			maxMaxFallSpeed.SettingChanged += UpdateConfigurableValues;
			staminaModifier.SettingChanged += UpdateConfigurableValues;
			healthOverTime.SettingChanged += UpdateConfigurableValues;
			healthPerSecond.SettingChanged += UpdateConfigurableValues;
			addMaxCarryWeight.SettingChanged += UpdateConfigurableValues;
			postProtectionProtectionModifier = config<DamageModifier>("Status effect - Post protection", "Damage modifier", (DamageModifier)0, "Resistant = -50% VeryResistant = -75%\nWeak = +50% VeryWeak = +100%");
			postProtectionProtectionDamageType = config<DamageType>("Status effect - Post protection", "Damage types", (DamageType)0, "Set type of damage");
			postProtectionFallDamageModifier = config("Status effect - Post protection", "Fall damage protection", -0.25f, "Multiplier of fall damage");
			postProtectionMaxFallSpeed = config("Status effect - Post protection", "Max fall speed", 7f, "Slow Fall given by Feather Cape is 5.");
			postProtectionStaminaModifier = config("Status effect - Post protection", "Movement stamina modifier", -0.25f, "Multiplier of jump and run stamina drain");
			postProtectionHealthPerSecond = config("Status effect - Post protection", "Health per second", 2f, "Health per second while post protection is active");
			postProtectionAddMaxCarryWeight = config("Status effect - Post protection", "Add max carry weight", 25f, "Amount of max carry weight added while post protection is active");
			postProtectionLength = config("Status effect - Post protection", "Length", 60f, "Time after main effect end when post protection should be active");
			postProtectionEnabled = config("Status effect - Post protection", "Enabled", defaultValue: true, "Enable post protection period after main effect is ended");
			postProtectionStatusEffect = config("Status effect - Post protection", "Status effect to inflict", "", "What status effect should be inflicted when protection is over.");
			postProtectionProtectionModifier.SettingChanged += UpdateConfigurableValues;
			postProtectionProtectionDamageType.SettingChanged += UpdateConfigurableValues;
			postProtectionFallDamageModifier.SettingChanged += UpdateConfigurableValues;
			postProtectionMaxFallSpeed.SettingChanged += UpdateConfigurableValues;
			postProtectionStaminaModifier.SettingChanged += UpdateConfigurableValues;
			postProtectionHealthPerSecond.SettingChanged += UpdateConfigurableValues;
			postProtectionAddMaxCarryWeight.SettingChanged += UpdateConfigurableValues;
			postProtectionLength.SettingChanged += UpdateConfigurableValues;
			postProtectionEnabled.SettingChanged += UpdateConfigurableValues;
			InitCommands();
		}

		private void UpdateConfigurableValues(object sender, EventArgs args)
		{
			SE_CheatDeath.UpdateConfigurableValues();
		}

		private void OnDestroy()
		{
			((BaseUnityPlugin)this).Config.Save();
			instance = null;
			Harmony obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
		}

		public static void InitCommands()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			object obj = <>c.<>9__48_0;
			if (obj == null)
			{
				ConsoleEvent val = delegate(ConsoleEventArgs args)
				{
					CooldownData.SetCooldown(args.TryParameterInt(1, 0));
					if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(SE_CheatDeath.statusEffectHash))
					{
						UpdateStatusEffectTime(((Character)Player.m_localPlayer).GetSEMan().GetStatusEffect(SE_CheatDeath.statusEffectHash));
					}
				};
				<>c.<>9__48_0 = val;
				obj = (object)val;
			}
			new ConsoleCommand("setcheatdeathcooldown", "seconds", (ConsoleEvent)obj, true, false, false, false, false, true, (ConsoleOptionsFetcher)null, false, false, false);
		}

		private void LoadIcons()
		{
			LoadIcon("CheatDeath.png", ref SE_CheatDeath.iconStatusEffect);
		}

		internal static void LoadIcon(string filename, ref Sprite icon)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			Texture2D tex = new Texture2D(2, 2);
			if (LoadTexture(filename, ref tex))
			{
				icon = Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), Vector2.zero);
			}
		}

		internal static bool LoadTexture(string filename, ref Texture2D tex)
		{
			string text = Path.Combine(Paths.PluginPath, filename);
			if (File.Exists(text))
			{
				LogInfo("Loaded image: " + text);
				return ImageConversion.LoadImage(tex, File.ReadAllBytes(text));
			}
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(filename));
			Stream manifestResourceStream = executingAssembly.GetManifestResourceStream(name);
			byte[] array = new byte[manifestResourceStream.Length];
			manifestResourceStream.Read(array, 0, array.Length);
			((Object)tex).name = Path.GetFileNameWithoutExtension(filename);
			return ImageConversion.LoadImage(tex, array, true);
		}

		public static void LogInfo(object data)
		{
			if (loggingEnabled.Value)
			{
				((BaseUnityPlugin)instance).Logger.LogInfo(data);
			}
		}

		private ConfigEntry<T> config<T>(string group, string name, T defaultValue, ConfigDescription description, bool synchronizedSetting = true)
		{
			ConfigEntry<T> val = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, defaultValue, description);
			((ConditionalConfigSync)configSync).AddConfigEntry<T>(val, (ConfigSyncMode)1, synchronizedSetting);
			return val;
		}

		private ConfigEntry<T> config<T>(string group, string name, T defaultValue, string description, bool synchronizedSetting = true)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			return config(group, name, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		private static void UpdateStatusEffectTime(StatusEffect statusEffect)
		{
			if (!((Object)(object)statusEffect == (Object)null))
			{
				statusEffect.m_time = Mathf.Max(0f, statusEffect.m_ttl - (float)CooldownData.GetCooldown());
				(statusEffect as SE_CheatDeath).m_initialized = true;
			}
		}
	}
	internal class CooldownData
	{
		public long worldUID;

		public string globalTime;

		public double worldTime;

		public const string customDataKey = "CheatDeath";

		private double GetCooldownTime()
		{
			if (!Object.op_Implicit((Object)(object)ZNet.instance))
			{
				return 0.0;
			}
			if (CheatDeath.cooldownTime.Value == CheatDeath.CooldownTime.WorldTime)
			{
				return (worldTime == 0.0) ? 0.0 : Math.Max(worldTime - ZNet.instance.GetTimeSeconds(), 0.0);
			}
			if (DateTime.TryParse(globalTime, CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
			{
				return Math.Max((result - GetTime()).TotalSeconds, 0.0);
			}
			return 0.0;
		}

		private void SetCooldownTime(double cooldown)
		{
			if (CheatDeath.cooldownTime.Value == CheatDeath.CooldownTime.GlobalTime)
			{
				globalTime = GetTime().AddSeconds(cooldown).ToString(CultureInfo.InvariantCulture);
			}
			else
			{
				worldTime = ZNet.instance.GetTimeSeconds() + cooldown;
			}
		}

		private static DateTime GetTime()
		{
			return DateTime.Now.ToUniversalTime();
		}

		internal static CooldownData GetCooldownData(List<CooldownData> state, bool createIfEmpty = false)
		{
			long uid = ZNet.instance.GetWorldUID();
			CooldownData cooldownData = state.Find((CooldownData d) => d.worldUID == uid);
			if (createIfEmpty && cooldownData == null)
			{
				cooldownData = new CooldownData
				{
					worldUID = uid
				};
				state.Add(cooldownData);
			}
			return cooldownData;
		}

		public static double GetCooldown()
		{
			if (!Object.op_Implicit((Object)(object)ZNet.instance))
			{
				return 0.0;
			}
			return GetCooldownData(GetState())?.GetCooldownTime() ?? 0.0;
		}

		public static void SetCooldown(double cooldown)
		{
			if (Object.op_Implicit((Object)(object)ZNet.instance))
			{
				List<CooldownData> state = GetState();
				GetCooldownData(state, createIfEmpty: true).SetCooldownTime(cooldown);
				Player.m_localPlayer.m_customData["CheatDeath"] = SaveCooldownDataList(state);
				CheatDeath.LogInfo("Cooldown set " + TimerString(cooldown));
			}
		}

		internal static bool IsOnCooldown()
		{
			return GetCooldown() > 0.0;
		}

		public static string TimerString(double seconds)
		{
			if (seconds < 60.0)
			{
				return DateTime.FromBinary(599266080000000000L).AddSeconds(seconds).ToString("ss\\s");
			}
			TimeSpan timeSpan = TimeSpan.FromSeconds(seconds);
			if (timeSpan.Hours > 0)
			{
				return string.Format("{0}{1}", (int)timeSpan.TotalHours, new DateTime(timeSpan.Ticks).ToString("\\h mm\\m"));
			}
			if (timeSpan.Seconds == 0)
			{
				return new DateTime(timeSpan.Ticks).ToString("mm\\m");
			}
			return new DateTime(timeSpan.Ticks).ToString("mm\\m ss\\s");
		}

		private static List<CooldownData> GetState()
		{
			string value;
			return Player.m_localPlayer.m_customData.TryGetValue("CheatDeath", out value) ? GetCooldownDataList(value) : new List<CooldownData>();
		}

		private static List<CooldownData> GetCooldownDataList(string value)
		{
			List<CooldownData> data = new List<CooldownData>();
			CollectionExtensions.Do<string>(SplitToLines(value), (Action<string>)delegate(string line)
			{
				data.Add(JsonUtility.FromJson<CooldownData>(line));
			});
			return data;
		}

		private static string SaveCooldownDataList(List<CooldownData> list)
		{
			StringBuilder sb = new StringBuilder();
			CollectionExtensions.Do<CooldownData>((IEnumerable<CooldownData>)list, (Action<CooldownData>)delegate(CooldownData data)
			{
				sb.AppendLine(JsonUtility.ToJson((object)data));
			});
			return sb.ToString();
		}

		private static IEnumerable<string> SplitToLines(string input)
		{
			if (input == null)
			{
				yield break;
			}
			using StringReader reader = new StringReader(input);
			while (true)
			{
				string text;
				string line = (text = reader.ReadLine());
				if (text == null)
				{
					break;
				}
				yield return line;
			}
		}
	}
	internal class CustomConfigs
	{
		internal class ConfigurationManagerAttributes
		{
			[UsedImplicitly]
			public Action<ConfigEntryBase>? CustomDrawer;

			public bool? ShowRangeAsPercent;
		}

		internal static object? configManager;

		internal static Type? configManagerStyles;

		internal static GUIStyle GetStyle(GUIStyle other)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			if (configManagerStyles == null)
			{
				return other;
			}
			FieldInfo fieldInfo = AccessTools.Field(configManagerStyles, "fontSize");
			if (fieldInfo == null)
			{
				return other;
			}
			return new GUIStyle(other)
			{
				fontSize = (int)fieldInfo.GetValue(configManagerStyles)
			};
		}

		internal static void Awake()
		{
			Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ConfigurationManager");
			Type type = assembly?.GetType("ConfigurationManager.ConfigurationManager");
			configManager = ((type == null) ? null : Chainloader.ManagerObject.GetComponent(type));
			configManagerStyles = assembly?.GetType("ConfigurationManager.ConfigurationManagerStyles");
		}

		internal static Action<ConfigEntryBase> DrawSeparatedStrings(string splitString)
		{
			return delegate(ConfigEntryBase cfg)
			{
				//IL_010a: Unknown result type (might be due to invalid IL or missing references)
				//IL_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: Expected O, but got Unknown
				//IL_0155: Unknown result type (might be due to invalid IL or missing references)
				//IL_015a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0170: Expected O, but got Unknown
				bool valueOrDefault = cfg.Description.Tags.Select((object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : ((bool?)null)).FirstOrDefault((bool? v) => v.HasValue) == true;
				bool flag = false;
				GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
				List<string> list = new List<string>();
				List<string> list2 = ((string)cfg.BoxedValue).Split(new string[1] { splitString }, StringSplitOptions.None).ToList();
				for (int num = 0; num < list2.Count; num++)
				{
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					string text = list2[num];
					string text2 = GUILayout.TextField(text, GetStyle(GUI.skin.textArea), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
					if (text2 != text && !valueOrDefault)
					{
						flag = true;
					}
					if (GUILayout.Button("x", new GUIStyle(GetStyle(GUI.skin.button))
					{
						fixedWidth = 21f
					}, Array.Empty<GUILayoutOption>()) && !valueOrDefault)
					{
						flag = true;
					}
					else
					{
						list.Add(text2);
					}
					if (GUILayout.Button("+", new GUIStyle(GetStyle(GUI.skin.button))
					{
						fixedWidth = 21f
					}, Array.Empty<GUILayoutOption>()) && !valueOrDefault)
					{
						flag = true;
						list.Add("");
					}
					GUILayout.EndHorizontal();
				}
				GUILayout.EndVertical();
				if (flag)
				{
					cfg.BoxedValue = string.Join(splitString, list);
				}
			};
		}
	}
	internal class SE_CheatDeath : SE_Stats
	{
		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		public static class ObjectDB_Awake_AddStatusEffects
		{
			public static void AddCustomStatusEffects(ObjectDB odb)
			{
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ee: Expected O, but got Unknown
				RegisterEffects();
				if (odb != null && odb.m_StatusEffects.Count > 0 && !odb.m_StatusEffects.Any((StatusEffect se) => ((se != null) ? new int?(se.NameHash()) : ((int?)null)) == statusEffectHash))
				{
					SE_CheatDeath sE_CheatDeath = ScriptableObject.CreateInstance<SE_CheatDeath>();
					((Object)sE_CheatDeath).name = "CheatDeath";
					((StatusEffect)sE_CheatDeath).m_nameHash = statusEffectHash;
					((StatusEffect)sE_CheatDeath).m_icon = iconStatusEffect;
					((StatusEffect)sE_CheatDeath).m_tooltip = "$tutorial_death_topic";
					((StatusEffect)sE_CheatDeath).m_startMessageType = (MessageType)2;
					((StatusEffect)sE_CheatDeath).m_startMessage = "$tutorial_death_topic";
					if (Object.op_Implicit((Object)(object)vfx_CheatDeath))
					{
						((StatusEffect)sE_CheatDeath).m_startEffects.m_effectPrefabs = CollectionExtensions.AddToArray<EffectData>(((StatusEffect)sE_CheatDeath).m_startEffects.m_effectPrefabs, new EffectData
						{
							m_prefab = vfx_CheatDeath,
							m_enabled = true,
							m_variant = -1,
							m_attach = true,
							m_scale = true
						});
					}
					SetStatusEffectProperties(sE_CheatDeath);
					odb.m_StatusEffects.Add((StatusEffect)(object)sE_CheatDeath);
				}
			}

			private static void Postfix(ObjectDB __instance)
			{
				AddCustomStatusEffects(__instance);
			}
		}

		[HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")]
		public static class ObjectDB_CopyOtherDB_AddStatusEffects
		{
			private static void Postfix(ObjectDB __instance)
			{
				ObjectDB_Awake_AddStatusEffects.AddCustomStatusEffects(__instance);
			}
		}

		public const string statusEffectName = "CheatDeath";

		public static readonly int statusEffectHash = StringExtensionMethods.GetStableHashCode("CheatDeath");

		public const string vfx_CheatDeathName = "vfx_CheatDeath";

		public static readonly int vfx_CheatDeathHash = StringExtensionMethods.GetStableHashCode("vfx_CheatDeath");

		public static Sprite iconStatusEffect;

		public static GameObject vfx_CheatDeath;

		private static readonly List<DamageModPair> s_noDamageModifiers = new List<DamageModPair>();

		public static List<DamageModPair> m_modsActive = new List<DamageModPair>();

		public static List<DamageModPair> m_modsPostProtection = new List<DamageModPair>();

		[NonSerialized]
		public bool m_freeProc = false;

		[NonSerialized]
		public bool m_initialized = false;

		public void RollFreeProc()
		{
			m_freeProc = Random.Range(0f, 1f) <= CheatDeath.chanceForReproc.Value;
		}

		public override void ResetTime()
		{
			((SE_Stats)this).ResetTime();
			RollFreeProc();
			MessageCharacter();
			((StatusEffect)this).TriggerStartEffects();
		}

		public override void UpdateStatusEffect(float dt)
		{
			if (!CheatDeath.modEnabled.Value)
			{
				((StatusEffect)this).Stop();
			}
			((SE_Stats)this).UpdateStatusEffect(dt);
			if (((StatusEffect)this).m_cooldownIcon != (((StatusEffect)this).m_cooldownIcon = ((StatusEffect)this).m_time > CheatDeath.protectionSeconds.Value) && ((StatusEffect)this).m_cooldownIcon)
			{
				if (m_freeProc)
				{
					CooldownData.SetCooldown(((StatusEffect)this).m_ttl - (((StatusEffect)this).m_time = ((StatusEffect)this).m_ttl));
				}
				if (!string.IsNullOrWhiteSpace(CheatDeath.postProtectionStatusEffect.Value))
				{
					Character character = ((StatusEffect)this).m_character;
					if (character != null)
					{
						character.GetSEMan().AddStatusEffect(StringExtensionMethods.GetStableHashCode(CheatDeath.postProtectionStatusEffect.Value), false, 0, 0f, (short)(-1));
					}
				}
			}
			((StatusEffect)this).m_flashIcon = !((StatusEffect)this).m_cooldownIcon;
			if (((StatusEffect)this).m_cooldownIcon)
			{
				if (CheatDeath.postProtectionEnabled.Value && ((StatusEffect)this).m_time < CheatDeath.postProtectionLength.Value + CheatDeath.protectionSeconds.Value)
				{
					base.m_runStaminaDrainModifier = CheatDeath.postProtectionStaminaModifier.Value;
					base.m_jumpStaminaUseModifier = CheatDeath.postProtectionStaminaModifier.Value;
					base.m_fallDamageModifier = CheatDeath.postProtectionFallDamageModifier.Value;
					base.m_maxMaxFallSpeed = CheatDeath.postProtectionMaxFallSpeed.Value;
					base.m_healthPerTick = CheatDeath.postProtectionHealthPerSecond.Value;
					base.m_addMaxCarryWeight = CheatDeath.postProtectionAddMaxCarryWeight.Value;
					base.m_mods = m_modsPostProtection;
				}
				else
				{
					base.m_runStaminaDrainModifier = 0f;
					base.m_jumpStaminaUseModifier = 0f;
					base.m_fallDamageModifier = 0f;
					base.m_maxMaxFallSpeed = 0f;
					base.m_healthOverTime = 0f;
					base.m_healthPerTick = 0f;
					base.m_addMaxCarryWeight = 0f;
					base.m_mods = s_noDamageModifiers;
				}
			}
			if (m_initialized || !((Object)(object)((StatusEffect)this).m_character != (Object)null))
			{
				return;
			}
			m_initialized = true;
			if (CheatDeath.cleanseOnProc.Value)
			{
				List<StatusEffect> list = new List<StatusEffect>();
				foreach (StatusEffect statusEffect in ((StatusEffect)this).m_character.GetSEMan().GetStatusEffects())
				{
					if (statusEffect is SE_Burning || statusEffect is SE_Poison || statusEffect is SE_Puke)
					{
						list.Add(statusEffect);
					}
				}
				foreach (StatusEffect item in list)
				{
					((StatusEffect)this).m_character.GetSEMan().RemoveStatusEffect(item, false);
				}
			}
			if ((Object)(object)((StatusEffect)this).m_character != (Object)null && (Object)(object)((StatusEffect)this).m_character == (Object)(object)Player.m_localPlayer)
			{
				if (CooldownData.IsOnCooldown())
				{
					((StatusEffect)this).m_time = Mathf.Max(0f, ((StatusEffect)this).m_ttl - (float)CooldownData.GetCooldown());
				}
				else
				{
					CooldownData.SetCooldown(((StatusEffect)this).m_ttl);
				}
			}
			MessageCharacter();
			((StatusEffect)this).TriggerStartEffects();
		}

		private void MessageCharacter()
		{
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (!string.IsNullOrEmpty(((StatusEffect)this).m_startMessage))
			{
				List<string> list = new List<string>();
				if (m_freeProc)
				{
					list.AddRange(CheatDeath.reprocMessage.Value.Split(new string[1] { "&&" }, StringSplitOptions.RemoveEmptyEntries));
				}
				else
				{
					list.AddRange(CheatDeath.statusEffectStartMessageServer.Value.Split(new string[1] { "&&" }, StringSplitOptions.RemoveEmptyEntries));
					list.AddRange(CheatDeath.statusEffectStartMessageClient.Value.Split(new string[1] { "&&" }, StringSplitOptions.RemoveEmptyEntries));
				}
				if (list.Count == 0)
				{
					((StatusEffect)this).m_character.Message(((StatusEffect)this).m_startMessageType, ((StatusEffect)this).m_startMessage, 0, (Sprite)null, false);
				}
				else
				{
					((StatusEffect)this).m_character.Message(((StatusEffect)this).m_startMessageType, list[Random.Range(0, list.Count)], 0, (Sprite)null, false);
				}
			}
		}

		public override void Setup(Character character)
		{
			RollFreeProc();
			SetStatusEffectProperties(this);
			((StatusEffect)this).m_character = character;
		}

		public override bool CanAdd(Character character)
		{
			return !character.GetSEMan().HaveStatusEffect(statusEffectHash);
		}

		public float GetCharacterHealth()
		{
			return CheatDeath.healToThreshold.Value ? GetHealthThresholdValue(((StatusEffect)this).m_character) : Mathf.Min(((StatusEffect)this).m_character.GetHealth(), GetHealthThresholdValue(((StatusEffect)this).m_character));
		}

		private static float GetHealthThresholdValue(Character character)
		{
			return (CheatDeath.healthThreshold.Value == CheatDeath.HealthThreshold.Percent) ? (character.GetMaxHealth() * (CheatDeath.healthThresholdPercent.Value / 100f)) : CheatDeath.healthThresholdValue.Value;
		}

		public static void RegisterEffects()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)ZNetScene.instance))
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)vfx_CheatDeath))
			{
				bool flag = string.IsNullOrEmpty(CheatDeath.vfxOverride.Value);
				vfx_CheatDeath = CustomPrefabs.InitPrefabClone(ZNetScene.instance.GetPrefab(flag ? "vfx_HealthUpgrade" : CheatDeath.vfxOverride.Value), "vfx_CheatDeath");
				if (flag)
				{
					vfx_CheatDeath.transform.localPosition = Vector3.zero;
					for (int num = vfx_CheatDeath.transform.childCount - 1; num >= 0; num--)
					{
						Transform child = vfx_CheatDeath.transform.GetChild(num);
						switch (((Object)child).name)
						{
						case "Particle System _expl":
						case "smoke _expl":
						case "trails _expl":
						case "sfx_expl":
							child.parent = null;
							Object.Destroy((Object)(object)((Component)child).gameObject);
							break;
						case "Particle System":
						case "trails":
						case "smoke":
							child.localPosition -= new Vector3(0f, 1f, 0f);
							break;
						}
					}
				}
			}
			if (Object.op_Implicit((Object)(object)vfx_CheatDeath) && !ZNetScene.instance.m_namedPrefabs.ContainsKey(vfx_CheatDeathHash))
			{
				ZNetScene.instance.m_prefabs.Add(vfx_CheatDeath);
				ZNetScene.instance.m_namedPrefabs[vfx_CheatDeathHash] = vfx_CheatDeath;
			}
		}

		public static void UpdateConfigurableValues(SE_CheatDeath statusEffect = null)
		{
			if (!Object.op_Implicit((Object)(object)ObjectDB.instance))
			{
				return;
			}
			bool flag = (Object)(object)statusEffect == (Object)null;
			if (flag)
			{
				statusEffect = ObjectDB.instance.GetStatusEffect(statusEffectHash) as SE_CheatDeath;
			}
			if (!((Object)(object)statusEffect == (Object)null))
			{
				SetStatusEffectProperties(statusEffect);
				if (flag && Object.op_Implicit((Object)(object)Player.m_localPlayer) && ((Character)Player.m_localPlayer).GetSEMan().HaveStatusEffect(statusEffectHash))
				{
					SetStatusEffectProperties(((Character)Player.m_localPlayer).GetSEMan().GetStatusEffect(statusEffectHash) as SE_CheatDeath);
				}
			}
		}

		private static void SetStatusEffectProperties(SE_CheatDeath statusEffect)
		{
			((StatusEffect)statusEffect).m_name = CheatDeath.statusEffectLocalization.Value;
			((StatusEffect)statusEffect).m_ttl = CheatDeath.cooldown.Value;
			((SE_Stats)statusEffect).m_healthOverTimeInterval = CheatDeath.protectionSeconds.Value;
			((SE_Stats)statusEffect).m_runStaminaDrainModifier = CheatDeath.staminaModifier.Value;
			((SE_Stats)statusEffect).m_jumpStaminaUseModifier = CheatDeath.staminaModifier.Value;
			((SE_Stats)statusEffect).m_fallDamageModifier = CheatDeath.fallDamageModifier.Value;
			((SE_Stats)statusEffect).m_maxMaxFallSpeed = CheatDeath.maxMaxFallSpeed.Value;
			((SE_Stats)statusEffect).m_healthOverTime = CheatDeath.healthOverTime.Value;
			((SE_Stats)statusEffect).m_healthPerTick = CheatDeath.healthPerSecond.Value;
			((SE_Stats)statusEffect).m_tickInterval = 1f;
			((SE_Stats)statusEffect).m_addMaxCarryWeight = CheatDeath.addMaxCarryWeight.Value;
			m_modsActive.Clear();
			CollectionExtensions.Do<DamageType>(from DamageType e in Enum.GetValues(typeof(DamageType))
				where ((Enum)CheatDeath.protectionDamageType.Value).HasFlag((Enum)(object)e)
				select e, (Action<DamageType>)delegate(DamageType damageType)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				m_modsActive.Add(new DamageModPair
				{
					m_type = damageType,
					m_modifier = CheatDeath.protectionModifier.Value
				});
			});
			m_modsPostProtection.Clear();
			CollectionExtensions.Do<DamageType>(from DamageType e in Enum.GetValues(typeof(DamageType))
				where ((Enum)CheatDeath.postProtectionProtectionDamageType.Value).HasFlag((Enum)(object)e)
				select e, (Action<DamageType>)delegate(DamageType damageType)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				m_modsPostProtection.Add(new DamageModPair
				{
					m_type = damageType,
					m_modifier = CheatDeath.postProtectionProtectionModifier.Value
				});
			});
			((SE_Stats)statusEffect).m_mods = m_modsActive;
		}
	}
}