Decompiled source of Faithful v1.2.8

Faithful.dll

Decompiled 2 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Huntress.HuntressWeapon;
using EntityStates.Mage;
using Faithful;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using On.EntityStates;
using On.EntityStates.Huntress.HuntressWeapon;
using On.EntityStates.Mage;
using On.RoR2;
using On.RoR2.Items;
using On.RoR2.UI;
using On.RoR2.UI.MainMenu;
using R2API;
using RoR2;
using RoR2.ExpansionManagement;
using RoR2.Navigation;
using RoR2.UI;
using RoR2.UI.MainMenu;
using Unity;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;

[assembly: AssemblyTitle("Faithful")]
[assembly: AssemblyProduct("Faithful")]
[assembly: AssemblyInformationalVersion("1.0.0+986889a481292b181475fb9f1632c8cbc37aae49")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCompany("Faithful")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Faithful
{
	internal static class Assets
	{
		public const string bundleName = "faithfulbundle";

		public static AssetBundle assetBundle;

		public static Material mageJetMaterial;

		public static Wave[] mageJetWaves;

		public static GameObject mageJetAkEventsPrefab;

		public static GameObject radiusIndicatorPrefab;

		public static GameObject pennonEffectPrefab;

		public static GameObject matrixEffectPrefab;

		public static DynamicBone scarfDynamicBone;

		private const string defaultModel = "temporalcubemesh";

		private const string defaultIcon = "textemporalcubeicon";

		private const string defaultConsumedIcon = "textemporalcubeconsumedicon";

		private const string defaultBuffIcon = "texbufftemporalcube";

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(Utils.pluginInfo.Location), "faithfulbundle");

		public static void Init()
		{
			assetBundle = AssetBundle.LoadFromFile(AssetBundlePath);
			if (Utils.debugMode)
			{
				string[] allAssetNames = assetBundle.GetAllAssetNames();
				string[] array = allAssetNames;
				foreach (string text in array)
				{
					Log.Debug("[ASSETS] - Loaded asset '" + text + "'");
				}
			}
			FetchNeededRoR2Resources();
			RiskOfOptionsWrapper.UpdateModIcon();
		}

		private static void FetchNeededRoR2Resources()
		{
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0541: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_063d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0736: Unknown result type (might be due to invalid IL or missing references)
			//IL_077d: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_080b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0852: Unknown result type (might be due to invalid IL or missing references)
			//IL_0899: Unknown result type (might be due to invalid IL or missing references)
			//IL_090e: Unknown result type (might be due to invalid IL or missing references)
			//IL_093c: Unknown result type (might be due to invalid IL or missing references)
			//IL_096a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0998: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a01: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a06: Unknown result type (might be due to invalid IL or missing references)
			mageJetMaterial = Object.Instantiate<Material>(((Renderer)((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/MageBody").GetComponent<Transform>().Find("ModelBase")
				.Find("mdlMage")
				.Find("MageArmature")
				.Find("ROOT")
				.Find("base")
				.Find("stomach")
				.Find("chest")
				.Find("Jets, Right")).GetComponent<MeshRenderer>()).material);
			mageJetMaterial.SetTexture("_RemapTex", GetTexture("texRamp4T0NFire"));
			mageJetWaves = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/MageBody").GetComponent<Transform>().Find("ModelBase")
				.Find("mdlMage")
				.Find("MageArmature")
				.Find("ROOT")
				.Find("base")
				.Find("stomach")
				.Find("chest")
				.Find("JetsOn")
				.Find("Point Light")).GetComponent<FlickerLight>().sinWaves;
			GameObject val = Object.Instantiate<GameObject>(((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/MageBody").transform.Find("ModelBase").Find("mdlMage").Find("MageArmature")
				.Find("ROOT")
				.Find("base")
				.Find("stomach")
				.Find("chest")
				.Find("JetsOn")).gameObject);
			mageJetAkEventsPrefab = PrefabAPI.InstantiateClone(val, "faithfulMageJetAkEvents");
			Object.DestroyImmediate((Object)(object)val);
			Object.DestroyImmediate((Object)(object)((Component)mageJetAkEventsPrefab.transform.Find("Fire")).gameObject);
			Object.DestroyImmediate((Object)(object)((Component)mageJetAkEventsPrefab.transform.Find("Point Light")).gameObject);
			Object.DestroyImmediate((Object)(object)((Component)mageJetAkEventsPrefab.transform.Find("JetsL")).gameObject);
			Object.DestroyImmediate((Object)(object)((Component)mageJetAkEventsPrefab.transform.Find("JetsR")).gameObject);
			Object.DestroyImmediate((Object)(object)((Component)mageJetAkEventsPrefab.transform.Find("FireRing")).gameObject);
			mageJetAkEventsPrefab.transform.SetParent((Transform)null);
			mageJetAkEventsPrefab.transform.position = Vector3.zero;
			mageJetAkEventsPrefab.transform.localEulerAngles = Vector3.zero;
			mageJetAkEventsPrefab.transform.localScale = Vector3.zero;
			Object.DestroyImmediate((Object)(object)mageJetAkEventsPrefab.GetComponent<Rigidbody>());
			GameObject val2 = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/TemporaryVisualEffects/WarbannerBuffEffect"));
			pennonEffectPrefab = PrefabAPI.InstantiateClone(val2, "faithfulLeadersPennonEffect");
			Object.DestroyImmediate((Object)(object)val2);
			((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", new Color(0.5803921f, 0.22745098f, 61f / 85f));
			((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_TintColor", new Color(0.5803921f, 0.22745098f, 61f / 85f));
			((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent<ParticleSystemRenderer>()).material.SetTexture("_RemapTex", GetTexture("texRampPennonBuff"));
			((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent<ParticleSystemRenderer>()).material.SetTexture("_MainTex", GetTexture("texIndicatorPennonMask"));
			((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent<ParticleSystemRenderer>()).material.mainTexture = GetTexture("texIndicatorPennonMask");
			((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("ColoredLightShafts (1)")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", new Color(0.1f, 0f, 2.6384087f));
			((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("ColoredLightShafts (1)")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_TintColor", new Color(0.1f, 0f, 2.6384087f));
			((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("FlarePerst_Ps (1)")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", new Color(0.1f, 0f, 1f));
			((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("FlarePerst_Ps (1)")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_TintColor", new Color(0.1f, 0f, 1f));
			((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("SoftGlow")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", new Color(0.5803921f, 0.22745098f, 1f));
			((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("SoftGlow")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_TintColor", new Color(0.5803921f, 0.22745098f, 1f));
			GameObject val3 = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/TemporaryVisualEffects/WarbannerBuffEffect"));
			matrixEffectPrefab = PrefabAPI.InstantiateClone(val3, "faithfulTargetingMatrixEffect");
			Object.DestroyImmediate((Object)(object)val3);
			((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", new Color(1f, 0f, 0f));
			((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_TintColor", new Color(1f, 0f, 0f));
			((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent<ParticleSystemRenderer>()).material.SetTexture("_RemapTex", GetTexture("texRampPennonBuff"));
			((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent<ParticleSystemRenderer>()).material.SetTexture("_MainTex", GetTexture("texIndicatorMatrixMask"));
			((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent<ParticleSystemRenderer>()).material.mainTexture = GetTexture("texIndicatorMatrixMask");
			((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("ColoredLightShafts (1)")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", new Color(1f, 0f, 0f));
			((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("ColoredLightShafts (1)")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_TintColor", new Color(1f, 0f, 0f));
			((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("FlarePerst_Ps (1)")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", new Color(1f, 0f, 0f));
			((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("FlarePerst_Ps (1)")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_TintColor", new Color(1f, 0f, 0f));
			((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("SoftGlow")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", new Color(1f, 0f, 0f));
			((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("SoftGlow")).GetComponent<ParticleSystemRenderer>()).material.SetColor("_TintColor", new Color(1f, 0f, 0f));
			GameObject val4 = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/NearbyDamageBonusIndicator"));
			radiusIndicatorPrefab = PrefabAPI.InstantiateClone(val4, "faithfulRadiusIndicator");
			Object.DestroyImmediate((Object)(object)val4);
			Object.DestroyImmediate((Object)(object)radiusIndicatorPrefab.GetComponent<NetworkedBodyAttachment>());
			Object.DestroyImmediate((Object)(object)radiusIndicatorPrefab.GetComponent<NetworkIdentity>());
			((Renderer)((Component)radiusIndicatorPrefab.transform.Find("Donut")).GetComponent<MeshRenderer>()).material.SetColor("_Color", Color.white);
			((Renderer)((Component)radiusIndicatorPrefab.transform.Find("Donut")).GetComponent<MeshRenderer>()).material.SetColor("_TintColor", Color.white);
			((Renderer)((Component)radiusIndicatorPrefab.transform.Find("Radius, Spherical")).GetComponent<MeshRenderer>()).material.SetColor("_Color", Color.white);
			((Renderer)((Component)radiusIndicatorPrefab.transform.Find("Radius, Spherical")).GetComponent<MeshRenderer>()).material.SetColor("_TintColor", Color.white);
			radiusIndicatorPrefab.transform.position = Vector3.zero;
			radiusIndicatorPrefab.transform.eulerAngles = Vector3.zero;
			radiusIndicatorPrefab.transform.localScale = new Vector3(1f, 1f, 1f);
			radiusIndicatorPrefab.AddComponent<FaithfulRadiusIndicatorBehaviour>();
			AsyncOperationHandle<GameObject> val5 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/LunarSun/DisplaySunHeadNeck.prefab");
			val5.Completed += OnScarfLoaded;
			if (Utils.debugMode)
			{
				Log.Debug("[ASSETS] - Fetched all needed resources from RoR2 assets.");
			}
		}

		private static void OnScarfLoaded(AsyncOperationHandle<GameObject> _handle)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			if ((int)_handle.Status == 1)
			{
				scarfDynamicBone = Utils.FindChildByName(_handle.Result.transform, "Bandage1").GetComponent<DynamicBone>();
			}
		}

		public static string FindAsset(string _file)
		{
			_file = _file.ToLower();
			string[] allAssetNames = assetBundle.GetAllAssetNames();
			foreach (string text in allAssetNames)
			{
				if (text.ToLower().Contains(_file))
				{
					return text;
				}
			}
			return null;
		}

		public static bool HasAsset(string _name)
		{
			string text = FindAsset(_name);
			return text != null;
		}

		public static void LogRoR2Resources()
		{
			List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>();
			LegacyResourcesAPI.GetAllPathGuidPairs(list);
			foreach (KeyValuePair<string, string> item in list)
			{
				Log.Debug("[ASSETS] - Resource found: '" + item.Key + "' | GUID: " + item.Value);
			}
		}

		public static void FindRoR2Resources(string _searchTerm)
		{
			List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>();
			LegacyResourcesAPI.GetAllPathGuidPairs(list);
			string text = "\n[ASSETS]\n====================\nAttempting to find resources with search term: '" + _searchTerm + "'\n--------------------";
			bool flag = false;
			foreach (KeyValuePair<string, string> item in list)
			{
				if (item.Key.ToUpper().Contains(_searchTerm.ToUpper()))
				{
					flag = true;
					text = text + "\nResource found: '" + item.Key + "' | GUID: " + item.Value;
				}
			}
			text += (flag ? "\n====================" : "\nNo resources found...\n====================");
			Log.Info(text);
		}

		public static Sprite GetIcon(string _name)
		{
			string text = _name + ".png";
			string text2 = FindAsset(text);
			if (text2 == null)
			{
				if (Utils.debugMode)
				{
					Log.Error("Requested asset '" + text + "' could not be found.");
				}
				_name = _name.ToLower();
				return assetBundle.LoadAsset<Sprite>(_name.Contains("buff") ? FindAsset("texbufftemporalcube") : (_name.Contains("consumed") ? FindAsset("textemporalcubeconsumedicon") : FindAsset("textemporalcubeicon")));
			}
			return assetBundle.LoadAsset<Sprite>(text2);
		}

		public static GameObject GetObject(string _name, string _default = null)
		{
			string text = _name + ".prefab";
			string text2 = FindAsset(text);
			if (text2 == null)
			{
				if (Utils.debugMode)
				{
					Log.Error("Requested asset '" + text + "' could not be found.");
				}
				if (_default != null)
				{
					return assetBundle.LoadAsset<GameObject>(_default);
				}
				return null;
			}
			return assetBundle.LoadAsset<GameObject>(text2);
		}

		public static GameObject GetModel(string _name)
		{
			return GetObject(_name, "temporalcubemesh");
		}

		public static Texture GetTexture(string _name)
		{
			string text = _name + ".png";
			string text2 = FindAsset(text);
			if (text2 == null)
			{
				Log.Error("Requested asset '" + text + "' could not be found.");
				return null;
			}
			return assetBundle.LoadAsset<Texture>(text2);
		}

		public static Shader GetShader(string _name)
		{
			string text = _name + ".shader";
			string text2 = FindAsset(text);
			if (text2 == null)
			{
				Log.Error("Requested asset '" + text + "' could not be found.");
				return null;
			}
			return assetBundle.LoadAsset<Shader>(text2);
		}
	}
	internal delegate void Callback();
	internal delegate void InHoldoutZoneCallback(CharacterBody _contained, HoldoutZoneController _zone);
	internal delegate void OnHoldoutZoneStartCallback(HoldoutZoneController _zone);
	internal delegate void OnHoldoutZoneCalcRadiusCallback(ref float _radius, HoldoutZoneController _zone);
	internal delegate void StatsModCallback(int _count, StatHookEventArgs _stats);
	internal delegate void OnIncomingDamageCallback(DamageInfo _report, CharacterMaster _attacker, CharacterMaster _victim);
	internal delegate void DamageReportCallback(DamageReport _report);
	internal delegate void OnAddBuffCallback(BuffIndex _buff, CharacterBody _character);
	internal delegate void OnAddTimedBuffCallback(BuffDef _buff, float _duration, CharacterBody _character);
	internal delegate void OnInflictDamageOverTimeCallback(GameObject _victimObject, GameObject _attackerObject, DotIndex _dotIndex, float _duration, float _damageMultiplier, uint? _maxStacksFromAttacker);
	internal delegate void OnInflictDamageOverTimeRefCallback(ref InflictDotInfo _inflictDotInfo);
	internal delegate void OnTransferItemCallback(Inventory _inventory, ItemIndex _index, int _count);
	internal delegate void OnInventoryCallback(Inventory _inventory);
	internal delegate void OnHealCallback(HealthComponent _healthComponent, ref float _amount, ref ProcChainMask _procChainMask, ref bool _nonRegen);
	internal delegate void CharacterBodyCallback(CharacterBody _body);
	internal delegate void OnPurchaseInteractionBeginCallback(PurchaseInteraction _shop, CharacterMaster _activator);
	internal delegate bool OnPurchaseCanBeAffordedCallback(PurchaseInteraction _shop, CharacterMaster _activator);
	internal delegate void OnProcessJumpCallback(GenericCharacterMain _character);
	internal delegate void PlayerToPlayerCallback(PlayerCharacterMasterController _player1, PlayerCharacterMasterController _player2);
	internal delegate void PlayerHolderToPlayerCallback(int _count, PlayerCharacterMasterController _holder, PlayerCharacterMasterController _other);
	internal delegate void AllyHolderToAllyCallback(int _count, CharacterMaster _holder, CharacterMaster _other);
	internal delegate void GenericCharacterCallback(GenericCharacterMain _character);
	internal static class Behaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Update <0>__HookHoldoutZoneControllerUpdate;

			public static hook_Start <1>__HookHoldoutZoneControllerStart;

			public static hook_Awake <2>__HookCharacterBodyAwake;

			public static hook_Start <3>__HookCharacterBodyStart;

			public static hook_AddBuff_BuffIndex <4>__HookAddBuffIndex;

			public static hook_AddTimedBuff_BuffDef_float <5>__HookAddTimedBuffDef;

			public static hook_GiveItem_ItemIndex_int <6>__HookServerGiveItem;

			public static hook_RemoveItem_ItemIndex_int <7>__HookServerRemoveItem;

			public static hook_HandleInventoryChanged <8>__HookInventoryChanged;

			public static hook_RpcItemAdded <9>__HookItemAdded;

			public static hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 <10>__HookInflictDamageOverTime;

			public static hook_InflictDot_refInflictDotInfo <11>__HookInflictDamageOverTimeRef;

			public static hook_Awake <12>__HookHealthComponentAwake;

			public static hook_Heal <13>__HookHeal;

			public static hook_RecalculateStats <14>__HookRecalculateStats;

			public static hook_UpdateAllTemporaryVisualEffects <15>__HookUpdateVisualEffects;

			public static hook_FixedUpdate <16>__HookCharacterBodyFixedUpdate;

			public static hook_OnInteractionBegin <17>__HookPurchaseInteractionBegin;

			public static hook_CanBeAffordedByInteractor <18>__HookPurchaseCanBeAfforded;

			public static hook_ProcessJump <19>__HookProcessJump;

			public static hook_FixedUpdate <20>__HookGenericCharacterFixedUpdate;

			public static StatHookEventHandler <21>__HookStatsMod;

			public static Action<DamageReport> <22>__HookOnDamageDealt;

			public static Action<DamageReport> <23>__HookOnCharacterDeath;
		}

		private static bool enabled = false;

		internal static GameObject characterBodyHelperPrefab;

		private static List<Callback> updateCallbacks = new List<Callback>();

		private static List<Callback> debugUpdateCallbacks = new List<Callback>();

		private static List<Callback> fixedUpdateCallbacks = new List<Callback>();

		private static List<Callback> debugFixedUpdateCallbacks = new List<Callback>();

		private static List<InHoldoutZoneCallback> inHoldoutZoneCallbacks = new List<InHoldoutZoneCallback>();

		private static List<OnHoldoutZoneStartCallback> onHoldoutZoneStartCallbacks = new List<OnHoldoutZoneStartCallback>();

		private static List<OnHoldoutZoneCalcRadiusCallback> onHoldoutZoneCalcRadiusCallbacks = new List<OnHoldoutZoneCalcRadiusCallback>();

		private static List<ItemStatsMod> itemStatsMods = new List<ItemStatsMod>();

		private static List<BuffStatsMod> buffStatsMods = new List<BuffStatsMod>();

		private static List<OnIncomingDamageCallback> onIncomingDamageCallbacks = new List<OnIncomingDamageCallback>();

		private static List<DamageReportCallback> onDamageDealtCallbacks = new List<DamageReportCallback>();

		private static List<DamageReportCallback> onCharacterDeathCallbacks = new List<DamageReportCallback>();

		private static List<OnAddBuffCallback> onAddBuffCallbacks = new List<OnAddBuffCallback>();

		private static List<OnAddTimedBuffCallback> onAddTimedBuffCallbacks = new List<OnAddTimedBuffCallback>();

		private static List<OnInflictDamageOverTimeCallback> onInflictDamageOverTimeCallbacks = new List<OnInflictDamageOverTimeCallback>();

		private static List<OnInflictDamageOverTimeRefCallback> onInflictDamageOverTimeRefCallbacks = new List<OnInflictDamageOverTimeRefCallback>();

		private static List<OnTransferItemCallback> onGiveItemCallbacks = new List<OnTransferItemCallback>();

		private static List<OnTransferItemCallback> onRemoveItemCallbacks = new List<OnTransferItemCallback>();

		private static List<OnInventoryCallback> onInventoryChangedCallbacks = new List<OnInventoryCallback>();

		private static Dictionary<ItemDef, List<OnInventoryCallback>> onItemAddedCallbacks = new Dictionary<ItemDef, List<OnInventoryCallback>>();

		private static List<OnHealCallback> onHealCallbacks = new List<OnHealCallback>();

		private static List<CharacterBodyCallback> onCharacterBodyAwakeCallbacks = new List<CharacterBodyCallback>();

		private static List<CharacterBodyCallback> onCharacterBodyStartCallbacks = new List<CharacterBodyCallback>();

		private static List<CharacterBodyCallback> onRecalculateStatsCallbacks = new List<CharacterBodyCallback>();

		private static List<CharacterBodyCallback> onUpdateVisualEffectsCallbacks = new List<CharacterBodyCallback>();

		private static List<CharacterBodyCallback> onCharacterBodyFixedUpdateCallbacks = new List<CharacterBodyCallback>();

		private static List<OnPurchaseInteractionBeginCallback> onPurchaseInteractionBeginCallbacks = new List<OnPurchaseInteractionBeginCallback>();

		private static List<OnPurchaseCanBeAffordedCallback> onPurchaseCanBeAffordedCallbacks = new List<OnPurchaseCanBeAffordedCallback>();

		private static List<OnProcessJumpCallback> onProcessJumpCallbacks = new List<OnProcessJumpCallback>();

		private static List<PlayerToPlayerCallback> playerToPlayerCallbacks = new List<PlayerToPlayerCallback>();

		private static List<PlayerItemToPlayer> playerItemToPlayerCallbacks = new List<PlayerItemToPlayer>();

		private static List<PlayerBuffToPlayer> playerBuffToPlayerCallbacks = new List<PlayerBuffToPlayer>();

		private static List<AllyItemToAlly> allyItemToAllyCallbacks = new List<AllyItemToAlly>();

		private static List<AllyBuffToAlly> allyBuffToAllyCallbacks = new List<AllyBuffToAlly>();

		private static List<GenericCharacterCallback> genericCharacterFixedUpdateCallbacks = new List<GenericCharacterCallback>();

		public static void Init()
		{
			CreatePrefabs();
			Enable();
			DebugLog("Behaviour initialised");
		}

		public static void Enable()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//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_00b4: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Expected O, but got Unknown
			//IL_0190: 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_019b: Expected O, but got Unknown
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			//IL_01f3: 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_01fe: Expected O, but got Unknown
			//IL_0214: 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_021f: Expected O, but got Unknown
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Expected O, but got Unknown
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Expected O, but got Unknown
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Expected O, but got Unknown
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Expected O, but got Unknown
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Expected O, but got Unknown
			if (!enabled)
			{
				enabled = true;
				object obj = <>O.<0>__HookHoldoutZoneControllerUpdate;
				if (obj == null)
				{
					hook_Update val = HookHoldoutZoneControllerUpdate;
					<>O.<0>__HookHoldoutZoneControllerUpdate = val;
					obj = (object)val;
				}
				HoldoutZoneController.Update += (hook_Update)obj;
				object obj2 = <>O.<1>__HookHoldoutZoneControllerStart;
				if (obj2 == null)
				{
					hook_Start val2 = HookHoldoutZoneControllerStart;
					<>O.<1>__HookHoldoutZoneControllerStart = val2;
					obj2 = (object)val2;
				}
				HoldoutZoneController.Start += (hook_Start)obj2;
				object obj3 = <>O.<2>__HookCharacterBodyAwake;
				if (obj3 == null)
				{
					hook_Awake val3 = HookCharacterBodyAwake;
					<>O.<2>__HookCharacterBodyAwake = val3;
					obj3 = (object)val3;
				}
				CharacterBody.Awake += (hook_Awake)obj3;
				object obj4 = <>O.<3>__HookCharacterBodyStart;
				if (obj4 == null)
				{
					hook_Start val4 = HookCharacterBodyStart;
					<>O.<3>__HookCharacterBodyStart = val4;
					obj4 = (object)val4;
				}
				CharacterBody.Start += (hook_Start)obj4;
				object obj5 = <>O.<4>__HookAddBuffIndex;
				if (obj5 == null)
				{
					hook_AddBuff_BuffIndex val5 = HookAddBuffIndex;
					<>O.<4>__HookAddBuffIndex = val5;
					obj5 = (object)val5;
				}
				CharacterBody.AddBuff_BuffIndex += (hook_AddBuff_BuffIndex)obj5;
				object obj6 = <>O.<5>__HookAddTimedBuffDef;
				if (obj6 == null)
				{
					hook_AddTimedBuff_BuffDef_float val6 = HookAddTimedBuffDef;
					<>O.<5>__HookAddTimedBuffDef = val6;
					obj6 = (object)val6;
				}
				CharacterBody.AddTimedBuff_BuffDef_float += (hook_AddTimedBuff_BuffDef_float)obj6;
				object obj7 = <>O.<6>__HookServerGiveItem;
				if (obj7 == null)
				{
					hook_GiveItem_ItemIndex_int val7 = HookServerGiveItem;
					<>O.<6>__HookServerGiveItem = val7;
					obj7 = (object)val7;
				}
				Inventory.GiveItem_ItemIndex_int += (hook_GiveItem_ItemIndex_int)obj7;
				object obj8 = <>O.<7>__HookServerRemoveItem;
				if (obj8 == null)
				{
					hook_RemoveItem_ItemIndex_int val8 = HookServerRemoveItem;
					<>O.<7>__HookServerRemoveItem = val8;
					obj8 = (object)val8;
				}
				Inventory.RemoveItem_ItemIndex_int += (hook_RemoveItem_ItemIndex_int)obj8;
				object obj9 = <>O.<8>__HookInventoryChanged;
				if (obj9 == null)
				{
					hook_HandleInventoryChanged val9 = HookInventoryChanged;
					<>O.<8>__HookInventoryChanged = val9;
					obj9 = (object)val9;
				}
				Inventory.HandleInventoryChanged += (hook_HandleInventoryChanged)obj9;
				object obj10 = <>O.<9>__HookItemAdded;
				if (obj10 == null)
				{
					hook_RpcItemAdded val10 = HookItemAdded;
					<>O.<9>__HookItemAdded = val10;
					obj10 = (object)val10;
				}
				Inventory.RpcItemAdded += (hook_RpcItemAdded)obj10;
				object obj11 = <>O.<10>__HookInflictDamageOverTime;
				if (obj11 == null)
				{
					hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 val11 = HookInflictDamageOverTime;
					<>O.<10>__HookInflictDamageOverTime = val11;
					obj11 = (object)val11;
				}
				DotController.InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 += (hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1)obj11;
				object obj12 = <>O.<11>__HookInflictDamageOverTimeRef;
				if (obj12 == null)
				{
					hook_InflictDot_refInflictDotInfo val12 = HookInflictDamageOverTimeRef;
					<>O.<11>__HookInflictDamageOverTimeRef = val12;
					obj12 = (object)val12;
				}
				DotController.InflictDot_refInflictDotInfo += (hook_InflictDot_refInflictDotInfo)obj12;
				object obj13 = <>O.<12>__HookHealthComponentAwake;
				if (obj13 == null)
				{
					hook_Awake val13 = HookHealthComponentAwake;
					<>O.<12>__HookHealthComponentAwake = val13;
					obj13 = (object)val13;
				}
				HealthComponent.Awake += (hook_Awake)obj13;
				object obj14 = <>O.<13>__HookHeal;
				if (obj14 == null)
				{
					hook_Heal val14 = HookHeal;
					<>O.<13>__HookHeal = val14;
					obj14 = (object)val14;
				}
				HealthComponent.Heal += (hook_Heal)obj14;
				object obj15 = <>O.<14>__HookRecalculateStats;
				if (obj15 == null)
				{
					hook_RecalculateStats val15 = HookRecalculateStats;
					<>O.<14>__HookRecalculateStats = val15;
					obj15 = (object)val15;
				}
				CharacterBody.RecalculateStats += (hook_RecalculateStats)obj15;
				object obj16 = <>O.<15>__HookUpdateVisualEffects;
				if (obj16 == null)
				{
					hook_UpdateAllTemporaryVisualEffects val16 = HookUpdateVisualEffects;
					<>O.<15>__HookUpdateVisualEffects = val16;
					obj16 = (object)val16;
				}
				CharacterBody.UpdateAllTemporaryVisualEffects += (hook_UpdateAllTemporaryVisualEffects)obj16;
				object obj17 = <>O.<16>__HookCharacterBodyFixedUpdate;
				if (obj17 == null)
				{
					hook_FixedUpdate val17 = HookCharacterBodyFixedUpdate;
					<>O.<16>__HookCharacterBodyFixedUpdate = val17;
					obj17 = (object)val17;
				}
				CharacterBody.FixedUpdate += (hook_FixedUpdate)obj17;
				object obj18 = <>O.<17>__HookPurchaseInteractionBegin;
				if (obj18 == null)
				{
					hook_OnInteractionBegin val18 = HookPurchaseInteractionBegin;
					<>O.<17>__HookPurchaseInteractionBegin = val18;
					obj18 = (object)val18;
				}
				PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj18;
				object obj19 = <>O.<18>__HookPurchaseCanBeAfforded;
				if (obj19 == null)
				{
					hook_CanBeAffordedByInteractor val19 = HookPurchaseCanBeAfforded;
					<>O.<18>__HookPurchaseCanBeAfforded = val19;
					obj19 = (object)val19;
				}
				PurchaseInteraction.CanBeAffordedByInteractor += (hook_CanBeAffordedByInteractor)obj19;
				object obj20 = <>O.<19>__HookProcessJump;
				if (obj20 == null)
				{
					hook_ProcessJump val20 = HookProcessJump;
					<>O.<19>__HookProcessJump = val20;
					obj20 = (object)val20;
				}
				GenericCharacterMain.ProcessJump += (hook_ProcessJump)obj20;
				object obj21 = <>O.<20>__HookGenericCharacterFixedUpdate;
				if (obj21 == null)
				{
					hook_FixedUpdate val21 = HookGenericCharacterFixedUpdate;
					<>O.<20>__HookGenericCharacterFixedUpdate = val21;
					obj21 = (object)val21;
				}
				GenericCharacterMain.FixedUpdate += (hook_FixedUpdate)obj21;
				object obj22 = <>O.<21>__HookStatsMod;
				if (obj22 == null)
				{
					StatHookEventHandler val22 = HookStatsMod;
					<>O.<21>__HookStatsMod = val22;
					obj22 = (object)val22;
				}
				RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj22;
				GlobalEventManager.onServerDamageDealt += HookOnDamageDealt;
				GlobalEventManager.onCharacterDeathGlobal += HookOnCharacterDeath;
			}
		}

		public static void Disable()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_010f: 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_011a: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Expected O, but got Unknown
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			//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_017d: Expected O, but got Unknown
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Expected O, but got Unknown
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Expected O, but got Unknown
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Expected O, but got Unknown
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Expected O, but got Unknown
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Expected O, but got Unknown
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Expected O, but got Unknown
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Expected O, but got Unknown
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Expected O, but got Unknown
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Expected O, but got Unknown
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Expected O, but got Unknown
			if (enabled)
			{
				enabled = false;
				object obj = <>O.<0>__HookHoldoutZoneControllerUpdate;
				if (obj == null)
				{
					hook_Update val = HookHoldoutZoneControllerUpdate;
					<>O.<0>__HookHoldoutZoneControllerUpdate = val;
					obj = (object)val;
				}
				HoldoutZoneController.Update -= (hook_Update)obj;
				object obj2 = <>O.<1>__HookHoldoutZoneControllerStart;
				if (obj2 == null)
				{
					hook_Start val2 = HookHoldoutZoneControllerStart;
					<>O.<1>__HookHoldoutZoneControllerStart = val2;
					obj2 = (object)val2;
				}
				HoldoutZoneController.Start -= (hook_Start)obj2;
				object obj3 = <>O.<2>__HookCharacterBodyAwake;
				if (obj3 == null)
				{
					hook_Awake val3 = HookCharacterBodyAwake;
					<>O.<2>__HookCharacterBodyAwake = val3;
					obj3 = (object)val3;
				}
				CharacterBody.Awake -= (hook_Awake)obj3;
				object obj4 = <>O.<3>__HookCharacterBodyStart;
				if (obj4 == null)
				{
					hook_Start val4 = HookCharacterBodyStart;
					<>O.<3>__HookCharacterBodyStart = val4;
					obj4 = (object)val4;
				}
				CharacterBody.Start -= (hook_Start)obj4;
				object obj5 = <>O.<4>__HookAddBuffIndex;
				if (obj5 == null)
				{
					hook_AddBuff_BuffIndex val5 = HookAddBuffIndex;
					<>O.<4>__HookAddBuffIndex = val5;
					obj5 = (object)val5;
				}
				CharacterBody.AddBuff_BuffIndex -= (hook_AddBuff_BuffIndex)obj5;
				object obj6 = <>O.<5>__HookAddTimedBuffDef;
				if (obj6 == null)
				{
					hook_AddTimedBuff_BuffDef_float val6 = HookAddTimedBuffDef;
					<>O.<5>__HookAddTimedBuffDef = val6;
					obj6 = (object)val6;
				}
				CharacterBody.AddTimedBuff_BuffDef_float -= (hook_AddTimedBuff_BuffDef_float)obj6;
				object obj7 = <>O.<6>__HookServerGiveItem;
				if (obj7 == null)
				{
					hook_GiveItem_ItemIndex_int val7 = HookServerGiveItem;
					<>O.<6>__HookServerGiveItem = val7;
					obj7 = (object)val7;
				}
				Inventory.GiveItem_ItemIndex_int -= (hook_GiveItem_ItemIndex_int)obj7;
				object obj8 = <>O.<7>__HookServerRemoveItem;
				if (obj8 == null)
				{
					hook_RemoveItem_ItemIndex_int val8 = HookServerRemoveItem;
					<>O.<7>__HookServerRemoveItem = val8;
					obj8 = (object)val8;
				}
				Inventory.RemoveItem_ItemIndex_int -= (hook_RemoveItem_ItemIndex_int)obj8;
				object obj9 = <>O.<8>__HookInventoryChanged;
				if (obj9 == null)
				{
					hook_HandleInventoryChanged val9 = HookInventoryChanged;
					<>O.<8>__HookInventoryChanged = val9;
					obj9 = (object)val9;
				}
				Inventory.HandleInventoryChanged -= (hook_HandleInventoryChanged)obj9;
				object obj10 = <>O.<9>__HookItemAdded;
				if (obj10 == null)
				{
					hook_RpcItemAdded val10 = HookItemAdded;
					<>O.<9>__HookItemAdded = val10;
					obj10 = (object)val10;
				}
				Inventory.RpcItemAdded -= (hook_RpcItemAdded)obj10;
				object obj11 = <>O.<10>__HookInflictDamageOverTime;
				if (obj11 == null)
				{
					hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 val11 = HookInflictDamageOverTime;
					<>O.<10>__HookInflictDamageOverTime = val11;
					obj11 = (object)val11;
				}
				DotController.InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 -= (hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1)obj11;
				object obj12 = <>O.<11>__HookInflictDamageOverTimeRef;
				if (obj12 == null)
				{
					hook_InflictDot_refInflictDotInfo val12 = HookInflictDamageOverTimeRef;
					<>O.<11>__HookInflictDamageOverTimeRef = val12;
					obj12 = (object)val12;
				}
				DotController.InflictDot_refInflictDotInfo -= (hook_InflictDot_refInflictDotInfo)obj12;
				object obj13 = <>O.<12>__HookHealthComponentAwake;
				if (obj13 == null)
				{
					hook_Awake val13 = HookHealthComponentAwake;
					<>O.<12>__HookHealthComponentAwake = val13;
					obj13 = (object)val13;
				}
				HealthComponent.Awake -= (hook_Awake)obj13;
				object obj14 = <>O.<13>__HookHeal;
				if (obj14 == null)
				{
					hook_Heal val14 = HookHeal;
					<>O.<13>__HookHeal = val14;
					obj14 = (object)val14;
				}
				HealthComponent.Heal -= (hook_Heal)obj14;
				object obj15 = <>O.<14>__HookRecalculateStats;
				if (obj15 == null)
				{
					hook_RecalculateStats val15 = HookRecalculateStats;
					<>O.<14>__HookRecalculateStats = val15;
					obj15 = (object)val15;
				}
				CharacterBody.RecalculateStats -= (hook_RecalculateStats)obj15;
				object obj16 = <>O.<15>__HookUpdateVisualEffects;
				if (obj16 == null)
				{
					hook_UpdateAllTemporaryVisualEffects val16 = HookUpdateVisualEffects;
					<>O.<15>__HookUpdateVisualEffects = val16;
					obj16 = (object)val16;
				}
				CharacterBody.UpdateAllTemporaryVisualEffects -= (hook_UpdateAllTemporaryVisualEffects)obj16;
				object obj17 = <>O.<16>__HookCharacterBodyFixedUpdate;
				if (obj17 == null)
				{
					hook_FixedUpdate val17 = HookCharacterBodyFixedUpdate;
					<>O.<16>__HookCharacterBodyFixedUpdate = val17;
					obj17 = (object)val17;
				}
				CharacterBody.FixedUpdate -= (hook_FixedUpdate)obj17;
				object obj18 = <>O.<17>__HookPurchaseInteractionBegin;
				if (obj18 == null)
				{
					hook_OnInteractionBegin val18 = HookPurchaseInteractionBegin;
					<>O.<17>__HookPurchaseInteractionBegin = val18;
					obj18 = (object)val18;
				}
				PurchaseInteraction.OnInteractionBegin -= (hook_OnInteractionBegin)obj18;
				object obj19 = <>O.<18>__HookPurchaseCanBeAfforded;
				if (obj19 == null)
				{
					hook_CanBeAffordedByInteractor val19 = HookPurchaseCanBeAfforded;
					<>O.<18>__HookPurchaseCanBeAfforded = val19;
					obj19 = (object)val19;
				}
				PurchaseInteraction.CanBeAffordedByInteractor -= (hook_CanBeAffordedByInteractor)obj19;
				object obj20 = <>O.<19>__HookProcessJump;
				if (obj20 == null)
				{
					hook_ProcessJump val20 = HookProcessJump;
					<>O.<19>__HookProcessJump = val20;
					obj20 = (object)val20;
				}
				GenericCharacterMain.ProcessJump -= (hook_ProcessJump)obj20;
				object obj21 = <>O.<20>__HookGenericCharacterFixedUpdate;
				if (obj21 == null)
				{
					hook_FixedUpdate val21 = HookGenericCharacterFixedUpdate;
					<>O.<20>__HookGenericCharacterFixedUpdate = val21;
					obj21 = (object)val21;
				}
				GenericCharacterMain.FixedUpdate -= (hook_FixedUpdate)obj21;
				object obj22 = <>O.<21>__HookStatsMod;
				if (obj22 == null)
				{
					StatHookEventHandler val22 = HookStatsMod;
					<>O.<21>__HookStatsMod = val22;
					obj22 = (object)val22;
				}
				RecalculateStatsAPI.GetStatCoefficients -= (StatHookEventHandler)obj22;
				GlobalEventManager.onServerDamageDealt -= HookOnDamageDealt;
				GlobalEventManager.onCharacterDeathGlobal -= HookOnCharacterDeath;
			}
		}

		private static void CreatePrefabs()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			GameObject val = new GameObject("temp GO");
			val.AddComponent<NetworkIdentity>();
			characterBodyHelperPrefab = PrefabAPI.InstantiateClone(val, "faithfulCharacterBodyHelper");
			Object.Destroy((Object)(object)val);
			characterBodyHelperPrefab.AddComponent<FaithfulCharacterBodyBehaviour>();
			characterBodyHelperPrefab.AddComponent<FaithfulTJetpackBehaviour>();
			characterBodyHelperPrefab.AddComponent<FaithfulLeadersPennonBehaviour>();
			characterBodyHelperPrefab.AddComponent<FaithfulTargetingMatrixBehaviour>();
			characterBodyHelperPrefab.AddComponent<FaithfulHermitsShawlBehaviour>();
		}

		public static void Update()
		{
			foreach (Callback updateCallback in updateCallbacks)
			{
				updateCallback();
			}
			if (!Utils.debugMode)
			{
				return;
			}
			foreach (Callback debugUpdateCallback in debugUpdateCallbacks)
			{
				debugUpdateCallback();
			}
		}

		public static void FixedUpdate()
		{
			foreach (Callback fixedUpdateCallback in fixedUpdateCallbacks)
			{
				fixedUpdateCallback();
			}
			if (Utils.debugMode)
			{
				foreach (Callback debugFixedUpdateCallback in debugFixedUpdateCallbacks)
				{
					debugFixedUpdateCallback();
				}
			}
			PlayerOnPlayerFixedUpdate();
			AllyOnAllyFixedUpdate();
		}

		public static void AddUpdateCallback(Callback _callback, bool _debugOnly = false)
		{
			if (_debugOnly)
			{
				debugUpdateCallbacks.Add(_callback);
			}
			else
			{
				updateCallbacks.Add(_callback);
			}
		}

		public static void AddFixedUpdateCallback(Callback _callback, bool _debugOnly = false)
		{
			if (_debugOnly)
			{
				debugFixedUpdateCallbacks.Add(_callback);
			}
			else
			{
				fixedUpdateCallbacks.Add(_callback);
			}
		}

		public static void AddStatsMod(Item _item, StatsModCallback _callback)
		{
			itemStatsMods.Add(new ItemStatsMod(_item, _callback));
			DebugLog("Added stat mods for '" + _item.token + "' item");
		}

		public static void AddStatsMod(Buff _buff, StatsModCallback _callback)
		{
			buffStatsMods.Add(new BuffStatsMod(_buff, _callback));
			DebugLog("Added stat mods for '" + _buff.token + "' buff");
		}

		public static void AddInHoldoutZoneCallback(InHoldoutZoneCallback _callback)
		{
			inHoldoutZoneCallbacks.Add(_callback);
			DebugLog("Added in Holdout Zone behaviour");
		}

		public static void AddOnHoldoutZoneStartCallback(OnHoldoutZoneStartCallback _callback)
		{
			onHoldoutZoneStartCallbacks.Add(_callback);
			DebugLog("Added on Holdout Zone start behaviour");
		}

		public static void AddOnHoldoutZoneCalcRadiusCallback(OnHoldoutZoneCalcRadiusCallback _callback)
		{
			onHoldoutZoneCalcRadiusCallbacks.Add(_callback);
			DebugLog("Added on Holdout Zone calc radius behaviour");
		}

		public static void AddPlayerToPlayerCallback(PlayerToPlayerCallback _callback)
		{
			playerToPlayerCallbacks.Add(_callback);
			DebugLog("Added Player to Player behaviour");
		}

		public static void AddPlayerToPlayerCallback(Item _requiredItem, PlayerHolderToPlayerCallback _callback)
		{
			playerItemToPlayerCallbacks.Add(new PlayerItemToPlayer(_requiredItem, _callback));
			DebugLog("Added Player to Player behaviour");
		}

		public static void AddPlayerToPlayerCallback(Buff _requiredBuff, PlayerHolderToPlayerCallback _callback)
		{
			playerBuffToPlayerCallbacks.Add(new PlayerBuffToPlayer(_requiredBuff, _callback));
			DebugLog("Added Player to Player behaviour");
		}

		public static void AddAllyToAllyCallback(Item _requiredItem, AllyHolderToAllyCallback _callback)
		{
			allyItemToAllyCallbacks.Add(new AllyItemToAlly(_requiredItem, _callback));
			DebugLog("Added Ally to Ally behaviour");
		}

		public static void AddAllyToAllyCallback(Buff _requiredBuff, AllyHolderToAllyCallback _callback)
		{
			allyBuffToAllyCallbacks.Add(new AllyBuffToAlly(_requiredBuff, _callback));
			DebugLog("Added Ally to Ally behaviour");
		}

		public static void AddOnIncomingDamageCallback(OnIncomingDamageCallback _callback)
		{
			onIncomingDamageCallbacks.Add(_callback);
			DebugLog("Added On Incoming Damage behaviour");
		}

		public static void AddOnDamageDealtCallback(DamageReportCallback _callback)
		{
			onDamageDealtCallbacks.Add(_callback);
			DebugLog("Added On Damage Dealt behaviour");
		}

		public static void AddOnCharacterDeathCallback(DamageReportCallback _callback)
		{
			onCharacterDeathCallbacks.Add(_callback);
			DebugLog("Added On Character Death behaviour");
		}

		public static void AddOnAddBuffCallback(OnAddBuffCallback _callback)
		{
			onAddBuffCallbacks.Add(_callback);
			DebugLog("Added On Add Buff behaviour");
		}

		public static void AddOnAddTimedBuffCallback(OnAddTimedBuffCallback _callback)
		{
			onAddTimedBuffCallbacks.Add(_callback);
			DebugLog("Added On Add Timed Buff behaviour");
		}

		public static void AddOnInflictDamageOverTimeCallback(OnInflictDamageOverTimeCallback _callback)
		{
			onInflictDamageOverTimeCallbacks.Add(_callback);
			DebugLog("Added On Inflict Damage Over Time behaviour");
		}

		public static void AddOnInflictDamageOverTimeRefCallback(OnInflictDamageOverTimeRefCallback _callback)
		{
			onInflictDamageOverTimeRefCallbacks.Add(_callback);
			DebugLog("Added On Inflict Damage Over Time Ref behaviour");
		}

		public static void AddServerOnGiveItemCallback(OnTransferItemCallback _callback)
		{
			onGiveItemCallbacks.Add(_callback);
			DebugLog("Added On Give Item behaviour");
		}

		public static void AddServerOnRemoveItemCallback(OnTransferItemCallback _callback)
		{
			onRemoveItemCallbacks.Add(_callback);
			DebugLog("Added On Remove Item behaviour");
		}

		public static void AddOnInventoryChangedCallback(OnInventoryCallback _callback)
		{
			onInventoryChangedCallbacks.Add(_callback);
			DebugLog("Added On Inventory Changed behaviour");
		}

		public static void RemoveOnInventoryChangedCallback(OnInventoryCallback _callback)
		{
			onInventoryChangedCallbacks.Remove(_callback);
			DebugLog("Removed On Inventory Changed behaviour");
		}

		public static void AddOnItemAddedCallback(ItemDef _itemDef, OnInventoryCallback _callback)
		{
			if (onItemAddedCallbacks.ContainsKey(_itemDef))
			{
				onItemAddedCallbacks[_itemDef].Add(_callback);
			}
			else
			{
				onItemAddedCallbacks[_itemDef] = new List<OnInventoryCallback> { _callback };
			}
			DebugLog("Added On Item Added behaviour");
		}

		public static void RemoveOnItemAddedCallback(ItemDef _itemDef, OnInventoryCallback _callback)
		{
			if (onItemAddedCallbacks.ContainsKey(_itemDef))
			{
				onItemAddedCallbacks[_itemDef].Remove(_callback);
				if (onItemAddedCallbacks[_itemDef].Count == 0)
				{
					onItemAddedCallbacks.Remove(_itemDef);
				}
				DebugLog("Removed On Item Added behaviour");
			}
		}

		public static void AddOnHealCallback(OnHealCallback _callback)
		{
			onHealCallbacks.Add(_callback);
			DebugLog("Added On Heal behaviour");
		}

		public static void AddOnCharacterBodyAwakeCallback(CharacterBodyCallback _callback)
		{
			onCharacterBodyAwakeCallbacks.Add(_callback);
			DebugLog("Added On Character Body Awake behaviour");
		}

		public static void AddOnCharacterBodyStartCallback(CharacterBodyCallback _callback)
		{
			onCharacterBodyStartCallbacks.Add(_callback);
			DebugLog("Added On Character Body Start behaviour");
		}

		public static void AddOnRecalculateStatsCallback(CharacterBodyCallback _callback)
		{
			onRecalculateStatsCallbacks.Add(_callback);
			DebugLog("Added On Recalculate Stats behaviour");
		}

		public static void AddOnUpdateVisualEffectsCallback(CharacterBodyCallback _callback)
		{
			onUpdateVisualEffectsCallbacks.Add(_callback);
			DebugLog("Added On Update Visual Effects behaviour");
		}

		public static void AddOnCharacterBodyFixedUpdateCallback(CharacterBodyCallback _callback)
		{
			onCharacterBodyFixedUpdateCallbacks.Add(_callback);
			DebugLog("Added On Character Body Fixed Update behaviour");
		}

		public static void RemoveOnCharacterBodyFixedUpdateCallback(CharacterBodyCallback _callback)
		{
			onCharacterBodyFixedUpdateCallbacks.Remove(_callback);
			DebugLog("Removed On Character Body Fixed Update behaviour");
		}

		public static void AddOnPurchaseInteractionBeginCallback(OnPurchaseInteractionBeginCallback _callback)
		{
			onPurchaseInteractionBeginCallbacks.Add(_callback);
			DebugLog("Added On Purchase Interaction Begin behaviour");
		}

		public static void AddOnPurchaseCanBeAffordedCallback(OnPurchaseCanBeAffordedCallback _callback)
		{
			onPurchaseCanBeAffordedCallbacks.Add(_callback);
			DebugLog("Added On Purchase Can Be Afforded behaviour");
		}

		public static void AddOnProcessJumpCallback(OnProcessJumpCallback _callback)
		{
			onProcessJumpCallbacks.Add(_callback);
			DebugLog("Added On Process Jump behaviour");
		}

		public static void AddGenericCharacterFixedUpdateCallback(GenericCharacterCallback _callback)
		{
			genericCharacterFixedUpdateCallbacks.Add(_callback);
			DebugLog("Added Generic Character Fixed Update behaviour");
		}

		private static void PlayerOnPlayerFixedUpdate()
		{
			List<PlayerCharacterMasterController> players = Utils.GetPlayers();
			foreach (PlayerCharacterMasterController item in players)
			{
				foreach (PlayerItemToPlayer playerItemToPlayerCallback in playerItemToPlayerCallbacks)
				{
					playerItemToPlayerCallback.Process(item, players);
				}
				foreach (PlayerBuffToPlayer playerBuffToPlayerCallback in playerBuffToPlayerCallbacks)
				{
					playerBuffToPlayerCallback.Process(item, players);
				}
				foreach (PlayerCharacterMasterController item2 in players)
				{
					if ((Object)(object)item == (Object)(object)item2)
					{
						continue;
					}
					foreach (PlayerToPlayerCallback playerToPlayerCallback in playerToPlayerCallbacks)
					{
						playerToPlayerCallback(item, item2);
					}
				}
			}
		}

		private static void AllyOnAllyFixedUpdate()
		{
			List<CharacterMaster> charactersForTeam = Utils.GetCharactersForTeam((TeamIndex)1);
			foreach (CharacterMaster item in charactersForTeam)
			{
				foreach (AllyItemToAlly allyItemToAllyCallback in allyItemToAllyCallbacks)
				{
					allyItemToAllyCallback.Process(item, charactersForTeam);
				}
				foreach (AllyBuffToAlly allyBuffToAllyCallback in allyBuffToAllyCallbacks)
				{
					allyBuffToAllyCallback.Process(item, charactersForTeam);
				}
			}
		}

		private static void HookStatsMod(CharacterBody _body, StatHookEventArgs _stats)
		{
			foreach (ItemStatsMod itemStatsMod in itemStatsMods)
			{
				itemStatsMod.Process(_body, _stats);
			}
			foreach (BuffStatsMod buffStatsMod in buffStatsMods)
			{
				buffStatsMod.Process(_body, _stats);
			}
		}

		private static void HookHoldoutZoneControllerUpdate(orig_Update orig, HoldoutZoneController self)
		{
			CharacterBody[] characterBodiesInHoldoutZone = Utils.GetCharacterBodiesInHoldoutZone(self);
			CharacterBody[] array = characterBodiesInHoldoutZone;
			foreach (CharacterBody contained in array)
			{
				foreach (InHoldoutZoneCallback inHoldoutZoneCallback in inHoldoutZoneCallbacks)
				{
					inHoldoutZoneCallback(contained, self);
				}
			}
			orig.Invoke(self);
		}

		private static void HookHoldoutZoneControllerStart(orig_Start orig, HoldoutZoneController self)
		{
			FaithfulHoldoutZoneBehaviour faithfulHoldoutZoneBehaviour = ((Component)self).gameObject.AddComponent<FaithfulHoldoutZoneBehaviour>();
			faithfulHoldoutZoneBehaviour.Init(onHoldoutZoneCalcRadiusCallbacks);
			foreach (OnHoldoutZoneStartCallback onHoldoutZoneStartCallback in onHoldoutZoneStartCallbacks)
			{
				onHoldoutZoneStartCallback(self);
			}
			orig.Invoke(self);
		}

		private static void HookCharacterBodyAwake(orig_Awake orig, CharacterBody self)
		{
			orig.Invoke(self);
			foreach (CharacterBodyCallback onCharacterBodyAwakeCallback in onCharacterBodyAwakeCallbacks)
			{
				onCharacterBodyAwakeCallback(self);
			}
		}

		private static void HookCharacterBodyStart(orig_Start orig, CharacterBody self)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && (Object)(object)self.master != (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(characterBodyHelperPrefab);
				NetworkServer.Spawn(val);
				val.GetComponent<FaithfulCharacterBodyBehaviour>().NetworkcharacterID = ((Component)self).GetComponent<NetworkIdentity>().netId;
			}
			orig.Invoke(self);
			foreach (CharacterBodyCallback onCharacterBodyStartCallback in onCharacterBodyStartCallbacks)
			{
				onCharacterBodyStartCallback(self);
			}
		}

		private static void HookAddBuffIndex(orig_AddBuff_BuffIndex orig, CharacterBody self, BuffIndex buffType)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			foreach (OnAddBuffCallback onAddBuffCallback in onAddBuffCallbacks)
			{
				onAddBuffCallback(buffType, self);
			}
			orig.Invoke(self, buffType);
		}

		private static void HookAddTimedBuffDef(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration)
		{
			foreach (OnAddTimedBuffCallback onAddTimedBuffCallback in onAddTimedBuffCallbacks)
			{
				onAddTimedBuffCallback(buffDef, duration, self);
			}
			orig.Invoke(self, buffDef, duration);
		}

		private static void HookInflictDamageOverTime(orig_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 orig, GameObject victimObject, GameObject attackerObject, DotIndex dotIndex, float duration, float damageMultiplier, uint? maxStacksFromAttacker)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(victimObject, attackerObject, dotIndex, duration, damageMultiplier, maxStacksFromAttacker);
			foreach (OnInflictDamageOverTimeCallback onInflictDamageOverTimeCallback in onInflictDamageOverTimeCallbacks)
			{
				onInflictDamageOverTimeCallback(victimObject, attackerObject, dotIndex, duration, damageMultiplier, maxStacksFromAttacker);
			}
		}

		private static void HookInflictDamageOverTimeRef(orig_InflictDot_refInflictDotInfo orig, ref InflictDotInfo inflictDotInfo)
		{
			foreach (OnInflictDamageOverTimeRefCallback onInflictDamageOverTimeRefCallback in onInflictDamageOverTimeRefCallbacks)
			{
				onInflictDamageOverTimeRefCallback(ref inflictDotInfo);
			}
			orig.Invoke(ref inflictDotInfo);
		}

		private static void HookServerGiveItem(orig_GiveItem_ItemIndex_int orig, Inventory self, ItemIndex itemIndex, int count)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			foreach (OnTransferItemCallback onGiveItemCallback in onGiveItemCallbacks)
			{
				onGiveItemCallback(self, itemIndex, count);
			}
			orig.Invoke(self, itemIndex, count);
		}

		private static void HookServerRemoveItem(orig_RemoveItem_ItemIndex_int orig, Inventory self, ItemIndex itemIndex, int count)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			foreach (OnTransferItemCallback onRemoveItemCallback in onRemoveItemCallbacks)
			{
				onRemoveItemCallback(self, itemIndex, count);
			}
			orig.Invoke(self, itemIndex, count);
		}

		private static void HookInventoryChanged(orig_HandleInventoryChanged orig, Inventory self)
		{
			orig.Invoke(self);
			foreach (OnInventoryCallback onInventoryChangedCallback in onInventoryChangedCallbacks)
			{
				onInventoryChangedCallback(self);
			}
		}

		private static void HookItemAdded(orig_RpcItemAdded orig, Inventory self, ItemIndex itemIndex)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, itemIndex);
			ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex);
			if ((Object)(object)itemDef == (Object)null || !onItemAddedCallbacks.ContainsKey(itemDef))
			{
				return;
			}
			foreach (OnInventoryCallback item in onItemAddedCallbacks[itemDef])
			{
				item(self);
			}
		}

		private static void HookHealthComponentAwake(orig_Awake orig, HealthComponent self)
		{
			FaithfulHealthComponentBehaviour faithfulHealthComponentBehaviour = ((Component)self).gameObject.AddComponent<FaithfulHealthComponentBehaviour>();
			orig.Invoke(self);
		}

		private static float HookHeal(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			foreach (OnHealCallback onHealCallback in onHealCallbacks)
			{
				onHealCallback(self, ref amount, ref procChainMask, ref nonRegen);
			}
			return orig.Invoke(self, amount, procChainMask, nonRegen);
		}

		private static void HookRecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			foreach (CharacterBodyCallback onRecalculateStatsCallback in onRecalculateStatsCallbacks)
			{
				onRecalculateStatsCallback(self);
			}
			self.UpdateAllTemporaryVisualEffects();
		}

		private static void HookUpdateVisualEffects(orig_UpdateAllTemporaryVisualEffects orig, CharacterBody self)
		{
			orig.Invoke(self);
			foreach (CharacterBodyCallback onUpdateVisualEffectsCallback in onUpdateVisualEffectsCallbacks)
			{
				onUpdateVisualEffectsCallback(self);
			}
		}

		private static void HookCharacterBodyFixedUpdate(orig_FixedUpdate orig, CharacterBody self)
		{
			orig.Invoke(self);
			foreach (CharacterBodyCallback onCharacterBodyFixedUpdateCallback in onCharacterBodyFixedUpdateCallbacks)
			{
				onCharacterBodyFixedUpdateCallback(self);
			}
		}

		private static void HookPurchaseInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			foreach (OnPurchaseInteractionBeginCallback onPurchaseInteractionBeginCallback in onPurchaseInteractionBeginCallbacks)
			{
				CharacterBody component = ((Component)activator).gameObject.GetComponent<CharacterBody>();
				if ((Object)(object)component != (Object)null)
				{
					onPurchaseInteractionBeginCallback(self, component.master);
				}
			}
			orig.Invoke(self, activator);
		}

		private static bool HookPurchaseCanBeAfforded(orig_CanBeAffordedByInteractor orig, PurchaseInteraction self, Interactor activator)
		{
			foreach (OnPurchaseCanBeAffordedCallback onPurchaseCanBeAffordedCallback in onPurchaseCanBeAffordedCallbacks)
			{
				CharacterBody component = ((Component)activator).gameObject.GetComponent<CharacterBody>();
				if ((Object)(object)component != (Object)null && onPurchaseCanBeAffordedCallback(self, component.master))
				{
					return true;
				}
			}
			return orig.Invoke(self, activator);
		}

		private static void HookProcessJump(orig_ProcessJump orig, GenericCharacterMain self)
		{
			orig.Invoke(self);
			foreach (OnProcessJumpCallback onProcessJumpCallback in onProcessJumpCallbacks)
			{
				onProcessJumpCallback(self);
			}
		}

		private static void HookGenericCharacterFixedUpdate(orig_FixedUpdate orig, GenericCharacterMain self)
		{
			orig.Invoke(self);
			foreach (GenericCharacterCallback genericCharacterFixedUpdateCallback in genericCharacterFixedUpdateCallbacks)
			{
				genericCharacterFixedUpdateCallback(self);
			}
		}

		private static void HookOnDamageDealt(DamageReport _report)
		{
			foreach (DamageReportCallback onDamageDealtCallback in onDamageDealtCallbacks)
			{
				onDamageDealtCallback(_report);
			}
		}

		private static void HookOnCharacterDeath(DamageReport _report)
		{
			foreach (DamageReportCallback onCharacterDeathCallback in onCharacterDeathCallbacks)
			{
				onCharacterDeathCallback(_report);
			}
		}

		public static void OnIncomingDamageServer(DamageInfo _damageInfo, CharacterMaster _attacker, CharacterMaster _victim)
		{
			foreach (OnIncomingDamageCallback onIncomingDamageCallback in onIncomingDamageCallbacks)
			{
				onIncomingDamageCallback(_damageInfo, _attacker, _victim);
			}
		}

		public static void DebugLog(string _message)
		{
			if (Utils.debugMode)
			{
				Log.Debug("[BEHAVIOUR] - " + _message);
			}
		}
	}
	internal struct ItemStatsMod
	{
		public Item item;

		public StatsModCallback callback;

		public ItemStatsMod(Item _item, StatsModCallback _callback)
		{
			item = _item;
			callback = _callback;
		}

		public void Process(CharacterBody _body, StatHookEventArgs _stats)
		{
			Inventory inventory = _body.inventory;
			if (Object.op_Implicit((Object)(object)inventory))
			{
				int itemCount = inventory.GetItemCount(item.itemDef);
				if (itemCount != 0)
				{
					callback(itemCount, _stats);
				}
			}
		}
	}
	internal struct BuffStatsMod
	{
		public Buff buff;

		public StatsModCallback callback;

		public BuffStatsMod(Buff _buff, StatsModCallback _callback)
		{
			buff = _buff;
			callback = _callback;
		}

		public void Process(CharacterBody _body, StatHookEventArgs _stats)
		{
			int buffCount = _body.GetBuffCount(buff.buffDef);
			if (buffCount != 0)
			{
				callback(buffCount, _stats);
			}
		}
	}
	internal struct PlayerItemToPlayer
	{
		public Item item;

		public PlayerHolderToPlayerCallback callback;

		public PlayerItemToPlayer(Item _item, PlayerHolderToPlayerCallback _callback)
		{
			item = _item;
			callback = _callback;
		}

		public void Process(PlayerCharacterMasterController _player, List<PlayerCharacterMasterController> _others)
		{
			if (!Object.op_Implicit((Object)(object)_player.body))
			{
				return;
			}
			Inventory inventory = _player.body.inventory;
			if (!Object.op_Implicit((Object)(object)inventory))
			{
				return;
			}
			int itemCount = inventory.GetItemCount(item.itemDef);
			if (itemCount == 0)
			{
				return;
			}
			foreach (PlayerCharacterMasterController _other in _others)
			{
				if (!((Object)(object)_other == (Object)(object)_player))
				{
					callback(itemCount, _player, _other);
				}
			}
		}
	}
	internal struct PlayerBuffToPlayer
	{
		public Buff buff;

		public PlayerHolderToPlayerCallback callback;

		public PlayerBuffToPlayer(Buff _buff, PlayerHolderToPlayerCallback _callback)
		{
			buff = _buff;
			callback = _callback;
		}

		public void Process(PlayerCharacterMasterController _player, List<PlayerCharacterMasterController> _others)
		{
			if (!Object.op_Implicit((Object)(object)_player.body))
			{
				return;
			}
			int buffCount = _player.body.GetBuffCount(buff.buffDef);
			if (buffCount == 0)
			{
				return;
			}
			foreach (PlayerCharacterMasterController _other in _others)
			{
				if (!((Object)(object)_other == (Object)(object)_player))
				{
					callback(buffCount, _player, _other);
				}
			}
		}
	}
	internal struct AllyItemToAlly
	{
		public Item item;

		public AllyHolderToAllyCallback callback;

		public AllyItemToAlly(Item _item, AllyHolderToAllyCallback _callback)
		{
			item = _item;
			callback = _callback;
		}

		public void Process(CharacterMaster _ally, List<CharacterMaster> _others)
		{
			if (!_ally.hasBody)
			{
				return;
			}
			Inventory inventory = _ally.GetBody().inventory;
			if (!Object.op_Implicit((Object)(object)inventory))
			{
				return;
			}
			int itemCount = inventory.GetItemCount(item.itemDef);
			if (itemCount == 0)
			{
				return;
			}
			foreach (CharacterMaster _other in _others)
			{
				if (!((Object)(object)_other == (Object)(object)_ally))
				{
					callback(itemCount, _ally, _other);
				}
			}
		}
	}
	internal struct AllyBuffToAlly
	{
		public Buff buff;

		public AllyHolderToAllyCallback callback;

		public AllyBuffToAlly(Buff _buff, AllyHolderToAllyCallback _callback)
		{
			buff = _buff;
			callback = _callback;
		}

		public void Process(CharacterMaster _ally, List<CharacterMaster> _others)
		{
			if (!_ally.hasBody)
			{
				return;
			}
			int buffCount = _ally.GetBody().GetBuffCount(buff.buffDef);
			if (buffCount == 0)
			{
				return;
			}
			foreach (CharacterMaster _other in _others)
			{
				if (!((Object)(object)_other == (Object)(object)_ally))
				{
					callback(buffCount, _ally, _other);
				}
			}
		}
	}
	internal class FaithfulHermitsShawlBehaviour : MonoBehaviour, ICharacterBehaviour
	{
		public CharacterBody character;

		private Item hermitShawlItem;

		private Buff patienceBuff;

		private int itemCount = -1;

		private bool hooked = false;

		private bool ooc = false;

		private bool forcedInCombat = false;

		private int maxBuffs;

		private int maxBuffsStacking;

		private float buffCooldown;

		private int currentMaxBuffs => maxBuffs + maxBuffsStacking * (itemCount - 1);

		private float currentBuffCooldown
		{
			get
			{
				int num = currentMaxBuffs;
				return buffCooldown / (float)((num <= 1) ? 1 : (num - 1));
			}
		}

		public FaithfulHermitsShawlBehaviour()
		{
			Utils.RegisterCharacterBehaviour(this);
		}

		public void Init(CharacterBody _character)
		{
			character = _character;
			hermitShawlItem = Items.GetItem("HERMITS_SHAWL");
			patienceBuff = Buffs.GetBuff("PATIENCE");
			FetchSettings();
			Inventory inventory = character.inventory;
			if ((Object)(object)inventory != (Object)null)
			{
				UpdateItemCount(inventory.GetItemCount(hermitShawlItem.itemDef));
			}
			Behaviour.AddOnItemAddedCallback(hermitShawlItem.itemDef, OnItemAdded);
			character.UpdateAllTemporaryVisualEffects();
		}

		public void FetchSettings()
		{
			if (hermitShawlItem != null)
			{
				maxBuffsStacking = hermitShawlItem.FetchSetting<int>("MAX_BUFFS_STACKING").Value;
				maxBuffs = hermitShawlItem.FetchSetting<int>("MAX_BUFFS").Value;
				buffCooldown = hermitShawlItem.FetchSetting<float>("BUFF_RECHARGE").Value;
			}
		}

		private void OnDestroy()
		{
			Utils.UnregisterCharacterBehaviour(this);
			Behaviour.RemoveOnItemAddedCallback(hermitShawlItem.itemDef, OnItemAdded);
			UnhookBehaviour();
		}

		private void OnItemAdded(Inventory _inventory)
		{
			if (!hooked)
			{
				CharacterBody inventoryBody = Utils.GetInventoryBody(_inventory);
				if (!((Object)(object)inventoryBody == (Object)null) && !((Object)(object)inventoryBody != (Object)(object)character))
				{
					int newCount = _inventory.GetItemCount(hermitShawlItem.itemDef);
					UpdateItemCount(newCount);
				}
			}
		}

		private void HookBehaviour()
		{
			if (!hooked)
			{
				hooked = true;
				Behaviour.AddOnInventoryChangedCallback(OnInventoryChanged);
				Behaviour.AddOnCharacterBodyFixedUpdateCallback(OnCharacterBodyFixedUpdate);
			}
		}

		private void UnhookBehaviour()
		{
			if (hooked)
			{
				hooked = false;
				Behaviour.RemoveOnInventoryChangedCallback(OnInventoryChanged);
				Behaviour.RemoveOnCharacterBodyFixedUpdateCallback(OnCharacterBodyFixedUpdate);
			}
		}

		protected void OnInventoryChanged(Inventory _inventory)
		{
			CharacterBody inventoryBody = Utils.GetInventoryBody(_inventory);
			if (!((Object)(object)inventoryBody == (Object)null) && !((Object)(object)inventoryBody != (Object)(object)character))
			{
				int newCount = _inventory.GetItemCount(hermitShawlItem.itemDef);
				UpdateItemCount(newCount);
			}
		}

		private void OnCharacterBodyFixedUpdate(CharacterBody _body)
		{
			if (!((Object)(object)_body != (Object)(object)character) && Utils.hosting && itemCount >= 1)
			{
				UpdateOutOfCombat();
			}
		}

		private void UpdateOutOfCombat()
		{
			bool flag = character.outOfCombat && !forcedInCombat;
			if (flag == ooc)
			{
				return;
			}
			ooc = flag;
			if (ooc)
			{
				int buffCount = character.GetBuffCount(patienceBuff.buffDef);
				if (buffCount < currentMaxBuffs)
				{
					character.AddBuff(patienceBuff.buffDef);
				}
				((MonoBehaviour)this).Invoke("DelayedBuff", currentBuffCooldown);
			}
		}

		public void ForceIntoCombat()
		{
			((MonoBehaviour)this).CancelInvoke("AllowOutOfCombat");
			forcedInCombat = true;
			((MonoBehaviour)this).Invoke("AllowOutOfCombat", 5f);
		}

		private void AllowOutOfCombat()
		{
			forcedInCombat = false;
		}

		private void DelayedBuff()
		{
			if (ooc)
			{
				int buffCount = character.GetBuffCount(patienceBuff.buffDef);
				if (buffCount < currentMaxBuffs)
				{
					character.AddBuff(patienceBuff.buffDef);
				}
				((MonoBehaviour)this).Invoke("DelayedBuff", currentBuffCooldown);
			}
		}

		private void UpdateItemCount(int _newCount)
		{
			if (_newCount != itemCount)
			{
				itemCount = _newCount;
				if (!hooked && itemCount > 0)
				{
					HookBehaviour();
				}
			}
		}
	}
	internal class FaithfulLeadersPennonBehaviour : MonoBehaviour, ICharacterBehaviour
	{
		public CharacterBody character;

		private TemporaryVisualEffect visualEffect;

		private int count = 0;

		private bool enableRadiusIndicator;

		private float baseRadius;

		private float radiusStacking;

		private FaithfulRadiusIndicatorBehaviour radiusIndicator;

		public FaithfulLeadersPennonBehaviour()
		{
			Utils.RegisterCharacterBehaviour(this);
		}

		public void Init(CharacterBody _character)
		{
			character = _character;
			FetchSettings();
			Inventory inventory = character.inventory;
			if ((Object)(object)inventory != (Object)null)
			{
				UpdateItemCount(inventory.GetItemCount(Items.GetItem("LEADERS_PENNON").itemDef));
			}
			Behaviour.AddOnInventoryChangedCallback(OnInventoryChanged);
			character.UpdateAllTemporaryVisualEffects();
		}

		public void FetchSettings()
		{
			Item item = Items.GetItem("LEADERS_PENNON");
			enableRadiusIndicator = item.FetchSetting<bool>("ENABLE_RADIUS_INDICATOR").Value;
			baseRadius = item.FetchSetting<float>("RADIUS").Value;
			radiusStacking = item.FetchSetting<float>("RADIUS_STACKING").Value;
		}

		private void OnDestroy()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			Utils.UnregisterCharacterBehaviour(this);
			if ((Object)(object)radiusIndicator != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)radiusIndicator).gameObject);
			}
			if ((Object)(object)visualEffect != (Object)null)
			{
				visualEffect.visualState = (VisualState)1;
			}
			Behaviour.RemoveOnInventoryChangedCallback(OnInventoryChanged);
		}

		protected void OnInventoryChanged(Inventory _inventory)
		{
			CharacterBody inventoryBody = Utils.GetInventoryBody(_inventory);
			if (!((Object)(object)inventoryBody == (Object)null) && !((Object)(object)inventoryBody != (Object)(object)character))
			{
				int itemCount = _inventory.GetItemCount(Items.GetItem("LEADERS_PENNON").itemDef);
				UpdateItemCount(itemCount);
			}
		}

		protected void UpdateItemCount(int _newCount)
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			if (_newCount == count)
			{
				return;
			}
			count = _newCount;
			if (!enableRadiusIndicator)
			{
				return;
			}
			if ((Object)(object)radiusIndicator != (Object)null)
			{
				if (count == 0)
				{
					Object.Destroy((Object)(object)((Component)radiusIndicator).gameObject);
					return;
				}
				float targetSize = baseRadius + (float)(count - 1) * radiusStacking;
				radiusIndicator.SetTargetSize(targetSize);
			}
			else
			{
				float startingTargetSize = baseRadius + (float)(count - 1) * radiusStacking;
				radiusIndicator = Utils.CreateRadiusIndicator(character, 0f, startingTargetSize, new Color(0.5803921f, 0.22745098f, 61f / 85f));
			}
		}

		public void UpdateVisualEffect(bool _active)
		{
			//IL_00e8: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Assets.pennonEffectPrefab == (Object)null)
			{
				return;
			}
			if (_active)
			{
				if (!((Object)(object)visualEffect != (Object)null))
				{
					GameObject val = Object.Instantiate<GameObject>(Assets.pennonEffectPrefab, character.corePosition, Quaternion.identity);
					visualEffect = val.GetComponent<TemporaryVisualEffect>();
					visualEffect.parentTransform = character.coreTransform;
					visualEffect.visualState = (VisualState)0;
					visualEffect.healthComponent = character.healthComponent;
					visualEffect.radius = character.radius;
					LocalCameraEffect component = val.GetComponent<LocalCameraEffect>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.targetCharacter = ((Component)this).gameObject;
					}
				}
			}
			else if (!((Object)(object)visualEffect == (Object)null))
			{
				visualEffect.visualState = (VisualState)1;
			}
		}
	}
	internal class FaithfulTargetingMatrixBehaviour : NetworkBehaviour, ICharacterBehaviour, IDisplayModelBehaviour
	{
		public CharacterBody character;

		public CharacterBody target;

		private TemporaryVisualEffect visualEffect;

		private float outOfRangeTimer;

		private Vector3 targetPos = Vector3.zero;

		private Vector3 displayPos;

		private Vector3 displayTargetingMovement = new Vector3(-0.0135f, 0f, 0f);

		private Vector3 lensMovement = new Vector3(0f, 0.00675f, 0f);

		private float displayOpen = 0f;

		private float displaySpeed = 4f;

		private bool targeting = false;

		private GameObject m_displayMesh;

		private GameObject m_display;

		private GameObject m_clockwiseLens;

		private GameObject m_antiClockwiseLens;

		private Vector3 clockwiseLensScale;

		private Vector3 antiClockwiseLensScale;

		private Vector3 clockwiseLensPos;

		private Vector3 antiClockwiseLensPos;

		private bool enableTargetEffect;

		private float maxDistance;

		private float closeDistance;

		private float preferredDistance;

		private float outOfRangeTime;

		private string[] blacklisted = new string[1] { "AffixEarthHealerBody" };

		private BodyIndex[] blacklistedIndexes;

		private static int kCmdCmdSyncTarget;

		private static int kRpcRpcSyncTarget;

		private static int kRpcRpcSyncNoTarget;

		private GameObject displayMesh
		{
			get
			{
				if ((Object)(object)m_displayMesh == (Object)null)
				{
					m_displayMesh = Utils.FindChildByName(character.modelLocator.modelTransform, "TargetingMatrixDisplayMesh(Clone)");
				}
				return m_displayMesh;
			}
		}

		private GameObject display
		{
			get
			{
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)displayMesh == (Object)null)
				{
					return null;
				}
				if ((Object)(object)m_display == (Object)null)
				{
					m_display = Utils.FindChildByName(displayMesh.transform, "Display");
					displayPos = m_display.transform.localPosition;
				}
				return m_display;
			}
		}

		private GameObject clockwiseLens
		{
			get
			{
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)displayMesh == (Object)null)
				{
					return null;
				}
				if ((Object)(object)m_clockwiseLens == (Object)null)
				{
					m_clockwiseLens = Utils.FindChildByName(displayMesh.transform, "Lens_Clock");
					clockwiseLensScale = m_clockwiseLens.transform.localScale;
					clockwiseLensPos = m_clockwiseLens.transform.localPosition;
				}
				return m_clockwiseLens;
			}
		}

		private GameObject antiClockwiseLens
		{
			get
			{
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)displayMesh == (Object)null)
				{
					return null;
				}
				if ((Object)(object)m_antiClockwiseLens == (Object)null)
				{
					m_antiClockwiseLens = Utils.FindChildByName(displayMesh.transform, "Lens_Anti");
					antiClockwiseLensScale = m_antiClockwiseLens.transform.localScale;
					antiClockwiseLensPos = m_antiClockwiseLens.transform.localPosition;
				}
				return m_antiClockwiseLens;
			}
		}

		public string relatedItemToken => "TARGETING_MATRIX";

		public FaithfulTargetingMatrixBehaviour()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			Utils.RegisterCharacterBehaviour(this);
		}

		public void Init(CharacterBody _character)
		{
			character = _character;
			FetchBlacklistedIndexes();
			FetchSettings();
			DisplayModelBehaviourRelay displayModelBehaviourRelay = ((Component)character.modelLocator.modelTransform).gameObject.AddComponent<DisplayModelBehaviourRelay>();
			displayModelBehaviourRelay.Init(this);
			UpdateDisplayObject();
		}

		private void FetchBlacklistedIndexes()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			List<BodyIndex> list = new List<BodyIndex>();
			string[] array = blacklisted;
			foreach (string text in array)
			{
				list.Add(BodyCatalog.FindBodyIndex(text));
			}
			blacklistedIndexes = list.ToArray();
		}

		public void FetchSettings()
		{
			Item item = Items.GetItem("TARGETING_MATRIX");
			enableTargetEffect = item.FetchSetting<bool>("ENABLE_TARGET_EFFECT").Value;
			maxDistance = item.FetchSetting<float>("MAX_DISTANCE").Value;
			closeDistance = item.FetchSetting<float>("CLOSE_DISTANCE").Value;
			preferredDistance = item.FetchSetting<float>("PREFERRED_DISTANCE").Value;
			outOfRangeTime = item.FetchSetting<float>("OUT_OF_RANGE_TIME").Value;
		}

		private void FixedUpdate()
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			if (targeting && (Object)(object)target == (Object)null)
			{
				targeting = false;
				((MonoBehaviour)this).StopAllCoroutines();
				((MonoBehaviour)this).StartCoroutine(CloseDisplay());
			}
			if (!targeting && (Object)(object)target != (Object)null)
			{
				targeting = true;
				((MonoBehaviour)this).StopAllCoroutines();
				((MonoBehaviour)this).StartCoroutine(OpenDisplay());
			}
			if (Utils.hosting && !((Object)(object)target == (Object)null))
			{
				targetPos = target.corePosition;
				if (Vector3.Distance(targetPos, character.corePosition) > maxDistance)
				{
					outOfRangeTimer += Time.fixedDeltaTime;
				}
				else
				{
					outOfRangeTimer = 0f;
				}
				if (outOfRangeTimer > outOfRangeTime)
				{
					RemoveTarget();
					CallCmdSyncTarget();
				}
			}
		}

		private void UpdateDisplayObject()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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 (!((Object)(object)display == (Object)null))
			{
				display.transform.localPosition = displayPos + displayTargetingMovement * (1f - displayOpen);
				clockwiseLens.transform.localPosition = clockwiseLensPos + lensMovement * (1f - displayOpen);
				antiClockwiseLens.transform.localPosition = antiClockwiseLensPos + lensMovement * (1f - displayOpen);
				clockwiseLens.transform.localScale = clockwiseLensScale * displayOpen;
				antiClockwiseLens.transform.localScale = antiClockwiseLensScale * displayOpen;
			}
		}

		private IEnumerator OpenDisplay()
		{
			while (displayOpen < 1f)
			{
				displayOpen = Mathf.Clamp01(displayOpen + Time.deltaTime * displaySpeed);
				UpdateDisplayObject();
				yield return null;
			}
		}

		private IEnumerator CloseDisplay()
		{
			while (displayOpen > 0f)
			{
				displayOpen = Mathf.Clamp01(displayOpen - Time.deltaTime * displaySpeed);
				UpdateDisplayObject();
				yield return null;
			}
		}

		private void OnDestroy()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Utils.UnregisterCharacterBehaviour(this);
			if ((Object)(object)visualEffect != (Object)null)
			{
				visualEffect.visualState = (VisualState)1;
			}
		}

		public void OnKill(CharacterBody _killed)
		{
			if ((Object)(object)target != (Object)null && (Object)(object)target == (Object)(object)_killed)
			{
				RemoveTarget();
			}
			((MonoBehaviour)this).Invoke("SearchForTarget", 0.1f);
		}

		private void SearchForTarget()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_00d2: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			if (!Utils.hosting || !((Object)(object)target == (Object)null))
			{
				return;
			}
			ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList;
			if (readOnlyInstancesList == null)
			{
				return;
			}
			List<CharacterBody> list = new List<CharacterBody>();
			List<CharacterBody> list2 = new List<CharacterBody>();
			Vector3 corePosition = character.corePosition;
			foreach (CharacterBody item in readOnlyInstancesList)
			{
				if (item.teamComponent.teamIndex == character.teamComponent.teamIndex || (Object)(object)item.master == (Object)null || (Object)(object)item.healthComponent == (Object)null || !item.healthComponent.alive)
				{
					continue;
				}
				float num = Vector3.Distance(corePosition, item.corePosition);
				if (!(num > maxDistance) && !blacklistedIndexes.Contains(item.bodyIndex))
				{
					list.Add(item);
					if (num <= closeDistance)
					{
						list2.Add(item);
					}
				}
			}
			if (list2.Count > 0)
			{
				list = list2;
			}
			else if (list.Count == 0)
			{
				return;
			}
			float num2 = 0f;
			float[] array = new float[list.Count];
			for (int i = 0; i < list.Count; i++)
			{
				CharacterBody val = list[i];
				float num3 = ((targetPos == Vector3.zero) ? Vector3.Distance(val.corePosition, corePosition) : Vector3.Distance(val.corePosition, targetPos));
				float num4 = ((num3 > 0f) ? ((num3 > preferredDistance) ? (1f / num3) : (2f / num3)) : float.MaxValue);
				num2 += num4;
				array[i] = num4;
			}
			float num5 = Random.Range(0f, num2);
			float num6 = 0f;
			for (int j = 0; j < list.Count; j++)
			{
				num6 += array[j];
				if (!(num5 <= num6))
				{
					continue;
				}
				CharacterBody characterBody = list[j];
				FaithfulCharacterBodyBehaviour faithfulCharacterBodyBehaviour = Utils.FindCharacterBodyHelper(characterBody);
				if (!((Object)(object)faithfulCharacterBodyBehaviour == (Object)null))
				{
					FaithfulTargetingMatrixBehaviour targetingMatrix = faithfulCharacterBodyBehaviour.targetingMatrix;
					if (!((Object)(object)targetingMatrix == (Object)null))
					{
						targetingMatrix.SetTargeted(character);
						target = characterBody;
						CallCmdSyncTarget();
						break;
					}
				}
			}
		}

		private void RemoveTarget()
		{
			if ((Object)(object)target == (Object)null)
			{
				return;
			}
			FaithfulCharacterBodyBehaviour faithfulCharacterBodyBehaviour = Utils.FindCharacterBodyHelper(target);
			if (!((Object)(object)faithfulCharacterBodyBehaviour == (Object)null))
			{
				FaithfulTargetingMatrixBehaviour targetingMatrix = faithfulCharacterBodyBehaviour.targetingMatrix;
				if (!((Object)(object)targetingMatrix == (Object)null))
				{
					targetingMatrix.SetNotTargeted();
					target = null;
				}
			}
		}

		public void SetTargeted(CharacterBody _targeter)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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)
			if (!((Object)(object)Utils.localPlayerBody != (Object)(object)_targeter) && !((Object)(object)visualEffect != (Object)null) && enableTargetEffect)
			{
				GameObject val = Object.Instantiate<GameObject>(Assets.matrixEffectPrefab, character.corePosition, Quaternion.identity);
				visualEffect = val.GetComponent<TemporaryVisualEffect>();
				visualEffect.parentTransform = character.coreTransform;
				visualEffect.visualState = (VisualState)0;
				visualEffect.healthComponent = character.healthComponent;
				visualEffect.radius = character.radius;
				LocalCameraEffect component = val.GetComponent<LocalCameraEffect>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.targetCharacter = ((Component)this).gameObject;
				}
			}
		}

		public void SetNotTargeted()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)visualEffect == (Object)null))
			{
				visualEffect.visualState = (VisualState)1;
			}
		}

		[Command]
		public void CmdSyncTarget()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)target != (Object)null)
			{
				CallRpcSyncTarget(((Component)target).GetComponent<NetworkIdentity>().netId);
			}
			else
			{
				CallRpcSyncNoTarget();
			}
		}

		[ClientRpc]
		private void RpcSyncTarget(NetworkInstanceId _targetNetID)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (Utils.hosting)
			{
				return;
			}
			GameObject obj = ClientScene.FindLocalObject(_targetNetID);
			CharacterBody val = ((obj != null) ? obj.GetComponent<CharacterBody>() : null);
			if ((Object)(object)val == (Object)null)
			{
				Log.Warning($"[TARGETING MATRIX] | Could not find target body with net ID {_targetNetID} - Sync unsuccessful.");
				return;
			}
			FaithfulCharacterBodyBehaviour faithfulCharacterBodyBehaviour = Utils.FindCharacterBodyHelper(val);
			if (!((Object)(object)faithfulCharacterBodyBehaviour == (Object)null))
			{
				FaithfulTargetingMatrixBehaviour targetingMatrix = faithfulCharacterBodyBehaviour.targetingMatrix;
				if (!((Object)(object)targetingMatrix == (Object)null))
				{
					targetingMatrix.SetTargeted(character);
					target = val;
				}
			}
		}

		[ClientRpc]
		private void RpcSyncNoTarget()
		{
			if (!Utils.hosting)
			{
				RemoveTarget();
			}
		}

		public void OnDisplayModelCreated()
		{
			UpdateDisplayObject();
		}

		private void UNetVersion()
		{
		}

		protected static void InvokeCmdCmdSyncTarget(NetworkBehaviour obj, NetworkReader reader)
		{
			if (!NetworkServer.active)
			{
				Debug.LogError((object)"Command CmdSyncTarget called on client.");
			}
			else
			{
				((FaithfulTargetingMatrixBehaviour)(object)obj).CmdSyncTarget();
			}
		}

		public void CallCmdSyncTarget()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"Command function CmdSyncTarget called on server.");
				return;
			}
			if (((NetworkBehaviour)this).isServer)
			{
				CmdSyncTarget();
				return;
			}
			NetworkWriter val = new NetworkWriter();
			val.Write((short)0);
			val.Write((short)5);
			val.WritePackedUInt32((uint)kCmdCmdSyncTarget);
			val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
			((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdSyncTarget");
		}

		protected static void InvokeRpcRpcSyncTarget(NetworkBehaviour obj, NetworkReader reader)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"RPC RpcSyncTarget called on server.");
			}
			else
			{
				((FaithfulTargetingMatrixBehaviour)(object)obj).RpcSyncTarget(reader.ReadNetworkId());
			}
		}

		protected static void InvokeRpcRpcSyncNoTarget(NetworkBehaviour obj, NetworkReader reader)
		{
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"RPC RpcSyncNoTarget called on server.");
			}
			else
			{
				((FaithfulTargetingMatrixBehaviour)(object)obj).RpcSyncNoTarget();
			}
		}

		public void CallRpcSyncTarget(NetworkInstanceId _targetNetID)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogError((object)"RPC Function RpcSyncTarget called on client.");
				return;
			}
			NetworkWriter val = new NetworkWriter();
			val.Write((short)0);
			val.Write((short)2);
			val.WritePackedUInt32((uint)kRpcRpcSyncTarget);
			val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
			val.Write(_targetNetID);
			((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcSyncTarget");
		}

		public void CallRpcSyncNoTarget()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogError((object)"RPC Function RpcSyncNoTarget called on client.");
				return;
			}
			NetworkWriter val = new NetworkWriter();
			val.Write((short)0);
			val.Write((short)2);
			val.WritePackedUInt32((uint)kRpcRpcSyncNoTarget);
			val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
			((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcSyncNoTarget");
		}

		static FaithfulTargetingMatrixBehaviour()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			kCmdCmdSyncTarget = -1894886286;
			NetworkBehaviour.RegisterCommandDelegate(typeof(FaithfulTargetingMatrixBehaviour), kCmdCmdSyncTarget, new CmdDelegate(InvokeCmdCmdSyncTarget));
			kRpcRpcSyncTarget = 263857352;
			NetworkBehaviour.RegisterRpcDelegate(typeof