Decompiled source of EFT Frame v1.7.0

EFT_Frame.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Xml.Serialization;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using Sodalite;
using Sodalite.Api;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace EFT_Frame
{
	public class AudioData
	{
		public string Name;

		public List<AudioClip> Clips;
	}
	public struct BuffEffect
	{
		public bool isAddHealthPercent;

		public float AddHealthPercent;

		public bool isRemoveBleeding;

		public bool isBleedingKillers;

		public float BleedingKillersTime;

		public bool isLowHealthKillers;

		public float LowHealthKillersTime;

		public bool isTremor;

		public float TremorTime;

		public bool isFracture;

		public float FractureTime;

		public bool isTunnelvision;

		public float TunnelvisionTime;

		public bool isRemovePain;

		public bool isPainkillers;

		public float PainkillersTime;

		public LevelBuff Pain;

		public LevelBuff Bleeding;

		public LevelBuff SpeedUp;

		public LevelBuff StrengthUp;

		public LevelBuff ContinuedHeal;

		public LevelBuff DamageResist;

		public LevelBuff DamageScaler;

		public LevelBuff AddMaxHealth;

		public float MaxHealthReducePercent;

		public BuffEffect(bool ignore = false)
		{
			isAddHealthPercent = false;
			AddHealthPercent = 0f;
			isRemoveBleeding = false;
			isBleedingKillers = false;
			BleedingKillersTime = 0f;
			isLowHealthKillers = false;
			LowHealthKillersTime = 0f;
			isTremor = false;
			TremorTime = 0f;
			isFracture = false;
			FractureTime = 0f;
			isTunnelvision = false;
			TunnelvisionTime = 0f;
			isRemovePain = false;
			isPainkillers = false;
			PainkillersTime = 0f;
			Pain = default(LevelBuff);
			Bleeding = default(LevelBuff);
			SpeedUp = default(LevelBuff);
			StrengthUp = default(LevelBuff);
			ContinuedHeal = default(LevelBuff);
			DamageResist = default(LevelBuff);
			DamageScaler = default(LevelBuff);
			AddMaxHealth = default(LevelBuff);
			MaxHealthReducePercent = 0f;
		}
	}
	public struct BuffItem
	{
		public int PowerupType;

		public BuffEffect Effect;

		public float DelayedEffectTime;

		public BuffEffect DelayedEffect;

		public BuffItem(bool ignore = false)
		{
			PowerupType = 0;
			Effect = default(BuffEffect);
			DelayedEffect = default(BuffEffect);
			DelayedEffectTime = 0f;
		}
	}
	public struct BuffStat
	{
		public bool isBleedingKillers;

		public float BleedingKillersTime;

		public bool isLowHealthKillers;

		public float LowHealthKillersTime;

		public bool isTremor;

		public float TremorTime;

		public bool isFracture;

		public float FractureTime;

		public bool isTunnelvision;

		public float TunnelvisionTime;

		public bool isPainkillers;

		public float PainkillersTime;

		public List<LevelBuff> PainList;

		public List<LevelBuff> BleedingList;

		public List<LevelBuff> SpeedUpList;

		public List<LevelBuff> StrengthUpList;

		public List<LevelBuff> ContinuedHealList;

		public List<LevelBuff> DamageResistList;

		public List<LevelBuff> DamageScalerList;

		public List<LevelBuff> AddMaxHealthList;

		public float MaxHealthReducePercent;

		public BuffStat(bool ignore = false)
		{
			isBleedingKillers = false;
			BleedingKillersTime = 0f;
			isLowHealthKillers = false;
			LowHealthKillersTime = 0f;
			isFracture = false;
			FractureTime = 0f;
			isTremor = false;
			TremorTime = 0f;
			isTunnelvision = false;
			TunnelvisionTime = 0f;
			isPainkillers = false;
			PainkillersTime = 0f;
			PainList = new List<LevelBuff>();
			SpeedUpList = new List<LevelBuff>();
			StrengthUpList = new List<LevelBuff>();
			BleedingList = new List<LevelBuff>();
			ContinuedHealList = new List<LevelBuff>();
			DamageResistList = new List<LevelBuff>();
			DamageScalerList = new List<LevelBuff>();
			AddMaxHealthList = new List<LevelBuff>();
			MaxHealthReducePercent = 0f;
		}
	}
	public class BuffSystemPatch : PatchPlugin
	{
		public List<BuffItem> BuffItemsList = new List<BuffItem>();

		public override void DoPatch()
		{
			foreach (BuffItem buffItems in BuffItemsList)
			{
				if (GlobalBuffItemList.GetInstance().List.ContainsKey(buffItems.PowerupType))
				{
					Console.Write("BuffSystemPatch:{0}:Duplicate item define!!!{1}", PatchName, buffItems.PowerupType);
				}
				else
				{
					GlobalBuffItemList.GetInstance().List.Add(buffItems.PowerupType, buffItems);
				}
			}
		}
	}
	public class BuffSystem_UIUpdater_Patches
	{
		[HarmonyPatch(typeof(UIUpdater), "Update")]
		[HarmonyPostfix]
		public static void UIUpdater_Update_Patch(UIUpdater __instance)
		{
			//IL_000c: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 localScale = ((Component)__instance).gameObject.transform.localScale;
			if (WristMenuAPI.Instance2.m_isActive)
			{
				localScale.x = 0.00035f;
			}
			else
			{
				localScale.x = 0f;
			}
			((Component)__instance).gameObject.transform.localScale = localScale;
		}
	}
	[BepInPlugin("Ax.EF.Essential.EFThread.Plugin", "EF.Essential.EFThread.Plugin", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	public class EFThreadPlugin : BaseUnityPlugin
	{
		public struct MTStroeXMLInfomation
		{
			public string ConfigPath;

			public string FileName;

			public object Infomation;
		}

		public static EFThreadPlugin Instance;

		private Thread childThread = null;

		private ThreadStart childRef = null;

		private bool ExitThread = false;

		private Queue<MTStroeXMLInfomation> PenddingStroeXMLList;

		private void Start()
		{
			Instance = this;
			PenddingStroeXMLList = new Queue<MTStroeXMLInfomation>();
			childRef = ThreadFunc;
			childThread = new Thread(childRef);
			childThread.Start();
		}

		private void ThreadFunc()
		{
			do
			{
				if (PenddingStroeXMLList.Count > 0)
				{
					MTStroeXMLInfomation mTStroeXMLInfomation = PenddingStroeXMLList.Dequeue();
					XmlSerializer xmlSerializer = new XmlSerializer(mTStroeXMLInfomation.Infomation.GetType());
					FileStream fileStream = File.OpenWrite(mTStroeXMLInfomation.ConfigPath + mTStroeXMLInfomation.FileName + ".xml");
					fileStream.Seek(0L, SeekOrigin.Begin);
					fileStream.SetLength(0L);
					xmlSerializer.Serialize(fileStream, mTStroeXMLInfomation.Infomation);
					fileStream.Flush();
					fileStream.Close();
				}
			}
			while (!ExitThread);
		}

		private void OnDestroy()
		{
			Instance.ExitThread = true;
		}

		public static void QueueStoreXML(string ConfigPath, string FileName, object Infomation)
		{
			MTStroeXMLInfomation item = default(MTStroeXMLInfomation);
			item.ConfigPath = ConfigPath;
			item.FileName = FileName;
			item.Infomation = Infomation;
			Instance.PenddingStroeXMLList.Enqueue(item);
		}
	}
	public class EF_TnHItemStore_GlobalObject
	{
		private static readonly EF_TnHItemStore_GlobalObject Instance = new EF_TnHItemStore_GlobalObject();

		public TnHItemStore_ItemDefines Config;

		public int HoldChangeCounter = 0;

		public bool Checked = false;

		private EF_TnHItemStore_GlobalObject()
		{
		}

		public static TnHItemStore_ItemDefines GetDefaultConfig()
		{
			TnHItemStore_ItemDefines tnHItemStore_ItemDefines = new TnHItemStore_ItemDefines();
			tnHItemStore_ItemDefines.ItemDefines = new List<TnHItemStore_ItemDefine>
			{
				new TnHItemStore_ItemDefine("AI2 Medkit", 3, 1),
				new TnHItemStore_ItemDefine("Med_Analgin", 1, 1),
				new TnHItemStore_ItemDefine("Med_GoldenStar", 1, 2),
				new TnHItemStore_ItemDefine("Med_Bandage", 1, 2),
				new TnHItemStore_ItemDefine("Med_CAT", 1, 1),
				new TnHItemStore_ItemDefine("Med_CMSK", 2, 1),
				new TnHItemStore_ItemDefine("Med_Propital", 2, 1)
			};
			return tnHItemStore_ItemDefines;
		}

		public static void OnHoldEnd(TNH_HoldPoint p, bool success)
		{
			Console.Write("TnHItemStore:OnHoldEndEvent.");
			GetInstance().HoldChangeCounter++;
			GetInstance().Checked = false;
		}

		public static EF_TnHItemStore_GlobalObject GetInstance()
		{
			return Instance;
		}
	}
	[BepInPlugin("Ax.EscapeFrame_TnHItemStore", "EscapeFrame_TnHItemStore", "0.0.3")]
	[BepInProcess("h3vr.exe")]
	[BepInDependency("h3vr.otherloader", "1.1.5")]
	public class EscapeFrame_TnHItemStorePlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		private void Awake()
		{
		}

		private void LoadAssets()
		{
			OtherLoader.RegisterDirectLoad(BasePath, "Ax.EscapeFrame_TnHItemStore", "", "ef.tnhitemstore", "", "");
		}
	}
	public static class Essential_ConfigHelper
	{
		public static string GetUserProfilePath()
		{
			return Environment.ExpandEnvironmentVariables("%USERPROFILE%\\AppData\\LocalLow\\RUST LTD\\Hot Dogs Horseshoes and Hand Grenades");
		}

		public static string CheckEFConfigFolder(string SubName)
		{
			string userProfilePath = GetUserProfilePath();
			string text = userProfilePath + "\\EF\\" + SubName + "\\";
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			return text;
		}

		public static void Store(string path, TnHItemStore_ItemDefines Target)
		{
			XmlSerializer xmlSerializer = new XmlSerializer(typeof(TnHItemStore_ItemDefines));
			FileStream fileStream = File.OpenWrite(path);
			fileStream.Seek(0L, SeekOrigin.Begin);
			fileStream.SetLength(0L);
			xmlSerializer.Serialize(fileStream, Target);
			fileStream.Flush();
			fileStream.Close();
		}

		public static TnHItemStore_ItemDefines Read(string path)
		{
			FileStream fileStream = new FileStream(path, FileMode.Open);
			XmlSerializer xmlSerializer = new XmlSerializer(typeof(TnHItemStore_ItemDefines));
			TnHItemStore_ItemDefines tnHItemStore_ItemDefines = new TnHItemStore_ItemDefines();
			tnHItemStore_ItemDefines = (TnHItemStore_ItemDefines)xmlSerializer.Deserialize(fileStream);
			fileStream.Close();
			return tnHItemStore_ItemDefines;
		}
	}
	public class FVRObjectSpawner : MonoBehaviour
	{
		public string ID;

		private bool hasspawned = false;

		private float t = 0f;

		private float f = 0.5f;

		private void Update()
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			if (hasspawned)
			{
				return;
			}
			t += Time.deltaTime;
			if (!(t > f))
			{
				return;
			}
			if (IM.OD.ContainsKey(ID))
			{
				AnvilCallback<GameObject> gameObjectAsync = ((AnvilAsset)IM.OD[ID]).GetGameObjectAsync();
				if (Object.op_Implicit((Object)(object)gameObjectAsync.Result))
				{
					GameObject val = Object.Instantiate<GameObject>(gameObjectAsync.Result);
					val.transform.position = ((Component)this).transform.position;
					val.transform.rotation = ((Component)this).transform.rotation;
					hasspawned = true;
				}
			}
			t -= f;
		}

		private void OnDrawGizmos()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			Gizmos.color = new Color(0.9f, 0.2f, 0.2f, 0.5f);
			Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + ((Component)this).transform.right * 0.3f);
			Gizmos.DrawSphere(((Component)this).transform.position, 0.2f);
		}
	}
	public class GlobalBuffItemList
	{
		private static readonly GlobalBuffItemList Instance = new GlobalBuffItemList();

		public Dictionary<int, BuffItem> List;

		private GlobalBuffItemList()
		{
			List = new Dictionary<int, BuffItem>();
		}

		public static GlobalBuffItemList GetInstance()
		{
			return Instance;
		}
	}
	public class GlobalPostChangeList
	{
		private static readonly GlobalPostChangeList Instance = new GlobalPostChangeList();

		public List<PostFloatChange> CL_brightness;

		public List<PostFloatChange> CL_contrast;

		public List<PostFloatChange> CL_saturation;

		public List<PostFloatChange> CL_rbcount;

		public List<PostFloatChange> CL_rbdesat;

		public List<PostFloatChange> CL_rbdist;

		public List<PostFloatChange> CL_lscount;

		public List<PostFloatChange> CL_lsscale;

		public List<PostFloatChange> CL_lowhealthenable;

		public List<PostFloatChange> CL_tunnelvisionenable;

		public List<PostFloatChange> CL_distortstrength;

		public List<PostFloatChange> CL_tremorenable;

		public GlobalPostChangeList()
		{
			CL_brightness = new List<PostFloatChange>();
			CL_contrast = new List<PostFloatChange>();
			CL_saturation = new List<PostFloatChange>();
			CL_rbcount = new List<PostFloatChange>();
			CL_rbdesat = new List<PostFloatChange>();
			CL_rbdist = new List<PostFloatChange>();
			CL_lscount = new List<PostFloatChange>();
			CL_lsscale = new List<PostFloatChange>();
			CL_lowhealthenable = new List<PostFloatChange>();
			CL_tunnelvisionenable = new List<PostFloatChange>();
			CL_distortstrength = new List<PostFloatChange>();
			CL_tremorenable = new List<PostFloatChange>();
		}

		public static GlobalPostChangeList GetInstance()
		{
			return Instance;
		}
	}
	public static class HoldEndEventPatch
	{
		public static void Patch(Harmony harmony)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			Console.Write("TnHItemStore:HarmonyPatchInstalled.");
			MethodInfo method = typeof(TNH_Manager).GetMethod("HoldPointCompleted", BindingFlags.Instance | BindingFlags.Public);
			MethodInfo method2 = typeof(EF_TnHItemStore_GlobalObject).GetMethod("OnHoldEnd");
			MethodInfo methodInfo = method;
			HarmonyMethod val = new HarmonyMethod(method2);
			MethodInfo methodInfo2 = methodInfo;
			HarmonyMethod val2 = val;
			harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
	}
	public struct LevelBuff
	{
		public bool Enable;

		public float Time;

		public int Level;

		public LevelBuff(bool ignore = false)
		{
			Enable = false;
			Time = 0f;
			Level = 0;
		}
	}
	public class PatchPlugin : BaseUnityPlugin
	{
		public string PatchName = "NoneNamePatch";

		public void Start()
		{
			Initial();
			DoPatch();
		}

		public virtual void Initial()
		{
		}

		public virtual void DoPatch()
		{
		}
	}
	public class PostFloatChange
	{
		public float Value = 0f;
	}
	public class ScrollBarActions : MonoBehaviour
	{
		public Scrollbar Target;

		public void Roll(float a)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			Scrollbar target = Target;
			target.value += a;
			((Selectable)Target).OnMove(new AxisEventData(EventSystem.current));
		}
	}
	[StructLayout(LayoutKind.Sequential, Size = 1)]
	public struct StringActions
	{
		public static Vector3 ParseVector3FromString(string str)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			str = str.Replace("(", " ").Replace(")", " ");
			string[] array = str.Split(new char[1] { ',' });
			return new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]));
		}

		public static Quaternion ParseQuaternionFromString(string str)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			str = str.Replace("(", " ").Replace(")", " ");
			string[] array = str.Split(new char[1] { ',' });
			return new Quaternion(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]), float.Parse(array[3]));
		}

		public static string BuildTagString(string SourceStr, string tagname)
		{
			return "[" + tagname + "]" + SourceStr + "[/" + tagname + "]";
		}

		public static string GetInTagString(string SourceStr, string tagname, int mode = 0)
		{
			string text = "[" + tagname + "]";
			string value = "[/" + tagname + "]";
			int num = SourceStr.IndexOf(text, 0) + text.Length;
			int num2 = ((mode != 1) ? SourceStr.IndexOf(value, num) : SourceStr.LastIndexOf(value));
			return SourceStr.Substring(num, num2 - num);
		}

		public static List<string> SplitMultiTagString(string SourceStr, string tagname)
		{
			List<string> list = new List<string>();
			string oldValue = "[" + tagname + "]";
			string text = "[/" + tagname + "]";
			string text2 = SourceStr.Replace(oldValue, "");
			string[] source = text2.Split(new string[1] { text }, StringSplitOptions.None);
			list = source.ToList();
			list.RemoveAt(list.Count - 1);
			return list;
		}
	}
	public class TnHItemStoreButtonDefine : MonoBehaviour
	{
		public string ID = "";

		public Sprite IconSprite = null;

		public int TokenPrice = 0;

		public int ItemCount = 1;

		public string Des = "";

		public Image TargetIcon = null;

		public Image TargetBackGround = null;

		public TnHItemStoreScript TargetScript = null;

		public void Start()
		{
			RefreshButton();
		}

		public void RefreshButton()
		{
			if (Object.op_Implicit((Object)(object)IconSprite) && Object.op_Implicit((Object)(object)TargetIcon))
			{
				TargetIcon.sprite = IconSprite;
			}
		}

		public void SelectItem()
		{
			//IL_0038: 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)
			if (Object.op_Implicit((Object)(object)TargetScript.SelectedBT))
			{
				((Graphic)TargetScript.SelectedBT.TargetBackGround).color = Color.black;
			}
			((Graphic)TargetBackGround).color = Color.red;
			TargetScript.SelectedBT = this;
			TargetScript.PriceText.text = TokenPrice.ToString();
			TargetScript.CountText.text = ItemCount.ToString();
			TargetScript.Description.text = Des.ToString();
		}

		public void ButtonFunc()
		{
			SelectItem();
		}
	}
	[BepInPlugin("Ax.EF.TnHItemStore.Plugin", "EF.TnHItemStore.Plugin", "1.0.0")]
	[BepInDependency("nrgill28.Sodalite", "1.3.2")]
	[BepInProcess("h3vr.exe")]
	public class TnHItemStorePlugin : BaseUnityPlugin
	{
		private Harmony harmony;

		private TNH_Manager Manager;

		private float UpdateRate = 1f;

		private bool isTnH = false;

		private float timer = 0f;

		private int LastHoldChangeCounter = -1;

		private Dictionary<Vector3, GameObject> MyList;

		private List<GameObject> WaitList;

		private List<Vector3> ThisScanObjList;

		public int version = 3;

		private AnvilCallback<GameObject> ACallback;

		private GameObject HATsystem;

		public TnHItemStorePlugin()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			harmony = new Harmony("EF.Harmony.TnHItemStore");
		}

		private void ReadConfig()
		{
			string text = Essential_ConfigHelper.CheckEFConfigFolder("TnHItemStore");
			if (File.Exists(text + "Config.xml"))
			{
				EF_TnHItemStore_GlobalObject.GetInstance().Config = Essential_ConfigHelper.Read(text + "Config.xml");
				if (EF_TnHItemStore_GlobalObject.GetInstance().Config == null)
				{
					EF_TnHItemStore_GlobalObject.GetInstance().Config = EF_TnHItemStore_GlobalObject.GetDefaultConfig();
				}
				else
				{
					if (EF_TnHItemStore_GlobalObject.GetInstance().Config.version >= version)
					{
						return;
					}
					EF_TnHItemStore_GlobalObject.GetInstance().Config = EF_TnHItemStore_GlobalObject.GetDefaultConfig();
				}
			}
			else
			{
				EF_TnHItemStore_GlobalObject.GetInstance().Config = EF_TnHItemStore_GlobalObject.GetDefaultConfig();
			}
			Essential_ConfigHelper.Store(text + "Config.xml", EF_TnHItemStore_GlobalObject.GetInstance().Config);
		}

		private void SetConfigSprite()
		{
			foreach (List<ItemSpawnerID> value in IM.SCD.Values)
			{
				foreach (ItemSpawnerID item in value)
				{
					foreach (TnHItemStore_ItemDefine itemDefine in EF_TnHItemStore_GlobalObject.GetInstance().Config.ItemDefines)
					{
						if (item.ItemID == itemDefine.ID)
						{
							itemDefine.TargetSprite = item.Sprite;
							itemDefine.Description = item.Description;
							break;
						}
					}
				}
			}
		}

		private void SceneChanged(Scene from, Scene to)
		{
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)GameObject.Find("_GameManager")) || Object.op_Implicit((Object)(object)Object.FindObjectOfType<TNH_Manager>()))
			{
				Console.Write("TNH game start");
				ReadConfig();
				SetConfigSprite();
				Manager = Object.FindObjectOfType<TNH_Manager>();
				MyList = new Dictionary<Vector3, GameObject>();
				ThisScanObjList = new List<Vector3>();
				WaitList = new List<GameObject>();
				isTnH = true;
				timer = 0f;
				LastHoldChangeCounter = -1;
				EF_TnHItemStore_GlobalObject.GetInstance().HoldChangeCounter = 0;
				EF_TnHItemStore_GlobalObject.GetInstance().Checked = false;
				ACallback = ((AnvilAsset)IM.OD["EF.TnHItemStore"]).GetGameObjectAsync();
				if (Object.op_Implicit((Object)(object)ACallback.Result))
				{
					for (int i = 0; i < 8; i++)
					{
						GameObject val = Object.Instantiate<GameObject>(ACallback.Result);
						val.transform.position = new Vector3(10000f, 10000f, 500f);
						WaitList.Add(val);
						Console.Write("TnHItemStore:Spawned");
					}
				}
				else
				{
					Scene activeScene = SceneManager.GetActiveScene();
					Console.Write("TnHItemStore:Can't find store object,please wait for the assets load or report a bug,current scene name : {0}", ((Scene)(ref activeScene)).name);
				}
			}
			else
			{
				Console.Write("No TNH game start");
				MyList = null;
				isTnH = false;
				Manager = null;
				timer = 0f;
				LastHoldChangeCounter = -1;
				WaitList = null;
				ThisScanObjList = null;
				EF_TnHItemStore_GlobalObject.GetInstance().HoldChangeCounter = 0;
				EF_TnHItemStore_GlobalObject.GetInstance().Checked = false;
			}
		}

		private IEnumerator SpawnItemStoreC(Vector3 Pos, Quaternion Rot, Vector3 Axis, bool Method)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)ACallback.Result))
			{
				GameObject Store2 = Object.Instantiate<GameObject>(ACallback.Result);
				yield return Store2;
				Store2.transform.position = Pos + Axis * 0.2f;
				if (EF_BuffSystem_GlobalObject.GetInstance().Config.DisableTnHItemStore)
				{
					Store2.transform.position = new Vector3(10000f, 10000f, 500f);
				}
				Store2.transform.rotation = Rot;
				if (Object.op_Implicit((Object)(object)Store2))
				{
					if (Method)
					{
						MyList[Pos] = Store2;
					}
					else
					{
						MyList.Add(Pos, Store2);
					}
				}
				Store2 = null;
			}
			else
			{
				Scene activeScene = SceneManager.GetActiveScene();
				Console.Write("TnHItemStore:Can't find store object,please wait for the assets load or report a bug,current scene name : {0}", ((Scene)(ref activeScene)).name);
			}
		}

		private void SpawnItemStore(Vector3 Pos, Quaternion Rot, Vector3 Axis, bool Method)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			((MonoBehaviour)this).StartCoroutine(SpawnItemStoreC(Pos, Rot, Axis, Method));
		}

		private void Start()
		{
			SceneManager.activeSceneChanged += SceneChanged;
			HoldEndEventPatch.Patch(harmony);
		}

		private void Update()
		{
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_0618: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0530: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_0574: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
			if (!isTnH)
			{
				return;
			}
			timer += Time.deltaTime;
			if (timer > UpdateRate)
			{
				timer -= UpdateRate;
			}
			if (LastHoldChangeCounter != EF_TnHItemStore_GlobalObject.GetInstance().HoldChangeCounter || !EF_TnHItemStore_GlobalObject.GetInstance().Checked)
			{
				LastHoldChangeCounter = EF_TnHItemStore_GlobalObject.GetInstance().HoldChangeCounter;
				ThisScanObjList.Clear();
				List<TNH_ObjectConstructor> list = new List<TNH_ObjectConstructor>();
				foreach (TNH_SupplyPoint supplyPoint in Manager.SupplyPoints)
				{
					Type typeFromHandle = typeof(TNH_SupplyPoint);
					FieldInfo field = typeFromHandle.GetField("m_constructor", BindingFlags.Instance | BindingFlags.NonPublic);
					GameObject val = (GameObject)field.GetValue(supplyPoint);
					if ((Object)(object)val != (Object)null)
					{
						list.Add(val.GetComponent<TNH_ObjectConstructor>());
						Console.Write("TnHItemStore:CheckValidSupplyPoint.");
					}
				}
				if (list.Count <= 0)
				{
					list = Object.FindObjectsOfType<TNH_ObjectConstructor>().ToList();
					Console.Write("Fallback");
				}
				foreach (TNH_ObjectConstructor item in list)
				{
					if (MyList.ContainsKey(((Component)item).gameObject.transform.position))
					{
						GameObject value = null;
						if (!MyList.TryGetValue(((Component)item).gameObject.transform.position, out value))
						{
							if (WaitList.Count > 0)
							{
								Console.Write("Move old store to a old supply point.");
								WaitList[0].transform.position = ((Component)item).gameObject.transform.position + ((Component)item).gameObject.transform.up * 0.2f;
								if (EF_BuffSystem_GlobalObject.GetInstance().Config.DisableTnHItemStore)
								{
									WaitList[0].transform.position = new Vector3(10000f, 10000f, 500f);
								}
								WaitList[0].transform.rotation = ((Component)item).gameObject.transform.rotation;
								MyList[((Component)item).gameObject.transform.position] = WaitList[0];
								WaitList.RemoveAt(0);
							}
							else
							{
								Console.Write("Spawn new store for a old supply point.");
								SpawnItemStore(((Component)item).gameObject.transform.position, ((Component)item).gameObject.transform.rotation, ((Component)item).gameObject.transform.up, Method: true);
							}
						}
					}
					else if (WaitList.Count > 0)
					{
						Console.Write("Move old store to a new supply point.");
						WaitList[0].transform.position = ((Component)item).gameObject.transform.position + ((Component)item).gameObject.transform.up * 0.2f;
						if (EF_BuffSystem_GlobalObject.GetInstance().Config.DisableTnHItemStore)
						{
							WaitList[0].transform.position = new Vector3(10000f, 10000f, 500f);
						}
						WaitList[0].transform.rotation = ((Component)item).gameObject.transform.rotation;
						MyList.Add(((Component)item).gameObject.transform.position, WaitList[0]);
						WaitList.RemoveAt(0);
					}
					else
					{
						Console.Write("Spawn new store for a new supply point.");
						SpawnItemStore(((Component)item).gameObject.transform.position, ((Component)item).gameObject.transform.rotation, ((Component)item).gameObject.transform.up, Method: false);
					}
					ThisScanObjList.Add(((Component)item).gameObject.transform.position);
					EF_TnHItemStore_GlobalObject.GetInstance().Checked = true;
				}
				List<Vector3> list2 = new List<Vector3>();
				foreach (Vector3 key in MyList.Keys)
				{
					if (!ThisScanObjList.Contains(key) && Object.op_Implicit((Object)(object)MyList[key]))
					{
						Console.Write("Move out a store for a invalid supply point.");
						MyList[key].gameObject.transform.position = new Vector3(10000f, 10000f, 500f);
						WaitList.Add(MyList[key]);
						list2.Add(key);
					}
				}
				foreach (Vector3 item2 in list2)
				{
					MyList[item2] = null;
				}
			}
			if (EF_BuffSystem_GlobalObject.GetInstance().Config.DisableHATsystem || Object.op_Implicit((Object)(object)HATsystem))
			{
				return;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (!(((Scene)(ref activeScene)).name != "MainMenu3"))
			{
				return;
			}
			if (IM.OD.ContainsKey("EFT Foods hAtSystem"))
			{
				AnvilCallback<GameObject> gameObjectAsync = ((AnvilAsset)IM.OD["EFT Foods hAtSystem"]).GetGameObjectAsync();
				if (Object.op_Implicit((Object)(object)gameObjectAsync.Result))
				{
					HATsystem = Object.Instantiate<GameObject>(gameObjectAsync.Result);
					Console.Write("hAtSystem:Initialed new hAt system object");
				}
				else
				{
					Scene activeScene2 = SceneManager.GetActiveScene();
					Console.Write("hAtSystem:Can't find hAt system object,please wait for the assets load or report a bug,current scene name : {0}", ((Scene)(ref activeScene2)).name);
				}
			}
			else
			{
				Scene activeScene3 = SceneManager.GetActiveScene();
				Console.Write("hAtSystem:Can't find hAt system object ID,please wait for the assets load or report a bug,current scene name : {0}", ((Scene)(ref activeScene3)).name);
			}
		}
	}
	public class TnHItemStoreScript : MonoBehaviour
	{
		public TnHItemStoreButtonDefine SelectedBT;

		private TNH_Manager Manager;

		public Text PriceText;

		public Transform SpawnPoint;

		public Text CountText;

		public Text Description;

		public Sprite AI2;

		public Sprite Papital;

		public Sprite Bandage;

		public Sprite GoldenStar;

		public Sprite Medkit;

		public Sprite CAT;

		public Sprite Analgin;

		public AudioEvent buy;

		private void Start()
		{
			Manager = Object.FindObjectOfType<TNH_Manager>();
		}

		public void Update()
		{
			if (!((Object)(object)SelectedBT == (Object)null))
			{
			}
		}

		public void BUY()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)SelectedBT))
			{
				return;
			}
			int tokenPrice = ((Component)SelectedBT).GetComponent<TnHItemStoreButtonDefine>().TokenPrice;
			if (tokenPrice <= Manager.m_numTokens)
			{
				Manager.SubtractTokens(tokenPrice);
				for (int i = 0; i < ((Component)SelectedBT).GetComponent<TnHItemStoreButtonDefine>().ItemCount; i++)
				{
					SpawnItem(((Component)SelectedBT).GetComponent<TnHItemStoreButtonDefine>().ID, SpawnPoint);
					SM.PlayCoreSound((FVRPooledAudioType)0, buy, SpawnPoint.position);
				}
			}
		}

		private GameObject SpawnItem(string ID, Transform point)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (IM.OD.ContainsKey(ID))
			{
				AnvilCallback<GameObject> gameObjectAsync = ((AnvilAsset)IM.OD[ID]).GetGameObjectAsync();
				if (Object.op_Implicit((Object)(object)gameObjectAsync.Result))
				{
					GameObject val = Object.Instantiate<GameObject>(gameObjectAsync.Result);
					val.transform.position = point.position;
					val.transform.rotation = point.rotation;
					return val;
				}
				Console.Write("TnHItemStore:Can't find item object,please wait for the assets load or report a bug,current scene name");
			}
			else
			{
				Console.Write("TnHItemStore:Can't find item ID,please wait for the assets load or report a bug,current scene name");
			}
			return null;
		}
	}
	public class TnHItemStoreScrollScript : MonoBehaviour
	{
		public Scrollbar Target;

		public void Roll(float a)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			Scrollbar target = Target;
			target.value += a;
			((Selectable)Target).OnMove(new AxisEventData(EventSystem.current));
		}
	}
	[Serializable]
	public class TnHItemStore_ItemDefine
	{
		[XmlElement]
		public string ID = "";

		[XmlElement]
		public int TokenPrice = 0;

		[XmlElement]
		public int ItemCount = 1;

		public string Description = "";

		public Sprite TargetSprite;

		public TnHItemStore_ItemDefine()
		{
		}

		public TnHItemStore_ItemDefine(string ins, int ini, int c)
		{
			ID = ins;
			TokenPrice = ini;
			ItemCount = c;
			TargetSprite = IM.GetSpawnerID(ins).Sprite;
			Description = IM.GetSpawnerID(ins).Description;
		}
	}
	[Serializable]
	public class TnHItemStore_ItemDefines
	{
		[XmlArray]
		public List<TnHItemStore_ItemDefine> ItemDefines = new List<TnHItemStore_ItemDefine>();

		[XmlElement]
		public int version = 3;
	}
	public class WorldInteraction
	{
		private static readonly WorldInteraction Instance = new WorldInteraction();

		public static WorldInteraction GetInstance()
		{
			return Instance;
		}

		public List<FVRQuickBeltSlot> GetDirectQBSListOfItem(FVRPhysicalObject TargetObject)
		{
			List<FVRQuickBeltSlot> list = new List<FVRQuickBeltSlot>();
			if (((Component)TargetObject).GetComponentsInChildren<FVRFireArmAttachmentMount>() != null)
			{
				FVRFireArmAttachmentMount[] componentsInChildren = ((Component)TargetObject).GetComponentsInChildren<FVRFireArmAttachmentMount>();
				foreach (FVRFireArmAttachmentMount val in componentsInChildren)
				{
					if (!Object.op_Implicit((Object)(object)val) || val.AttachmentsList == null)
					{
						continue;
					}
					foreach (FVRFireArmAttachment attachments in val.AttachmentsList)
					{
						if (!Object.op_Implicit((Object)(object)attachments))
						{
							continue;
						}
						List<FVRQuickBeltSlot> list2 = ((Component)attachments).GetComponentsInChildren<FVRQuickBeltSlot>().ToList();
						if (list2 == null)
						{
							continue;
						}
						foreach (FVRQuickBeltSlot item in list2)
						{
							if (Object.op_Implicit((Object)(object)item))
							{
								list.Add(item);
							}
						}
					}
				}
			}
			List<FVRQuickBeltSlot> list3 = new List<FVRQuickBeltSlot>();
			if (((Component)TargetObject).GetComponentsInChildren<FVRQuickBeltSlot>() != null)
			{
				FVRQuickBeltSlot[] componentsInChildren2 = ((Component)TargetObject).GetComponentsInChildren<FVRQuickBeltSlot>();
				foreach (FVRQuickBeltSlot val2 in componentsInChildren2)
				{
					if (Object.op_Implicit((Object)(object)val2) && !list.Contains(val2))
					{
						list3.Add(val2);
					}
				}
			}
			return list3;
		}

		public void DeletePhysicalObject(FVRPhysicalObject TargetObject)
		{
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			List<FVRQuickBeltSlot> list = new List<FVRQuickBeltSlot>();
			List<FVRFireArmAttachmentMount> list2 = new List<FVRFireArmAttachmentMount>();
			list = GetDirectQBSListOfItem(TargetObject);
			if (TargetObject.AttachmentMounts != null)
			{
				list2 = TargetObject.AttachmentMounts;
			}
			foreach (FVRQuickBeltSlot item in list)
			{
				if ((Object)(object)item.CurObject != (Object)null)
				{
					DeletePhysicalObject(item.CurObject);
				}
			}
			if (list2 != null)
			{
				foreach (FVRFireArmAttachmentMount item2 in list2)
				{
					if (!((Object)(object)item2 != (Object)null) || item2.AttachmentsList == null || item2.AttachmentsList.Count <= 0)
					{
						continue;
					}
					foreach (FVRFireArmAttachment attachments in item2.AttachmentsList)
					{
						if (Object.op_Implicit((Object)(object)attachments))
						{
							DeletePhysicalObject((FVRPhysicalObject)(object)attachments);
						}
					}
				}
			}
			if (TargetObject is FVRFireArmRound)
			{
				FVRFireArmRound val = (FVRFireArmRound)TargetObject;
				if (val.ProxyRounds.Count > 0)
				{
					for (int i = 0; i < val.ProxyRounds.Count; i++)
					{
						val.ProxyRounds[i] = null;
					}
					val.ProxyRounds.Clear();
				}
				val.UpdateProxyDisplay();
			}
			if (Object.op_Implicit((Object)(object)TargetObject.QuickbeltSlot))
			{
				TargetObject.ClearQuickbeltState();
			}
			if (Object.op_Implicit((Object)(object)((FVRInteractiveObject)TargetObject).m_hand))
			{
				FVRViveHand hand = ((FVRInteractiveObject)TargetObject).m_hand;
				((FVRInteractiveObject)TargetObject).EndInteraction(((FVRInteractiveObject)TargetObject).m_hand);
				hand.ForceSetInteractable((FVRInteractiveObject)null);
			}
			((FVRInteractiveObject)TargetObject).ForceBreakInteraction();
			GameObject gameObject = ((Component)TargetObject).gameObject;
			if (((Component)TargetObject).GetComponentsInChildren<FVRPhysicalObject>() != null)
			{
				FVRPhysicalObject[] componentsInChildren = ((Component)TargetObject).GetComponentsInChildren<FVRPhysicalObject>();
				foreach (FVRPhysicalObject val2 in componentsInChildren)
				{
					if (Object.op_Implicit((Object)(object)val2))
					{
						Object.DestroyImmediate((Object)(object)val2);
					}
				}
			}
			if (Object.op_Implicit((Object)(object)TargetObject))
			{
				Object.DestroyImmediate((Object)(object)TargetObject);
			}
			if (Object.op_Implicit((Object)(object)gameObject))
			{
				Object.Destroy((Object)(object)gameObject);
			}
		}

		public List<FVRQuickBeltSlot> GetPlayerQBSList()
		{
			List<FVRQuickBeltSlot> list = new List<FVRQuickBeltSlot>();
			foreach (FVRQuickBeltSlot quickbeltSlot in GM.CurrentPlayerBody.QuickbeltSlots)
			{
				if (quickbeltSlot.IsPlayer && ((Object)((Component)quickbeltSlot).gameObject.transform.parent).name == "Torso")
				{
					list.Add(quickbeltSlot);
				}
			}
			return list;
		}
	}
	public static class XMLHelper
	{
		public static string GetUserProfilePath()
		{
			return Environment.ExpandEnvironmentVariables("%USERPROFILE%\\AppData\\LocalLow\\RUST LTD\\Hot Dogs Horseshoes and Hand Grenades");
		}

		public static string CheckConfigFolder(string CategoryName)
		{
			string userProfilePath = GetUserProfilePath();
			string text = userProfilePath + "\\" + CategoryName;
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			return text;
		}

		public static void StoreXML<T>(string path, T Target)
		{
			XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
			FileStream fileStream = File.OpenWrite(path);
			fileStream.Seek(0L, SeekOrigin.Begin);
			fileStream.SetLength(0L);
			xmlSerializer.Serialize(fileStream, Target);
			fileStream.Flush();
			fileStream.Close();
		}

		public static T ReadXML<T>(string path) where T : new()
		{
			FileStream fileStream = new FileStream(path, FileMode.Open);
			XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
			T val = new T();
			val = (T)xmlSerializer.Deserialize(fileStream);
			fileStream.Close();
			return val;
		}
	}
	public class Configer : MonoBehaviour
	{
		public Text AllDebuff;

		public Text AllGoodBuff;

		public Text Bleeding;

		public Text Pain;

		public Text Fracture;

		public Text Tunnelvision;

		public Text LowHealthEffect;

		public Text BleedingChance;

		public Text FractureHeight;

		public Text Tremor;

		public Text Injure;

		public Text DisableInertia;

		public Text DisableInertiaSound;

		public Text DisableFallDamage;

		public Text DisableBreathAudio;

		public Text DisableTookdamageAudio;

		public Text DisableTnHItemStore;

		public Text DisableHATsystem;

		public Text ToggleGenders;

		private EF_BuffSystem_GlobalObject GO;

		private void Start()
		{
			GO = EF_BuffSystem_GlobalObject.GetInstance();
			RefreshUIStat();
		}

		public void ToggleDisableAllDebuff()
		{
			GO.Config.DisableAllDebuff = !GO.Config.DisableAllDebuff;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleDisableAllGoodBuff()
		{
			GO.Config.DisableAllGoodBuff = !GO.Config.DisableAllGoodBuff;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleDisableBleeding()
		{
			GO.Config.DisableBleeding = !GO.Config.DisableBleeding;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleDisableMaxHealthReduce()
		{
			GO.Config.DisableMaxHealthReduce = !GO.Config.DisableMaxHealthReduce;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleDisablePain()
		{
			GO.Config.DisablePain = !GO.Config.DisablePain;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleDisableFracture()
		{
			GO.Config.DisableFracture = !GO.Config.DisableFracture;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleDisableTunnelvision()
		{
			GO.Config.DisableTunnelvision = !GO.Config.DisableTunnelvision;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleDisableLowHealthEffect()
		{
			GO.Config.DisableLowHealthEffect = !GO.Config.DisableLowHealthEffect;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleDisableTremor()
		{
			GO.Config.DisableTremor = !GO.Config.DisableTremor;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleBreathAudio()
		{
			GO.Config.DisableBreathAudio = !GO.Config.DisableBreathAudio;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleTookDamageAudio()
		{
			GO.Config.DisableTookDamageAudio = !GO.Config.DisableTookDamageAudio;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleTnHItemStore()
		{
			GO.Config.DisableTnHItemStore = !GO.Config.DisableTnHItemStore;
			RefreshUIStat();
			StoreConfig();
		}

		public void ChangeBleedingChance(int Value)
		{
			GO.Config.PerShotBleedingChance += Value;
			RefreshUIStat();
			StoreConfig();
		}

		public void ChangeFractureHeight(int Value)
		{
			GO.Config.FractureHeight += Value;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleInertia()
		{
			GO.Config.DoesInertia = !GO.Config.DoesInertia;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleInertiaSound()
		{
			GO.Config.DoesInertiaSound = !GO.Config.DoesInertiaSound;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleFallDamage()
		{
			GO.Config.DoesFallDamage = !GO.Config.DoesFallDamage;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleHATsystem()
		{
			GO.Config.DisableHATsystem = !GO.Config.DisableHATsystem;
			RefreshUIStat();
			StoreConfig();
		}

		public void ToggleGender()
		{
			GO.Config.IsMale = !GO.Config.IsMale;
			RefreshUIStat();
			StoreConfig();
		}

		private void RefreshUIStat()
		{
			AllDebuff.text = "AllDebuff:" + (GO.Config.DisableAllDebuff ? "OFF" : "ON");
			AllGoodBuff.text = "AllGoodBuff:" + (GO.Config.DisableAllGoodBuff ? "OFF" : "ON");
			Bleeding.text = "Bleeding:" + (GO.Config.DisableBleeding ? "OFF" : "ON");
			Pain.text = "Pain:" + (GO.Config.DisablePain ? "OFF" : "ON");
			Fracture.text = "Fracture:" + (GO.Config.DisableFracture ? "OFF" : "ON");
			Tunnelvision.text = "Tunnelvision:" + (GO.Config.DisableTunnelvision ? "OFF" : "ON");
			LowHealthEffect.text = "LowHealthFX:" + (GO.Config.DisableLowHealthEffect ? "OFF" : "ON");
			Tremor.text = "Tremor:" + (GO.Config.DisableTremor ? "OFF" : "ON");
			Injure.text = "Injure:" + (GO.Config.DisableMaxHealthReduce ? "OFF" : "ON");
			DisableInertia.text = "Inertia:" + ((!GO.Config.DoesInertia) ? "OFF" : "ON");
			DisableInertiaSound.text = "MovementSound:" + ((!GO.Config.DoesInertiaSound) ? "OFF" : "ON");
			DisableFallDamage.text = "FallDamage:" + ((!GO.Config.DoesFallDamage) ? "OFF" : "ON");
			DisableBreathAudio.text = "BreathAudio:" + (GO.Config.DisableBreathAudio ? "OFF" : "ON");
			DisableTookdamageAudio.text = "TookDamageAudio:" + (GO.Config.DisableTookDamageAudio ? "OFF" : "ON");
			DisableTnHItemStore.text = "TnHItemStore:" + (GO.Config.DisableTnHItemStore ? "OFF" : "ON");
			BleedingChance.text = GO.Config.PerShotBleedingChance.ToString();
			FractureHeight.text = ((int)GO.Config.FractureHeight).ToString();
			DisableHATsystem.text = "HATSystem:" + (GO.Config.DisableHATsystem ? "OFF" : "ON");
			ToggleGenders.text = "Gender:" + (GO.Config.IsMale ? "Male" : "Female");
		}

		private void StoreConfig()
		{
			GO.StoreConfig();
		}
	}
	[Serializable]
	public class BuffSystemSetting
	{
		[XmlElement]
		public bool DoesInertia = true;

		[XmlElement]
		public bool DoesInertiaSound = true;

		[XmlElement]
		public bool DoesFallDamage = true;

		[XmlElement]
		public bool DisableAllDebuff = false;

		[XmlElement]
		public bool DisableAllGoodBuff = false;

		[XmlElement]
		public bool DisableBleeding = false;

		[XmlElement]
		public bool DisablePain = false;

		[XmlElement]
		public bool DisableTremor = false;

		[XmlElement]
		public bool DisableFracture = false;

		[XmlElement]
		public bool DisableTunnelvision = false;

		[XmlElement]
		public bool DisableMaxHealthReduce = false;

		[XmlElement]
		public bool DisableLowHealthEffect = false;

		[XmlElement]
		public int PerShotBleedingChance = 10;

		[XmlElement]
		public int PerShotBleedingLevel = 1;

		[XmlElement]
		public float PerShotBleedingTime = 30f;

		[XmlElement]
		public float MultShotBleedingMaxInterval = 2f;

		[XmlElement]
		public int MultShotBleedingChance = 100;

		[XmlElement]
		public int MultShotBleedingLevel = 2;

		[XmlElement]
		public float MultShotBleedingTime = 30f;

		[XmlElement]
		public int LowArmorPerShotPainChance = 100;

		[XmlElement]
		public int LowArmorPerShotPainLevel = 2;

		[XmlElement]
		public float LowArmorPerShotPainTime = 10f;

		[XmlElement]
		public int LowArmorPerShotSpeedDownChance = 50;

		[XmlElement]
		public int LowArmorPerShotSpeedDownLevel = -2;

		[XmlElement]
		public float LowArmorPerShotSpeedDownTime = 10f;

		[XmlElement]
		public int HighArmorPerShotPainChance = 100;

		[XmlElement]
		public int HighArmorPerShotPainLevel = 1;

		[XmlElement]
		public float HighArmorPerShotPainTime = 10f;

		[XmlElement]
		public int HighArmorPerShotSpeedDownChance = 50;

		[XmlElement]
		public int HighArmorPerShotSpeedDownLevel = -1;

		[XmlElement]
		public float HighArmorPerShotSpeedDownTime = 10f;

		[XmlElement]
		public float PerShotMaxHealthReducePercentOfDamage = 0.15f;

		[XmlElement]
		public float FractureHeight = 10f;

		[XmlElement]
		public float FractureTime = 60f;

		[XmlElement]
		public float FractureEffect = 0.5f;

		[XmlElement]
		public float LowHealthEffectThreshold = 0.3f;

		[XmlElement]
		public int ContinuedHealMinLevel = -5;

		[XmlElement]
		public int ContinuedHealMaxLevel = 5;

		[XmlElement]
		public float ContinuedHealPerLevelEffect = 0.3f;

		[XmlElement]
		public int BleedingMaxLevel = 5;

		[XmlElement]
		public float BleedingPerLevelEffect = 0.25f;

		[XmlElement]
		public bool BleedingCauseDead = false;

		[XmlElement]
		public int DamageResistMinLevel = -8;

		[XmlElement]
		public int DamageResistMaxLevel = 8;

		[XmlElement]
		public float DamageResistPerLevelEffectPercent = 0.1f;

		[XmlElement]
		public int SpeedUpMinLevel = -4;

		[XmlElement]
		public int SpeedUpMaxLevel = 5;

		[XmlElement]
		public float SpeedUpPerLevelEffect = 0.2f;

		[XmlElement]
		public int StrengthUpMinLevel = -5;

		[XmlElement]
		public int StrengthUpMaxLevel = 5;

		[XmlElement]
		public int DamageScalerMinLevel = -5;

		[XmlElement]
		public int DamageScalerMaxLevel = 5;

		[XmlElement]
		public float DamageScalerPerLevelUp = 0.65f;

		[XmlElement]
		public float DamageScalerPerLevelDownPercent = 0.8f;

		[XmlElement]
		public int AddMaxHealthMinLevel = -4;

		[XmlElement]
		public int AddMaxHealthMaxLevel = 10;

		[XmlElement]
		public float AddMaxHealthPerLevelEffect = 0.1f;

		[XmlElement]
		public float MaxMaxHealthReducePercent = 0.5f;

		[XmlElement]
		public bool DisableBreathAudio = true;

		[XmlElement]
		public bool DisableTookDamageAudio = true;

		[XmlElement]
		public bool DisableTnHItemStore = false;

		[XmlElement]
		public bool DisableHATsystem = false;

		[XmlElement]
		public bool IsMale = true;
	}
	public static class ConfigHelper
	{
		public static string GetUserProfilePath()
		{
			return Environment.ExpandEnvironmentVariables("%USERPROFILE%\\AppData\\LocalLow\\RUST LTD\\Hot Dogs Horseshoes and Hand Grenades");
		}

		public static string CheckEFConfigFolder(string SubName)
		{
			string userProfilePath = GetUserProfilePath();
			string text = userProfilePath + "\\EF\\" + SubName + "\\";
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
			}
			return text;
		}
	}
	public class EF_BuffSystem_GlobalObject
	{
		private static readonly EF_BuffSystem_GlobalObject Instance = new EF_BuffSystem_GlobalObject();

		public BuffSystemSetting Config;

		private EF_BuffSystem_GlobalObject()
		{
		}

		public void StoreConfig()
		{
			string text = ConfigHelper.CheckEFConfigFolder("BuffSystem");
			StoreBuffSettingHelper.Store(text + "BuffSystemSettings.xml", Config);
		}

		public void ReadConfig()
		{
			string text = ConfigHelper.CheckEFConfigFolder("BuffSystem");
			Config = StoreBuffSettingHelper.Read(text + "BuffSystemSettings.xml");
		}

		public static EF_BuffSystem_GlobalObject GetInstance()
		{
			return Instance;
		}
	}
	public class Manager : MonoBehaviour
	{
		public class BuffEffectWithDelayTime
		{
			public float LastTime;

			public BuffEffect BE;
		}

		public float curH;

		public float lastH;

		public float dam;

		private float timer = 0f;

		private float UpdateRate = 0.0666667f;

		public BuffStat CurrentBuffEffect = default(BuffStat);

		public List<BuffEffectWithDelayTime> DelayedBuffList = new List<BuffEffectWithDelayTime>();

		public GlobalPostChangeList TargetGlobalPostCL = GlobalPostChangeList.GetInstance();

		private PostFloatChange PainCL_rbcount;

		private PostFloatChange PainCL_rbdesat;

		private PostFloatChange PainCL_rbdist;

		private PostFloatChange PainCL_brightness;

		private PostFloatChange LowHealthCL_lowhealthenable;

		private PostFloatChange LowHealthCL_saturation;

		private PostFloatChange TunnelvisionCL_tunnelvisionenable;

		private PostFloatChange PainkillersCL_brightness;

		private PostFloatChange PainkillersCL_lsscale;

		private PostFloatChange PainkillersCL_lscount;

		private PostFloatChange Bleeding_distortsrength;

		private PostFloatChange Tremor_tremorenable;

		private EF_BuffSystem_GlobalObject ConfigObj;

		public EF_VoiceSystem VoiceSystem = null;

		private bool NeedRefreshLowHealthEffect = false;

		private float LastDamageTime = 0f;

		private Vector3 ThisFrameInitial2AxisVelocity = Vector3.zero;

		private Vector3 ThisFrameInitialSwingArmVelocity = Vector3.zero;

		private Vector3 TremorCurrentDirect = Vector3.zero;

		private Vector3 TremorCurrentPath = Vector3.zero;

		private Vector3 TremorLeftHandPosOver = Vector3.zero;

		private Vector3 TremorRightHandPosOver = Vector3.zero;

		private bool NeedRefreshTremorOffset = false;

		private float TremorSingleShakeStrength = 0f;

		private float TremorSingleShakeTime = 0f;

		private float TremorSingleShakeTimeLength = 0f;

		private float IntoAirHeight = -114514f;

		private float StoredPlayerMaxHealth;

		private float CurrentPlayerMaxHealth;

		public int ThisFramePainLevel;

		public float ThisFramePainTime;

		public int ThisFrameBleedingLevel;

		public float ThisFrameBleedingTime;

		public int ThisFrameSpeedUpLevel;

		public float ThisFrameSpeedUpTime;

		public int ThisFrameStrengthUpLevel;

		public float ThisFrameStrengthUpTime;

		public int ThisFrameContinuedHealLevel;

		public float ThisFrameContinuedHealTime;

		public int ThisFrameDamageResistLevel;

		public float ThisFrameDamageResistTime;

		public int ThisFrameDamageScalerLevel;

		public float ThisFrameDamageScalerTime;

		public int ThisFrameAddMaxHealthLevel;

		public float ThisFrameAddMaxHealthTime;

		public void Start()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			ConfigObj = EF_BuffSystem_GlobalObject.GetInstance();
			ConfigObj.ReadConfig();
			GM.CurrentSceneSettings.PowerupUseEvent -= new PowerupUse(PowerupEvent);
			GM.CurrentSceneSettings.PowerupUseEvent += new PowerupUse(PowerupEvent);
			StoredPlayerMaxHealth = GM.CurrentPlayerBody.m_startingHealth;
			CurrentPlayerMaxHealth = GM.CurrentPlayerBody.m_startingHealth;
			AssignPostCLObj();
			ResetCurrentBuffEffect();
			Console.Write("BuffSystem:Start");
		}

		private void OnDestroy()
		{
			DesignPostCLObj();
			Console.Write("BuffSystem:Destroy");
		}

		public void AssignPostCLObj()
		{
			PainCL_rbcount = new PostFloatChange();
			TargetGlobalPostCL.CL_rbcount.Add(PainCL_rbcount);
			PainCL_rbdesat = new PostFloatChange();
			TargetGlobalPostCL.CL_rbdesat.Add(PainCL_rbdesat);
			PainCL_rbdist = new PostFloatChange();
			TargetGlobalPostCL.CL_rbdist.Add(PainCL_rbdist);
			PainCL_brightness = new PostFloatChange();
			TargetGlobalPostCL.CL_brightness.Add(PainCL_brightness);
			LowHealthCL_lowhealthenable = new PostFloatChange();
			TargetGlobalPostCL.CL_lowhealthenable.Add(LowHealthCL_lowhealthenable);
			LowHealthCL_saturation = new PostFloatChange();
			TargetGlobalPostCL.CL_saturation.Add(LowHealthCL_saturation);
			TunnelvisionCL_tunnelvisionenable = new PostFloatChange();
			TargetGlobalPostCL.CL_tunnelvisionenable.Add(TunnelvisionCL_tunnelvisionenable);
			PainkillersCL_brightness = new PostFloatChange();
			TargetGlobalPostCL.CL_brightness.Add(PainkillersCL_brightness);
			PainkillersCL_lsscale = new PostFloatChange();
			TargetGlobalPostCL.CL_lsscale.Add(PainkillersCL_lsscale);
			PainkillersCL_lscount = new PostFloatChange();
			TargetGlobalPostCL.CL_lscount.Add(PainkillersCL_lscount);
			Bleeding_distortsrength = new PostFloatChange();
			TargetGlobalPostCL.CL_distortstrength.Add(Bleeding_distortsrength);
			Tremor_tremorenable = new PostFloatChange();
			TargetGlobalPostCL.CL_tremorenable.Add(Tremor_tremorenable);
		}

		public void DesignPostCLObj()
		{
			TargetGlobalPostCL.CL_rbcount.Remove(PainCL_rbcount);
			TargetGlobalPostCL.CL_rbdesat.Remove(PainCL_rbdesat);
			TargetGlobalPostCL.CL_rbdist.Remove(PainCL_rbdist);
			TargetGlobalPostCL.CL_lowhealthenable.Remove(LowHealthCL_lowhealthenable);
			TargetGlobalPostCL.CL_saturation.Remove(LowHealthCL_saturation);
			TargetGlobalPostCL.CL_tunnelvisionenable.Remove(TunnelvisionCL_tunnelvisionenable);
			TargetGlobalPostCL.CL_brightness.Remove(PainkillersCL_brightness);
			TargetGlobalPostCL.CL_lsscale.Remove(PainkillersCL_lsscale);
			TargetGlobalPostCL.CL_lscount.Remove(PainkillersCL_lscount);
			TargetGlobalPostCL.CL_distortstrength.Remove(Bleeding_distortsrength);
			TargetGlobalPostCL.CL_tremorenable.Remove(Tremor_tremorenable);
		}

		private void ResetCurrentBuffEffect()
		{
			CurrentBuffEffect = default(BuffStat);
			CurrentBuffEffect.BleedingList = new List<LevelBuff>();
			CurrentBuffEffect.PainList = new List<LevelBuff>();
			CurrentBuffEffect.ContinuedHealList = new List<LevelBuff>();
			CurrentBuffEffect.DamageResistList = new List<LevelBuff>();
			CurrentBuffEffect.DamageScalerList = new List<LevelBuff>();
			CurrentBuffEffect.SpeedUpList = new List<LevelBuff>();
			CurrentBuffEffect.StrengthUpList = new List<LevelBuff>();
			CurrentBuffEffect.AddMaxHealthList = new List<LevelBuff>();
		}

		public void Update()
		{
			curH = GM.CurrentPlayerBody.GetPlayerHealthRaw();
			dam = lastH - curH;
			lastH = curH;
			if (dam > 10f)
			{
				DamageEvent(dam / GM.CurrentPlayerBody.m_startingHealth);
			}
			if (GM.CurrentPlayerBody.GetPlayerHealthRaw() <= 0)
			{
				DeathEvent(killedself: false);
			}
			UpdateSelf();
			timer += Time.deltaTime;
			if (timer > UpdateRate)
			{
				timer -= UpdateRate;
				UpdateLevelBuffInfomation();
				UpdateDelayedBuffList();
				UpdateBuffStat();
				UpdateBuffEffect_LowRate();
			}
			UpdateFractureDetect();
			UpdateBuffEffect_HighRate();
		}

		private void UpdateBuffEffect_HighRate()
		{
			CalcVelocity();
			CalcTremorHand();
			CalcMaxHealthChanging();
		}

		private void UpdateDelayedBuffList()
		{
			foreach (BuffEffectWithDelayTime delayedBuff in DelayedBuffList)
			{
				delayedBuff.LastTime -= UpdateRate;
			}
			foreach (BuffEffectWithDelayTime delayedBuff2 in DelayedBuffList)
			{
				if (delayedBuff2.LastTime <= 0f)
				{
					AssignNewBuffEffect(delayedBuff2.BE);
					DelayedBuffList.Remove(delayedBuff2);
					break;
				}
			}
		}

		private void UpdateFractureDetect()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Invalid comparison between Unknown and I4
			//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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Invalid comparison between Unknown and I4
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			if (IntoAirHeight == -114514f)
			{
				IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
				return;
			}
			MovementMode mode = GM.CurrentMovementManager.Mode;
			if ((int)mode != 6)
			{
				if ((int)mode != 4)
				{
					IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
					return;
				}
				if (GM.CurrentMovementManager.m_smoothLocoVelocity.y > -4f && !GM.CurrentMovementManager.m_isGrounded)
				{
					IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
				}
				if (GM.CurrentMovementManager.m_isGrounded)
				{
					if (GM.CurrentPlayerBody.Head.position.y < IntoAirHeight && IntoAirHeight - GM.CurrentPlayerBody.Head.position.y > ConfigObj.Config.FractureHeight)
					{
						AssignNewBuffEffect(new BuffEffect
						{
							isFracture = true,
							FractureTime = ConfigObj.Config.FractureTime
						});
					}
					IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
				}
				return;
			}
			if (GM.CurrentMovementManager.m_smoothLocoVelocity.y > -4f && !GM.CurrentMovementManager.m_isGrounded)
			{
				IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
			}
			if (GM.CurrentMovementManager.m_isGrounded)
			{
				if (GM.CurrentPlayerBody.Head.position.y < IntoAirHeight && IntoAirHeight - GM.CurrentPlayerBody.Head.position.y > ConfigObj.Config.FractureHeight)
				{
					AssignNewBuffEffect(new BuffEffect
					{
						isFracture = true,
						FractureTime = ConfigObj.Config.FractureTime
					});
				}
				IntoAirHeight = GM.CurrentPlayerBody.Head.position.y;
			}
		}

		public void UpdateSelf()
		{
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			if (WristMenuAPI.Instance2.m_isActive)
			{
				if (WristMenuAPI.Instance2.m_currentHand.IsThisTheRightHand)
				{
					((Component)this).transform.position = ((Component)WristMenuAPI.Instance2).gameObject.transform.position + ((Component)WristMenuAPI.Instance2).gameObject.transform.forward * -0f + ((Component)WristMenuAPI.Instance2).gameObject.transform.right * -0.3f + ((Component)WristMenuAPI.Instance2).gameObject.transform.up * 0.05f;
					Quaternion val = Quaternion.AngleAxis(-90f, new Vector3(1f, 0f, 0f));
					((Component)this).transform.rotation = ((Component)WristMenuAPI.Instance2).gameObject.transform.rotation * val;
				}
				else
				{
					((Component)this).transform.position = ((Component)WristMenuAPI.Instance2).gameObject.transform.position + ((Component)WristMenuAPI.Instance2).gameObject.transform.forward * -0f + ((Component)WristMenuAPI.Instance2).gameObject.transform.right * 0.1f + ((Component)WristMenuAPI.Instance2).gameObject.transform.up * 0.05f;
					Quaternion val2 = Quaternion.AngleAxis(-90f, new Vector3(1f, 0f, 0f));
					((Component)this).transform.rotation = ((Component)WristMenuAPI.Instance2).gameObject.transform.rotation * val2;
				}
			}
			else
			{
				((Component)this).transform.position = new Vector3(10000f, 10000f, 500f);
			}
		}

		public void UpdateBuffStat()
		{
			if (CurrentBuffEffect.isBleedingKillers)
			{
				CurrentBuffEffect.BleedingKillersTime -= UpdateRate;
				if (CurrentBuffEffect.BleedingKillersTime <= 0f)
				{
					CurrentBuffEffect.BleedingKillersTime = 0f;
					CurrentBuffEffect.isBleedingKillers = false;
				}
			}
			if (CurrentBuffEffect.isLowHealthKillers)
			{
				CurrentBuffEffect.LowHealthKillersTime -= UpdateRate;
				if (CurrentBuffEffect.LowHealthKillersTime <= 0f)
				{
					CurrentBuffEffect.LowHealthKillersTime = 0f;
					CurrentBuffEffect.isLowHealthKillers = false;
				}
			}
			if (CurrentBuffEffect.isTremor)
			{
				CurrentBuffEffect.TremorTime -= UpdateRate;
				if (CurrentBuffEffect.TremorTime <= 0f)
				{
					CurrentBuffEffect.TremorTime = 0f;
					CurrentBuffEffect.isTremor = false;
				}
			}
			if (CurrentBuffEffect.isFracture)
			{
				CurrentBuffEffect.FractureTime -= UpdateRate;
				if (CurrentBuffEffect.FractureTime <= 0f)
				{
					CurrentBuffEffect.FractureTime = 0f;
					CurrentBuffEffect.isFracture = false;
				}
			}
			if (CurrentBuffEffect.isTunnelvision)
			{
				CurrentBuffEffect.TunnelvisionTime -= UpdateRate;
				if (CurrentBuffEffect.TunnelvisionTime <= 0f)
				{
					CurrentBuffEffect.TunnelvisionTime = 0f;
					CurrentBuffEffect.isTunnelvision = false;
				}
			}
			if (CurrentBuffEffect.isPainkillers)
			{
				CurrentBuffEffect.PainkillersTime -= UpdateRate;
				if (CurrentBuffEffect.PainkillersTime <= 0f)
				{
					CurrentBuffEffect.PainkillersTime = 0f;
					CurrentBuffEffect.isPainkillers = false;
				}
			}
			LevelBuffListUpdate(CurrentBuffEffect.PainList);
			LevelBuffListUpdate(CurrentBuffEffect.BleedingList);
			LevelBuffListUpdate(CurrentBuffEffect.SpeedUpList);
			LevelBuffListUpdate(CurrentBuffEffect.StrengthUpList);
			LevelBuffListUpdate(CurrentBuffEffect.ContinuedHealList);
			LevelBuffListUpdate(CurrentBuffEffect.DamageResistList);
			LevelBuffListUpdate(CurrentBuffEffect.DamageScalerList);
			LevelBuffListUpdate(CurrentBuffEffect.AddMaxHealthList);
		}

		public void UpdateLevelBuffInfomation()
		{
			GetTotalLevelFromList(CurrentBuffEffect.DamageResistList, ConfigObj.Config.DamageResistMinLevel, ConfigObj.Config.DamageResistMaxLevel, out ThisFrameDamageResistLevel, out ThisFrameDamageResistTime);
			GetTotalLevelFromList(CurrentBuffEffect.StrengthUpList, ConfigObj.Config.StrengthUpMinLevel, ConfigObj.Config.StrengthUpMaxLevel, out ThisFrameStrengthUpLevel, out ThisFrameStrengthUpTime);
			GetTotalLevelFromList(CurrentBuffEffect.DamageScalerList, ConfigObj.Config.DamageScalerMinLevel, ConfigObj.Config.DamageScalerMaxLevel, out ThisFrameDamageScalerLevel, out ThisFrameDamageScalerTime);
			GetTotalLevelFromList(CurrentBuffEffect.AddMaxHealthList, ConfigObj.Config.AddMaxHealthMinLevel, ConfigObj.Config.AddMaxHealthMaxLevel, out ThisFrameAddMaxHealthLevel, out ThisFrameAddMaxHealthTime);
			GetTotalLevelFromList(CurrentBuffEffect.SpeedUpList, ConfigObj.Config.SpeedUpMinLevel, ConfigObj.Config.SpeedUpMaxLevel, out ThisFrameSpeedUpLevel, out ThisFrameSpeedUpTime);
			GetTotalLevelFromList(CurrentBuffEffect.BleedingList, 0, ConfigObj.Config.BleedingMaxLevel, out ThisFrameBleedingLevel, out ThisFrameBleedingTime);
			GetTotalLevelFromList(CurrentBuffEffect.ContinuedHealList, ConfigObj.Config.ContinuedHealMinLevel, ConfigObj.Config.ContinuedHealMaxLevel, out ThisFrameContinuedHealLevel, out ThisFrameContinuedHealTime);
			GetTotalLevelFromList(CurrentBuffEffect.PainList, 0, 5, out ThisFramePainLevel, out ThisFramePainTime);
		}

		public void UpdateBuffEffect_LowRate()
		{
			CalcStrengthUpBuff();
			CalcBleeding();
			CalcContinuedHeal();
			CalcLowHealthEffect();
			CalcPainEffect();
			CalcTremorEffect();
			CalcTunnelvisionEffect();
			CalcPainkillerEffect();
			CalcDamageScalerBuff();
		}

		private void PowerupEvent(PowerupType type)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected I4, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected I4, but got Unknown
			if (GlobalBuffItemList.GetInstance().List.ContainsKey((int)type))
			{
				BuffItem buffItem = GlobalBuffItemList.GetInstance().List[(int)type];
				if ((double)buffItem.DelayedEffectTime > 0.0)
				{
					BuffEffectWithDelayTime buffEffectWithDelayTime = new BuffEffectWithDelayTime();
					buffEffectWithDelayTime.LastTime = buffItem.DelayedEffectTime;
					buffEffectWithDelayTime.BE = buffItem.DelayedEffect;
					DelayedBuffList.Add(buffEffectWithDelayTime);
				}
				BuffEffect effect = buffItem.Effect;
				AssignNewBuffEffect(effect);
			}
		}

		private void DeathEvent(bool killedself)
		{
			ResetCurrentBuffEffect();
		}

		public void DamageEvent(float percentOfLife)
		{
			float percentOfLifeAffterBuffSystem = CalcHealthWhenGetDamage(ThisFrameDamageResistLevel, percentOfLife);
			CalcDebuffWhenGetDamage(0, percentOfLifeAffterBuffSystem);
			LastDamageTime = Time.timeSinceLevelLoad;
		}

		public void LevelBuffListUpdate(List<LevelBuff> TargetList)
		{
			for (int i = 0; i < TargetList.Count; i++)
			{
				LevelBuff levelBuff = TargetList[i];
				LevelBuff value = levelBuff;
				if (value.Enable)
				{
					value.Time -= UpdateRate;
					if (value.Time <= 0f)
					{
						value.Time = 0f;
						value.Enable = false;
					}
				}
				TargetList[i] = value;
			}
			foreach (LevelBuff Target in TargetList)
			{
				if (!Target.Enable)
				{
					TargetList.Remove(Target);
					break;
				}
			}
		}

		private void GetTotalLevelFromList(List<LevelBuff> TargetBuffList, int Min, int Max, out int TotalLevel, out float MaximumTime)
		{
			int num = 0;
			float num2 = 0f;
			foreach (LevelBuff TargetBuff in TargetBuffList)
			{
				num += TargetBuff.Level;
				num2 = Mathf.Max(num2, TargetBuff.Time);
			}
			num = Mathf.Clamp(num, Min, Max);
			TotalLevel = num;
			MaximumTime = num2;
		}

		private void CalcStrengthUpBuff()
		{
			int thisFrameStrengthUpLevel = ThisFrameStrengthUpLevel;
			if (thisFrameStrengthUpLevel > 0)
			{
				float num = 1f + (float)thisFrameStrengthUpLevel * 0.65f;
				if (GM.CurrentPlayerBody.m_buffTime_MuscleMeat <= 0.1f || GM.CurrentPlayerBody.m_muscleMeatPower < num)
				{
					GM.CurrentPlayerBody.m_muscleMeatPower = num;
					GM.CurrentPlayerBody.m_isMuscleMeat = true;
					GM.CurrentPlayerBody.m_isWeakMeat = false;
					GM.CurrentPlayerBody.m_buffTime_MuscleMeat = 1f;
				}
			}
			else if (thisFrameStrengthUpLevel < 0)
			{
				float num2 = 1f * Mathf.Pow(0.8f, (float)Mathf.Abs(thisFrameStrengthUpLevel));
				if (GM.CurrentPlayerBody.m_debuffTime_WeakMeat <= 0.1f || GM.CurrentPlayerBody.m_muscleMeatPower > num2)
				{
					GM.CurrentPlayerBody.m_muscleMeatPower = num2;
					GM.CurrentPlayerBody.m_isMuscleMeat = false;
					GM.CurrentPlayerBody.m_isWeakMeat = true;
					GM.CurrentPlayerBody.m_debuffTime_WeakMeat = 1f;
				}
			}
		}

		private void CalcDamageScalerBuff()
		{
			int thisFrameDamageScalerLevel = ThisFrameDamageScalerLevel;
			if (thisFrameDamageScalerLevel > 0)
			{
				float num = 1f + (float)thisFrameDamageScalerLevel * ConfigObj.Config.DamageScalerPerLevelUp;
				if (GM.CurrentPlayerBody.m_buffTime_DamPowerUp <= 0.1f || GM.CurrentPlayerBody.m_damageMult < num)
				{
					GM.CurrentPlayerBody.m_damageMult = num;
					GM.CurrentPlayerBody.m_isDamPowerUp = true;
					GM.CurrentPlayerBody.m_isDamPowerDown = false;
					GM.CurrentPlayerBody.m_buffTime_DamPowerUp = 1f;
				}
			}
			else if (thisFrameDamageScalerLevel < 0)
			{
				float num2 = 1f * Mathf.Pow(ConfigObj.Config.DamageScalerPerLevelDownPercent, (float)Mathf.Abs(thisFrameDamageScalerLevel));
				if (GM.CurrentPlayerBody.m_debuffTime_DamPowerDown <= 0.1f || GM.CurrentPlayerBody.m_damageMult > num2)
				{
					GM.CurrentPlayerBody.m_muscleMeatPower = num2;
					GM.CurrentPlayerBody.m_isDamPowerUp = false;
					GM.CurrentPlayerBody.m_isDamPowerDown = true;
					GM.CurrentPlayerBody.m_debuffTime_DamPowerDown = 1f;
				}
			}
		}

		private float CalcHealthWhenGetDamage(int ThisDamageEventTotalDamageResist, float damagepercentOfLife)
		{
			float health = GM.CurrentPlayerBody.Health;
			float num = GM.CurrentPlayerBody.m_startingHealth * damagepercentOfLife * (float)ThisDamageEventTotalDamageResist * ConfigObj.Config.DamageResistPerLevelEffectPercent;
			health += num;
			if (health >= GM.CurrentPlayerBody.m_startingHealth)
			{
				health = GM.CurrentPlayerBody.m_startingHealth;
			}
			GM.CurrentPlayerBody.Health = health;
			return damagepercentOfLife - num / GM.CurrentPlayerBody.m_startingHealth;
		}

		private void CalcDebuffWhenGetDamage(int ThisDamageEventArmorLevel, float percentOfLifeAffterBuffSystem)
		{
			if (Time.timeSinceLevelLoad - LastDamageTime >= 0f && Time.timeSinceLevelLoad - LastDamageTime <= ConfigObj.Config.MultShotBleedingMaxInterval && ThisDamageEventArmorLevel <= 4)
			{
				Random random = new Random();
				int num = random.Next(0, 100);
				if (num <= ConfigObj.Config.MultShotBleedingChance)
				{
					BuffEffect targetBE = default(BuffEffect);
					targetBE.Bleeding.Enable = true;
					targetBE.Bleeding.Level = ConfigObj.Config.MultShotBleedingLevel;
					targetBE.Bleeding.Time = ConfigObj.Config.MultShotBleedingTime;
					AssignNewBuffEffect(targetBE);
				}
			}
			if (ThisDamageEventArmorLevel <= 2)
			{
				bool flag = false;
				Random random2 = new Random();
				int num2 = random2.Next(0, 100);
				if (num2 <= ConfigObj.Config.PerShotBleedingChance)
				{
					BuffEffect targetBE2 = default(BuffEffect);
					targetBE2.Bleeding.Enable = true;
					targetBE2.Bleeding.Level = ConfigObj.Config.PerShotBleedingLevel;
					targetBE2.Bleeding.Time = ConfigObj.Config.PerShotBleedingTime;
					AssignNewBuffEffect(targetBE2);
					flag = true;
				}
				int num3 = random2.Next(0, 100);
				if (num3 <= ConfigObj.Config.LowArmorPerShotPainChance)
				{
					BuffEffect targetBE3 = default(BuffEffect);
					targetBE3.Pain.Enable = true;
					targetBE3.Pain.Level = ConfigObj.Config.LowArmorPerShotPainLevel;
					targetBE3.Pain.Time = ConfigObj.Config.LowArmorPerShotPainTime;
					AssignNewBuffEffect(targetBE3);
					if (!CurrentBuffEffect.isPainkillers)
					{
						int num4 = random2.Next(0, 100);
						if (num4 <= ConfigObj.Config.LowArmorPerShotSpeedDownChance)
						{
							BuffEffect targetBE4 = default(BuffEffect);
							targetBE4.SpeedUp.Enable = true;
							targetBE4.SpeedUp.Level = ConfigObj.Config.LowArmorPerShotSpeedDownLevel;
							targetBE4.SpeedUp.Time = ConfigObj.Config.LowArmorPerShotSpeedDownTime;
							AssignNewBuffEffect(targetBE4);
						}
					}
					flag = true;
				}
				if (flag)
				{
					VoiceSystem.PlayHitPainAudio();
				}
			}
			else if (ThisDamageEventArmorLevel <= 4)
			{
				bool flag2 = false;
				Random random3 = new Random();
				int num5 = random3.Next(0, 100);
				if (num5 <= ConfigObj.Config.HighArmorPerShotPainChance)
				{
					BuffEffect targetBE5 = default(BuffEffect);
					targetBE5.Pain.Enable = true;
					targetBE5.Pain.Level = ConfigObj.Config.HighArmorPerShotPainLevel;
					targetBE5.Pain.Time = ConfigObj.Config.HighArmorPerShotPainTime;
					AssignNewBuffEffect(targetBE5);
					if (!CurrentBuffEffect.isPainkillers)
					{
						int num6 = random3.Next(0, 100);
						if (num6 <= ConfigObj.Config.HighArmorPerShotSpeedDownChance)
						{
							BuffEffect targetBE6 = default(BuffEffect);
							targetBE6.SpeedUp.Enable = true;
							targetBE6.SpeedUp.Level = ConfigObj.Config.HighArmorPerShotSpeedDownLevel;
							targetBE6.SpeedUp.Time = ConfigObj.Config.HighArmorPerShotSpeedDownTime;
							AssignNewBuffEffect(targetBE6);
						}
					}
					flag2 = true;
				}
				if (flag2)
				{
					VoiceSystem.PlayHitPainAudio();
				}
			}
			AssignNewBuffEffect(new BuffEffect
			{
				MaxHealthReducePercent = percentOfLifeAffterBuffSystem * ConfigObj.Config.PerShotMaxHealthReducePercentOfDamage
			});
		}

		private void CalcMaxHealthChanging()
		{
			float num = 1f;
			num += (float)ThisFrameAddMaxHealthLevel * ConfigObj.Config.AddMaxHealthPerLevelEffect;
			num -= CurrentBuffEffect.MaxHealthReducePercent;
			GM.CurrentPlayerBody.m_startingHealth = StoredPlayerMaxHealth * num;
			CurrentPlayerMaxHealth = GM.CurrentPlayerBody.m_startingHealth;
		}

		private void CalcVelocity()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: 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_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			ThisFrameInitial2AxisVelocity = GM.CurrentMovementManager.m_smoothLocoVelocity;
			ThisFrameInitialSwingArmVelocity = GM.CurrentMovementManager.m_smoothLocoVelocity;
			Vector3 zero = Vector3.zero;
			if (CurrentBuffEffect.isFracture)
			{
				zero.x -= ConfigObj.Config.FractureEffect;
				zero.y -= ConfigObj.Config.FractureEffect;
				zero.z -= ConfigObj.Config.FractureEffect;
			}
			float num = (float)ThisFrameSpeedUpLevel * ConfigObj.Config.SpeedUpPerLevelEffect;
			zero.x += num;
			zero.z += num;
			float num2 = (float)ThisFrameStrengthUpLevel * 0.2f;
			zero.y += Mathf.Clamp(num2, -1f, 1f);
			Vector3 val = zero;
			if (!GM.CurrentMovementManager.m_isGrounded)
			{
				val.x *= 0f;
				val.y *= 0.015f;
				val.z *= 0f;
			}
			val += Vector3.one;
			val.x = Mathf.Max(val.x, 0.2f);
			val.y = Mathf.Max(val.y, 0.05f);
			val.z = Mathf.Max(val.z, 0.2f);
			ref Vector3 thisFrameInitial2AxisVelocity = ref ThisFrameInitial2AxisVelocity;
			thisFrameInitial2AxisVelocity.x *= val.x;
			if (ThisFrameInitial2AxisVelocity.y > 0f)
			{
				ref Vector3 thisFrameInitial2AxisVelocity2 = ref ThisFrameInitial2AxisVelocity;
				thisFrameInitial2AxisVelocity2.y *= val.y;
			}
			ref Vector3 thisFrameInitial2AxisVelocity3 = ref ThisFrameInitial2AxisVelocity;
			thisFrameInitial2AxisVelocity3.z *= val.z;
			Vector3 val2 = zero;
			if (!GM.CurrentMovementManager.m_isGrounded)
			{
				val2.x *= 0f;
				val2.y *= 0.015f;
				val2.z *= 0f;
			}
			val2 += Vector3.one;
			val2.x = Mathf.Max(val2.x, 0.2f);
			val2.y = Mathf.Max(val2.y, 0.05f);
			val2.z = Mathf.Max(val2.z, 0.2f);
			ref Vector3 thisFrameInitialSwingArmVelocity = ref ThisFrameInitialSwingArmVelocity;
			thisFrameInitialSwingArmVelocity.x *= val2.x;
			if (ThisFrameInitialSwingArmVelocity.y > 0f)
			{
				ref Vector3 thisFrameInitialSwingArmVelocity2 = ref ThisFrameInitialSwingArmVelocity;
				thisFrameInitialSwingArmVelocity2.y *= val2.y;
			}
			ref Vector3 thisFrameInitialSwingArmVelocity3 = ref ThisFrameInitialSwingArmVelocity;
			thisFrameInitialSwingArmVelocity3.z *= val2.z;
			GM.CurrentMovementManager.m_smoothLocoVelocity = ThisFrameInitial2AxisVelocity;
			GM.CurrentMovementManager.m_smoothLocoVelocity = ThisFrameInitialSwingArmVelocity;
		}

		private void CalcBleeding()
		{
			if ((float)ThisFrameBleedingLevel > 0f)
			{
				float health = GM.CurrentPlayerBody.Health;
				health -= 5000f * UpdateRate * (float)ThisFrameBleedingLevel * 0.01f * ConfigObj.Config.BleedingPerLevelEffect;
				if (health <= 1f)
				{
					if (ConfigObj.Config.BleedingCauseDead)
					{
						GM.CurrentPlayerBody.KillPlayer(false);
					}
					else
					{
						health = 1f;
					}
				}
				SetBleedingEffectPost((float)ThisFrameBleedingLevel * 0.2f);
				GM.CurrentPlayerBody.Health = health;
			}
			else
			{
				SetBleedingEffectPost(0f);
			}
		}

		private void CalcContinuedHeal()
		{
			float num = (float)ThisFrameContinuedHealLevel * 0.01f * ConfigObj.Config.ContinuedHealPerLevelEffect;
			if (num != 0f)
			{
				float health = GM.CurrentPlayerBody.Health;
				health += GM.CurrentPlayerBody.m_startingHealth * UpdateRate * num;
				if (health >= GM.CurrentPlayerBody.m_startingHealth)
				{
					health = GM.CurrentPlayerBody.m_startingHealth;
				}
				GM.CurrentPlayerBody.Health = health;
			}
		}

		private void CalcLowHealthEffect()
		{
			float num = GM.CurrentPlayerBody.Health / GM.CurrentPlayerBody.m_startingHealth;
			if (num <= ConfigObj.Config.LowHealthEffectThreshold && !ConfigObj.Config.DisableLowHealthEffect && !CurrentBuffEffect.isLowHealthKillers)
			{
				NeedRefreshLowHealthEffect = true;
				SetLowHealthEffectPost(1f - Mathf.Clamp(num - 0.1f, 0f, 1f) / 0.3f);
			}
			else if (NeedRefreshLowHealthEffect)
			{
				SetLowHealthEffectPost(0f);
				NeedRefreshLowHealthEffect = false;
			}
		}

		private void CalcPainEffect()
		{
			if (CurrentBuffEffect.isPainkillers)
			{
				SetPainEffectPost(0f);
				return;
			}
			float painEffectPost = (float)ThisFramePainLevel * 0.2f;
			SetPainEffectPost(painEffectPost);
		}

		private void CalcTremorEffect()
		{
		}

		private void CalcTremorHand()
		{
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentBuffEffect.isTremor)
			{
				if (TremorSingleShakeTime >= TremorSingleShakeTimeLength)
				{
					TremorSingleShakeTimeLength = Random.Range(0.4f, 0.6f);
					TremorSingleShakeTime = 0f;
					TremorCurrentDirect = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f));
					TremorSingleShakeStrength = Random.Range(0.01f, 0.03f);
				}
				TremorCurrentPath += TremorCurrentDirect * TremorSingleShakeStrength * Time.deltaTime;
				TremorCurrentPath = ((Vector3)(ref TremorCurrentPath)).normalized * Mathf.Clamp(((Vector3)(ref TremorCurrentPath)).magnitude, 0f, 0.05f);
				TremorSingleShakeTime += Time.deltaTime;
				GM.CurrentMovementManager.Hands[0].PoseOverride.localPosition = TremorCurrentPath;
				GM.CurrentMovementManager.Hands[1].PoseOverride.localPosition = TremorCurrentPath;
				NeedRefreshTremorOffset = true;
			}
			else
			{
				TremorCurrentDirect = Vector3.zero;
				TremorCurrentPath = Vector3.zero;
				TremorSingleShakeStrength = 0f;
				TremorSingleShakeTime = 0f;
				TremorSingleShakeTimeLength = 0f;
				if (NeedRefreshTremorOffset)
				{
					GM.CurrentMovementManager.Hands[0].PoseOverride.localPosition = TremorLeftHandPosOver;
					GM.CurrentMovementManager.Hands[1].PoseOverride.localPosition = TremorRightHandPosOver;
					NeedRefreshTremorOffset = false;
				}
			}
		}

		private void CalcTunnelvisionEffect()
		{
			if (CurrentBuffEffect.isTunnelvision)
			{
				SetTunnelvisionEffectPost(Enable: true);
			}
			else
			{
				SetTunnelvisionEffectPost(Enable: false);
			}
		}

		private void CalcPainkillerEffect()
		{
			if (CurrentBuffEffect.isPainkillers)
			{
				SetPainkillersEffectPost(Enable: true);
			}
			else
			{
				SetPainkillersEffectPost(Enable: false);
			}
		}

		public void AssignNewBuffEffect(BuffEffect TargetBE)
		{
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			if (TargetBE.isAddHealthPercent)
			{
				FVRPlayerBody currentPlayerBody = GM.CurrentPlayerBody;
				currentPlayerBody.Health += GM.CurrentPlayerBody.m_startingHealth * TargetBE.AddHealthPercent;
				if (GM.CurrentPlayerBody.Health > GM.CurrentPlayerBody.m_startingHealth)
				{
					GM.CurrentPlayerBody.Health = GM.CurrentPlayerBody.m_startingHealth;
				}
			}
			if (TargetBE.isRemoveBleeding)
			{
				CurrentBuffEffect.BleedingList.Clear();
			}
			if (TargetBE.isBleedingKillers)
			{
				CurrentBuffEffect.isBleedingKillers = true;
				CurrentBuffEffect.BleedingKillersTime += TargetBE.BleedingKillersTime;
			}
			if (TargetBE.isLowHealthKillers)
			{
				CurrentBuffEffect.isLowHealthKillers = true;
				CurrentBuffEffect.LowHealthKillersTime += TargetBE.LowHealthKillersTime;
			}
			if (TargetBE.isTremor && !ConfigObj.Config.DisableAllDebuff && !ConfigObj.Config.DisableTremor)
			{
				if (!CurrentBuffEffect.isTremor)
				{
					TremorLeftHandPosOver = GM.CurrentMovementManager.Hands[0].PoseOverride.localPosition;
					TremorRightHandPosOver = GM.CurrentMovementManager.Hands[1].PoseOverride.localPosition;
				}
				CurrentBuffEffect.isTremor = true;
				CurrentBuffEffect.TremorTime += TargetBE.TremorTime;
			}
			if (TargetBE.isFracture && !ConfigObj.Config.DisableAllDebuff && !ConfigObj.Config.DisableFracture)
			{
				CurrentBuffEffect.isFracture = true;
				CurrentBuffEffect.FractureTime += TargetBE.FractureTime;
				if (TargetBE.FractureTime > 0f)
				{
					VoiceSystem.PlayFractureAudio();
				}
			}
			if (TargetBE.isTunnelvision && !ConfigObj.Config.DisableAllDebuff && !ConfigObj.Config.DisableTunnelvision)
			{
				CurrentBuffEffect.isTunnelvision = true;
				CurrentBuffEffect.TunnelvisionTime += TargetBE.TunnelvisionTime;
			}
			if (TargetBE.isPainkillers)
			{
				CurrentBuffEffect.isPainkillers = true;
				CurrentBuffEffect.PainkillersTime += TargetBE.PainkillersTime;
			}
			if (TargetBE.isRemovePain)
			{
				CurrentBuffEffect.PainList.Clear();
			}
			if (TargetBE.Pain.Enable && !ConfigObj.Config.DisableAllDebuff && !ConfigObj.Config.DisablePain)
			{
				CurrentBuffEffect.PainList.Add(TargetBE.Pain);
			}
			if (TargetBE.Bleeding.Enable && !ConfigObj.Config.DisableAllDebuff && !ConfigObj.Config.DisableBleeding && !CurrentBuffEffect.isBleedingKillers)
			{
				CurrentBuffEffect.BleedingList.Add(TargetBE.Bleeding);
			}
			if (TargetBE.SpeedUp.Enable)
			{
				CurrentBuffEffect.SpeedUpList.Add(TargetBE.SpeedUp);
			}
			if (TargetBE.StrengthUp.Enable)
			{
				CurrentBuffEffect.StrengthUpList.Add(TargetBE.StrengthUp);
			}
			if (TargetBE.ContinuedHeal.Enable)
			{
				CurrentBuffEffect.ContinuedHealList.Add(TargetBE.ContinuedHeal);
			}
			if (TargetBE.DamageResist.Enable)
			{
				CurrentBuffEffect.DamageResistList.Add(TargetBE.DamageResist);
			}
			if (TargetBE.DamageScaler.Enable)
			{
				CurrentBuffEffect.DamageScalerList.Add(TargetBE.DamageScaler);
			}
			if (TargetBE.AddMaxHealth.Enable)
			{
				CurrentBuffEffect.AddMaxHealthList.Add(TargetBE.AddMaxHealth);
			}
			if (Mathf.Abs(TargetBE.MaxHealthReducePercent) > 0f && !ConfigObj.Config.DisableMaxHealthReduce)
			{
				CurrentBuffEffect.MaxHealthReducePercent = Mathf.Max(CurrentBuffEffect.MaxHealthReducePercent + TargetBE.MaxHealthReducePercent, 0f);
				CurrentBuffEffect.MaxHealthReducePercent = Mathf.Min(CurrentBuffEffect.MaxHealthReducePercent, ConfigObj.Config.MaxMaxHealthReducePercent);
			}
		}

		private void SetPainEffectPost(float PainLevel)
		{
			PainCL_rbcount.Value = ((!(PainLevel <= 0f)) ? 6 : 0);
			PainCL_rbdesat.Value = -0.75f * PainLevel;
			PainCL_rbdist.Value = 1.44444f * PainLevel;
			PainCL_brightness.Value = -0.55f * PainLevel;
		}

		private void SetLowHealthEffectPost(float LowHealthLevel)
		{
			LowHealthCL_lowhealthenable.Value = LowHealthLevel;
			LowHealthCL_saturation.Value = -0.55f * LowHealthLevel;
		}

		private void SetTunnelvisionEffectPost(bool Enable)
		{
			TunnelvisionCL_tunnelvisionenable.Value = (Enable ? 1f : 0f);
		}

		private void SetBleedingEffectPost(float BleedingLevel)
		{
			Bleeding_distortsrength.Value = BleedingLevel;
		}

		private void SetTremorEffectPost(bool Enable)
		{
			Tremor_tremorenable.Value = (Enable ? 1f : 0f);
		}

		private void SetPainkillersEffectPost(bool Enable)
		{
			PainkillersCL_brightness.Value = (Enable ? 0.25f : 0f);
			PainkillersCL_lsscale.Value = (Enable ? 1.15f : 0f);
			PainkillersCL_lscount.Value = (Enable ? 1.5f : 0f);
		}
	}
	[BepInPlugin("Ax.EF.BuffSystem.Plugin", "EF.BuffSystem.Plugin", "1.0.1")]
	[BepInDependency("nrgill28.Sodalite", "1.3.2")]
	[BepInProcess("h3vr.exe")]
	public class Plugin : BaseUnityPlugin
	{
		private GameObject BuffSystemManagerGameObject = null;

		private BuffSystemSetting BuffSystemSettings = null;

		private float timer = 0f;

		private float UpdateRate = 0.2f;

		public void Start()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			ReadConfig();
			WristMenuAPI.Buttons.Add(new WristMenuButton("BuffSystemConfig", new ButtonClickEvent(BuffSystemConfig)));
		}

		private void BuffSystemConfig(object sender, ButtonClickEventArgs args)
		{
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (IM.OD.ContainsKey("EF.BuffSystem.ConfigPanel"))
			{
				AnvilCallback<GameObject> gameObjectAsync = ((AnvilAsset)IM.OD["EF.BuffSystem.ConfigPanel"]).GetGameObjectAsync();
				if (Object.op_Implicit((Object)(object)gameObjectAsync.Result))
				{
					GameObject val = Object.Instantiate<GameObject>(gameObjectAsync.Result);
					val.transform.position = GM.CurrentPlayerBody.LeftHand.position;
					val.transform.rotation = GM.CurrentPlayerBody.LeftHand.rotation;
					FVRPhysicalObject component = val.GetComponent<FVRPhysicalObject>();
					((FVRInteractiveObject)component).m_hand = GM.CurrentMovementManager.Hands[0];
					GM.CurrentMovementManager.Hands[0].ForceSetInteractable((FVRInteractiveObject)(object)component);
				}
				else
				{
					Scene activeScene = SceneManager.GetActiveScene();
					Console.Write("BuffSystem:Can't find config system object,please wait for the assets load or report a bug,current scene name : {0}", ((Scene)(ref activeScene)).name);
				}
			}
			else
			{
				Scene activeScene2 = SceneManager.GetActiveScene();
				Console.Write("BuffSystem:Can't find config system object ID,please wait for the assets load or report a bug,current scene name : {0}", ((Scene)(ref activeScene2)).name);
			}
		}

		private void ReadConfig()
		{
			string text = ConfigHelper.CheckEFConfigFolder("BuffSystem");
			if (File.Exists(text + "BuffSystemSettings.xml"))
			{
				BuffSystemSettings = StoreBuffSettingHelper.Read(text + "BuffSystemSettings.xml");
				if (BuffSystemSettings == null)
				{
					BuffSystemSettings = new BuffSystemSetting();
				}
			}
			else
			{
				BuffSystemSettings = new BuffSystemSetting();
			}
			EF_BuffSystem_GlobalObject.GetInstance().Config = BuffSystemSettings;
			StoreBuffSettingHelper.Store(text + "BuffSystemSettings.xml", BuffSystemSettings);
		}

		public void Update()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			timer += Time.deltaTime;
			if (!(timer > UpdateRate))
			{
				return;
			}
			timer -= UpdateRate;
			if (Object.op_Implicit((Object)(object)BuffSystemManagerGameObject))
			{
				return;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (!(((Scene)(ref activeScene)).name != "MainMenu3"))
			{
				return;
			}
			if (IM.OD.ContainsKey("EF.BuffSystem.Manager"))
			{
				AnvilCallback<GameObject> gameObjectAsync = ((AnvilAsset)IM.OD["EF.BuffSystem.Manager"]).GetGameObjectAsync();
				if (Object.op_Implicit((Object)(object)gameObjectAsync.Result))
				{
					BuffSystemManagerGameObject = Object.Instantiate<GameObject>(gameObjectAsync.Result);
					BuffSystemManagerGameObject.transform.position = new Vector3(0f, 10000f, 0f);
					BuffSystemManagerGameObject.transform.rotation = Quaternion.identity;
					Console.Write("BuffSystem:Initialed new buff system object");
				}
				else
				{
					Scene activeScene2 = SceneManager.GetActiveScene();
					Console.Write("BuffSystem:Can't find buff system object,please wait for the assets load or report a bug,current scene name : {0}", ((Scene)(ref activeScene2)).name);
				}
			}
			else
			{
				Scene activeScene3 = SceneManager.GetActiveScene();
				Console.Write("BuffSystem:Can't find buff system object ID,please wait for the assets load or report a bug,current scene name : {0}", ((Scene)(ref activeScene3)).name);
			}
		}
	}
	public static class StoreBuffSettingHelper
	{
		public static void Store(string path, BuffSystemSetting Target)
		{
			XmlSerializer xmlSerializer = new XmlSerializer(typeof(BuffSystemSetting));
			FileStream fileStream = File.OpenWrite(path);
			fileStream.Seek(0L, SeekOrigin.Begin);
			fileStream.SetLength(0L);
			xmlSerializer.Serialize(fileStream, Target);
			fileStream.Flush();
			fileStream.Close();
		}

		public static BuffSystemSetting Read(string path)
		{
			FileStream fileStream = new FileStream(path, FileMode.Open);
			XmlSerializer xmlSerializer = new XmlSerializer(typeof(BuffSystemSetting));
			BuffSystemSetting buffSystemSetting = new BuffSystemSetting();
			buffSystemSetting = (BuffSystemSetting)xmlSerializer.Deserialize(fileStream);
			fileStream.Close();
			return buffSystemSetting;
		}
	}
	public class EF_VoiceSystem : MonoBehaviour
	{
		private float timer = 0f;

		private float UpdateRate = 0.1f;

		public AudioSource HitPainAudioSource;

		public AudioSource BreathAudioSource;

		public AudioSource DeathAudioSource;

		public AudioSource FractureAudioSource;

		public List<AudioClip> HitPainMale = new List<AudioClip>();

		public List<AudioClip> BreathMale = new List<AudioClip>();

		public List<AudioClip> DeathMale = new List<AudioClip>();

		public List<AudioClip> HitPainFemale = new List<AudioClip>();

		public List<AudioClip> BreathFemale = new List<AudioClip>();

		public List<AudioClip> DeathFemale = new List<AudioClip>();

		public List<AudioClip> Fracture = new List<AudioClip>();

		private int CurrentBreathClip = 0;

		private bool isDead = false;

		private bool isMale = true;

		private void Start()
		{
			if (EF_BuffSystem_GlobalObject.GetInstance().Config.IsMale)
			{
				BreathAudioSource.clip = BreathMale[0];
				BreathAudioSource.Play();
				CurrentBreathClip = 0;
			}
			else if (!EF_BuffSystem_GlobalObject.GetInstance().Config.IsMale)
			{
				BreathAudioSource.clip = BreathFemale[0];
				BreathAudioSource.Play();
				CurrentBreathClip = 0;
			}
			isDead = false;
		}

		private void Update()
		{
			if (GM.Curren