Decompiled source of Faithful v1.0.2

Faithful.dll

Decompiled 4 minutes ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Mage;
using Faithful;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On.EntityStates;
using On.EntityStates.Mage;
using On.RoR2;
using On.RoR2.Items;
using R2API;
using RoR2;
using RoR2.Navigation;
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+4b0791b189380d2ccaaf0834c3b9f5954a656f54")]
[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;

		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();
		}

		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_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05df: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0622: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_065b: 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 = 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("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/NetworkedObjects/NearbyDamageBonusIndicator"));
			radiusIndicatorPrefab = PrefabAPI.InstantiateClone(val3, "faithfulRadiusIndicator");
			Object.DestroyImmediate((Object)(object)val3);
			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>();
			if (Utils.debugMode)
			{
				Log.Debug("[ASSETS] - Fetched all needed resources from RoR2 assets.");
			}
		}

		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_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 <9>__HookInflictDamageOverTime;

			public static hook_InflictDot_refInflictDotInfo <10>__HookInflictDamageOverTimeRef;

			public static hook_Awake <11>__HookHealthComponentAwake;

			public static hook_Heal <12>__HookHeal;

			public static hook_RecalculateStats <13>__HookRecalculateStats;

			public static hook_UpdateAllTemporaryVisualEffects <14>__HookUpdateVisualEffects;

			public static hook_OnInteractionBegin <15>__HookPurchaseInteractionBegin;

			public static hook_CanBeAffordedByInteractor <16>__HookPurchaseCanBeAfforded;

			public static hook_ProcessJump <17>__HookProcessJump;

			public static hook_FixedUpdate <18>__HookGenericCharacterFixedUpdate;

			public static StatHookEventHandler <19>__HookStatsMod;

			public static Action<DamageReport> <20>__HookOnDamageDealt;

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

		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 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<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()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//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: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Expected O, but got Unknown
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Expected O, but got Unknown
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Expected O, but got Unknown
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Expected O, but got Unknown
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Expected O, but got Unknown
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			CreatePrefabs();
			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>__HookInflictDamageOverTime;
			if (obj10 == null)
			{
				hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 val10 = HookInflictDamageOverTime;
				<>O.<9>__HookInflictDamageOverTime = val10;
				obj10 = (object)val10;
			}
			DotController.InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 += (hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1)obj10;
			object obj11 = <>O.<10>__HookInflictDamageOverTimeRef;
			if (obj11 == null)
			{
				hook_InflictDot_refInflictDotInfo val11 = HookInflictDamageOverTimeRef;
				<>O.<10>__HookInflictDamageOverTimeRef = val11;
				obj11 = (object)val11;
			}
			DotController.InflictDot_refInflictDotInfo += (hook_InflictDot_refInflictDotInfo)obj11;
			object obj12 = <>O.<11>__HookHealthComponentAwake;
			if (obj12 == null)
			{
				hook_Awake val12 = HookHealthComponentAwake;
				<>O.<11>__HookHealthComponentAwake = val12;
				obj12 = (object)val12;
			}
			HealthComponent.Awake += (hook_Awake)obj12;
			object obj13 = <>O.<12>__HookHeal;
			if (obj13 == null)
			{
				hook_Heal val13 = HookHeal;
				<>O.<12>__HookHeal = val13;
				obj13 = (object)val13;
			}
			HealthComponent.Heal += (hook_Heal)obj13;
			object obj14 = <>O.<13>__HookRecalculateStats;
			if (obj14 == null)
			{
				hook_RecalculateStats val14 = HookRecalculateStats;
				<>O.<13>__HookRecalculateStats = val14;
				obj14 = (object)val14;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj14;
			object obj15 = <>O.<14>__HookUpdateVisualEffects;
			if (obj15 == null)
			{
				hook_UpdateAllTemporaryVisualEffects val15 = HookUpdateVisualEffects;
				<>O.<14>__HookUpdateVisualEffects = val15;
				obj15 = (object)val15;
			}
			CharacterBody.UpdateAllTemporaryVisualEffects += (hook_UpdateAllTemporaryVisualEffects)obj15;
			object obj16 = <>O.<15>__HookPurchaseInteractionBegin;
			if (obj16 == null)
			{
				hook_OnInteractionBegin val16 = HookPurchaseInteractionBegin;
				<>O.<15>__HookPurchaseInteractionBegin = val16;
				obj16 = (object)val16;
			}
			PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj16;
			object obj17 = <>O.<16>__HookPurchaseCanBeAfforded;
			if (obj17 == null)
			{
				hook_CanBeAffordedByInteractor val17 = HookPurchaseCanBeAfforded;
				<>O.<16>__HookPurchaseCanBeAfforded = val17;
				obj17 = (object)val17;
			}
			PurchaseInteraction.CanBeAffordedByInteractor += (hook_CanBeAffordedByInteractor)obj17;
			object obj18 = <>O.<17>__HookProcessJump;
			if (obj18 == null)
			{
				hook_ProcessJump val18 = HookProcessJump;
				<>O.<17>__HookProcessJump = val18;
				obj18 = (object)val18;
			}
			GenericCharacterMain.ProcessJump += (hook_ProcessJump)obj18;
			object obj19 = <>O.<18>__HookGenericCharacterFixedUpdate;
			if (obj19 == null)
			{
				hook_FixedUpdate val19 = HookGenericCharacterFixedUpdate;
				<>O.<18>__HookGenericCharacterFixedUpdate = val19;
				obj19 = (object)val19;
			}
			GenericCharacterMain.FixedUpdate += (hook_FixedUpdate)obj19;
			object obj20 = <>O.<19>__HookStatsMod;
			if (obj20 == null)
			{
				StatHookEventHandler val20 = HookStatsMod;
				<>O.<19>__HookStatsMod = val20;
				obj20 = (object)val20;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj20;
			GlobalEventManager.onServerDamageDealt += HookOnDamageDealt;
			GlobalEventManager.onCharacterDeathGlobal += HookOnCharacterDeath;
			DebugLog("Behaviour initialised");
		}

		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>();
		}

		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 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 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)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			HurtBox[] hurtBoxesInSphere = Utils.GetHurtBoxesInSphere(((Component)self).transform.position, self.currentRadius);
			HurtBox[] array = hurtBoxesInSphere;
			foreach (HurtBox val in array)
			{
				foreach (InHoldoutZoneCallback inHoldoutZoneCallback in inHoldoutZoneCallbacks)
				{
					inHoldoutZoneCallback(val.healthComponent.body, 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_0029: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				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 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 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 FaithfulLeadersPennonBehaviour : MonoBehaviour
	{
		public CharacterBody character;

		private TemporaryVisualEffect visualEffect;

		private int count = 0;

		private FaithfulRadiusIndicatorBehaviour radiusIndicator;

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

		private void OnDestroy()
		{
			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_00a8: Unknown result type (might be due to invalid IL or missing references)
			if (_newCount == count)
			{
				return;
			}
			count = _newCount;
			if ((Object)(object)radiusIndicator != (Object)null)
			{
				if (count == 0)
				{
					Object.Destroy((Object)(object)((Component)radiusIndicator).gameObject);
					return;
				}
				float targetSize = 15f + (float)(count - 1) * 5f;
				radiusIndicator.SetTargetSize(targetSize);
			}
			else
			{
				float startingTargetSize = 15f + (float)(count - 1) * 5f;
				radiusIndicator = Utils.CreateRadiusIndicator(character, 0f, startingTargetSize, new Color(0.5803921f, 0.22745098f, 61f / 85f));
			}
		}

		public void UpdateVisualEffect(bool _active)
		{
			//IL_00d2: 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_002f: 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)
			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 FaithfulTJetpackBehaviour : NetworkBehaviour
	{
		public CharacterBody character;

		protected bool active = false;

		protected int itemCount = 0;

		protected int buffedItemCount = 5;

		protected float baseMaxVelocity = 30f;

		protected float baseRisingAcceleration = 36f;

		protected float fallingAcceleration = 100f;

		protected float baseFuel = 4f;

		protected float fuelPerStack = 2f;

		protected float baseRefuelDuration = 12f;

		protected float minimumFuelToActivate = 0.5f;

		protected float maxVelocityBuff = 6f;

		protected float risingAccelerationBuff = 4f;

		protected bool grounded = false;

		protected bool jetActivated = false;

		protected bool firstJet = true;

		protected bool refueling = false;

		protected float fuelUsed = 0f;

		protected float lastJetTime;

		protected bool artificer = false;

		protected bool hasDisplay = false;

		protected GameObject jetpack;

		protected GameObject additionalBoosters;

		protected GameObject dial;

		protected GameObject jetMiddle;

		protected GameObject jetLeft;

		protected GameObject jetRight;

		protected GameObject jetsOn;

		protected GameObject jetsOff;

		protected bool initialised = false;

		private static int kCmdCmdSyncJetpack;

		private static int kRpcRpcSyncJetpack;

		protected float fuelCapacity => baseFuel + fuelPerStack * (float)(itemCount - 1);

		protected float fuelRemaining => fuelCapacity - fuelUsed;

		protected float fuelRemainingPerc => 1f - fuelUsed / fuelCapacity;

		protected float refuelDuration => baseRefuelDuration / (1f + Mathf.Log((float)itemCount, 16f));

		protected float refuelRate => fuelCapacity / refuelDuration;

		protected float timeSinceLastJet => Time.time - lastJetTime;

		protected float dynamicAccelerationDifference => fallingAcceleration - risingAcceleration;

		protected bool canBeActivated => character.characterMotor.velocity.y < 0f && fuelRemaining > minimumFuelToActivate;

		protected float buffPerc
		{
			get
			{
				int num = itemCount - 1;
				int num2 = buffedItemCount - 1;
				return Mathf.Min((float)num / (float)num2, 1f);
			}
		}

		protected float maxVelocity => baseMaxVelocity + maxVelocityBuff * buffPerc;

		protected float risingAcceleration => baseRisingAcceleration + risingAccelerationBuff * buffPerc;

		public void AssignCharacter(CharacterBody _character)
		{
			character = _character;
		}

		protected void Init(CharacterBody _characterBody)
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			if (initialised && ((Object)(object)jetpack != (Object)null || !hasDisplay))
			{
				return;
			}
			initialised = true;
			Transform modelTransform = _characterBody.modelLocator.modelTransform;
			jetpack = Utils.FindChildByName(modelTransform, "4T0NJetpackDisplayMesh(Clone)");
			if ((Object)(object)jetpack == (Object)null)
			{
				artificer = false;
				hasDisplay = false;
				additionalBoosters = null;
				dial = null;
				jetMiddle = null;
				jetLeft = null;
				jetRight = null;
				jetsOff = null;
				jetsOn = new GameObject("JetsOn");
				jetsOn.transform.SetParent(modelTransform, false);
				GameObject val = Object.Instantiate<GameObject>(Assets.mageJetAkEventsPrefab);
				val.transform.SetParent(jetsOn.transform, false);
				val.SetActive(true);
				return;
			}
			hasDisplay = true;
			additionalBoosters = Utils.FindChildByName(jetpack.transform, "Pack");
			dial = Utils.FindChildByName(jetpack.transform, "Dial");
			jetMiddle = Utils.FindChildByName(jetpack.transform, "Jet_Middle");
			jetLeft = Utils.FindChildByName(jetpack.transform, "Jet_Left");
			jetRight = Utils.FindChildByName(jetpack.transform, "Jet_Right");
			((Component)jetpack.GetComponent<Transform>().Find("4-T0N_Jetpack_Jetflare_Display")).gameObject.AddComponent<TJetpackJetFlare>();
			jetsOn = ((Component)jetpack.GetComponent<Transform>().Find("Jets_On")).gameObject;
			jetsOff = ((Component)jetpack.GetComponent<Transform>().Find("Jets_Off")).gameObject;
			jetsOn.SetActive(false);
			GameObject val2 = Object.Instantiate<GameObject>(Assets.mageJetAkEventsPrefab);
			val2.transform.SetParent(jetsOn.transform, false);
			val2.SetActive(true);
			FlickerLight val3 = ((Component)jetsOn.GetComponent<Transform>().Find("Point_Light_Middle")).gameObject.AddComponent<FlickerLight>();
			FlickerLight val4 = ((Component)jetsOn.GetComponent<Transform>().Find("Point_Light_Left")).gameObject.AddComponent<FlickerLight>();
			FlickerLight val5 = ((Component)jetsOn.GetComponent<Transform>().Find("Point_Light_Right")).gameObject.AddComponent<FlickerLight>();
			val3.light = ((Component)jetsOn.GetComponent<Transform>().Find("Point_Light_Middle")).GetComponent<Light>();
			val3.sinWaves = Assets.mageJetWaves;
			val4.light = ((Component)jetsOn.GetComponent<Transform>().Find("Point_Light_Left")).GetComponent<Light>();
			val4.sinWaves = Assets.mageJetWaves;
			val5.light = ((Component)jetsOn.GetComponent<Transform>().Find("Point_Light_Right")).GetComponent<Light>();
			val5.sinWaves = Assets.mageJetWaves;
			FlickerLight val6 = ((Component)jetsOff.GetComponent<Transform>().Find("Point_Light_Middle")).gameObject.AddComponent<FlickerLight>();
			FlickerLight val7 = ((Component)jetsOff.GetComponent<Transform>().Find("Point_Light_Left")).gameObject.AddComponent<FlickerLight>();
			FlickerLight val8 = ((Component)jetsOff.GetComponent<Transform>().Find("Point_Light_Right")).gameObject.AddComponent<FlickerLight>();
			val6.light = ((Component)jetsOff.GetComponent<Transform>().Find("Point_Light_Middle")).GetComponent<Light>();
			val6.sinWaves = Assets.mageJetWaves;
			val7.light = ((Component)jetsOff.GetComponent<Transform>().Find("Point_Light_Left")).GetComponent<Light>();
			val7.sinWaves = Assets.mageJetWaves;
			val8.light = ((Component)jetsOff.GetComponent<Transform>().Find("Point_Light_Right")).GetComponent<Light>();
			val8.sinWaves = Assets.mageJetWaves;
			if (((Object)modelTransform).name == "mdlMage")
			{
				artificer = true;
				additionalBoosters.transform.localScale = Vector3.zero;
			}
			else
			{
				artificer = false;
			}
		}

		public void UpdateItemCount(int _itemCount)
		{
			itemCount = _itemCount;
			if (!active && itemCount > 0)
			{
				Activate();
			}
			else if (active && itemCount == 0)
			{
				Deactivate();
			}
		}

		protected void Activate()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			if (!active && !((Object)(object)character == (Object)null))
			{
				active = true;
				grounded = false;
				jetActivated = false;
				firstJet = true;
				refueling = false;
				fuelUsed = 0f;
				GenericCharacterMain.ProcessJump += new hook_ProcessJump(OnProcessJump);
				GenericCharacterMain.FixedUpdate += new hook_FixedUpdate(OnFixedUpdate);
				JetpackOn.FixedUpdate += new hook_FixedUpdate(OnArtificerJetpackFixedUpdate);
				MageCharacterMain.ProcessJump += new hook_ProcessJump(OnArtificerProcessJump);
			}
		}

		protected void Deactivate()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			if (active)
			{
				active = false;
				GenericCharacterMain.ProcessJump -= new hook_ProcessJump(OnProcessJump);
				GenericCharacterMain.FixedUpdate -= new hook_FixedUpdate(OnFixedUpdate);
				JetpackOn.FixedUpdate -= new hook_FixedUpdate(OnArtificerJetpackFixedUpdate);
				MageCharacterMain.ProcessJump -= new hook_ProcessJump(OnArtificerProcessJump);
			}
		}

		protected void OnFixedUpdate(orig_FixedUpdate orig, GenericCharacterMain self)
		{
			if (self == null || (Object)(object)((EntityState)self).characterBody != (Object)(object)character)
			{
				orig.Invoke(self);
				return;
			}
			Init(((EntityState)self).characterBody);
			UpdateVisuals();
			SyncJetpack();
			orig.Invoke(self);
		}

		protected void OnArtificerProcessJump(orig_ProcessJump orig, MageCharacterMain self)
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			if (self == null || (Object)(object)((EntityState)self).characterBody != (Object)(object)character)
			{
				orig.Invoke(self);
				return;
			}
			bool flag = ((object)self.jetpackStateMachine.state).GetType() == typeof(JetpackOn);
			if (((BaseCharacterMain)self).hasCharacterMotor && ((BaseCharacterMain)self).hasInputBank && ((EntityState)self).isAuthority && (jetActivated || (character.inputBank.jump.down && canBeActivated)))
			{
				JetpackBehaviour((GenericCharacterMain)(object)self);
				if (flag && !jetActivated)
				{
					self.jetpackStateMachine.SetNextState((EntityState)new Idle());
				}
				else if (!flag && jetActivated)
				{
					self.jetpackStateMachine.SetNextState((EntityState)new JetpackOn());
				}
			}
			else
			{
				orig.Invoke(self);
			}
		}

		protected void OnProcessJump(orig_ProcessJump orig, GenericCharacterMain self)
		{
			if (self == null || (Object)(object)((EntityState)self).characterBody != (Object)(object)character || !((BaseCharacterMain)self).hasCharacterMotor || !((BaseCharacterMain)self).hasInputBank || !((EntityState)self).isAuthority)
			{
				orig.Invoke(self);
				return;
			}
			JetpackBehaviour(self);
			if (!jetActivated && (!character.inputBank.jump.down || !canBeActivated))
			{
				orig.Invoke(self);
			}
		}

		protected void JetpackBehaviour(GenericCharacterMain self)
		{
			if (Time.timeScale == 0f)
			{
				lastJetTime += Time.fixedDeltaTime;
				return;
			}
			if (((BaseState)self).isGrounded)
			{
				Grounded();
			}
			else
			{
				MidAir();
			}
			Refuel();
		}

		protected void UpdateVisuals()
		{
			//IL_0030: 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)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			if (hasDisplay)
			{
				dial.transform.localEulerAngles = new Vector3(0f, 0f, 360f * fuelRemainingPerc);
				Vector3 localScale = (jetActivated ? new Vector3(1f, 3.5f, 1f) : new Vector3(1f, 1f, 1f));
				jetMiddle.transform.localScale = localScale;
				jetLeft.transform.localScale = localScale;
				jetRight.transform.localScale = localScale;
				jetsOn.SetActive(jetActivated);
				jetsOff.SetActive(!jetActivated);
			}
			else
			{
				jetsOn.SetActive(jetActivated);
			}
		}

		protected void OnArtificerJetpackFixedUpdate(orig_FixedUpdate orig, JetpackOn self)
		{
			if (self == null || (Object)(object)((EntityState)self).characterBody != (Object)(object)character)
			{
				orig.Invoke(self);
			}
			else if (!jetActivated)
			{
				orig.Invoke(self);
			}
		}

		protected void Grounded()
		{
			if (!grounded)
			{
				DeactivateJet();
				grounded = true;
			}
		}

		protected void MidAir()
		{
			grounded = false;
			if (jetActivated)
			{
				JettingMidAir();
			}
			else if (character.inputBank.jump.down && canBeActivated)
			{
				ActivateJet();
				Jet();
			}
		}

		protected void Refuel()
		{
			if (jetActivated || !grounded)
			{
				refueling = false;
			}
			else if (fuelUsed != 0f)
			{
				if (refueling)
				{
					fuelUsed = Mathf.Max(fuelUsed - refuelRate * Time.fixedDeltaTime, 0f);
				}
				else
				{
					refueling = true;
				}
			}
		}

		protected void JettingMidAir()
		{
			if (!character.inputBank.jump.down || fuelRemaining == 0f || character.characterMotor.velocity.y > maxVelocity)
			{
				DeactivateJet();
			}
			else
			{
				Jet();
			}
		}

		protected void ActivateJet()
		{
			if (!jetActivated)
			{
				jetActivated = true;
				firstJet = true;
			}
		}

		protected void DeactivateJet()
		{
			if (jetActivated)
			{
				jetActivated = false;
			}
		}

		protected void Jet()
		{
			//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)
			float y = character.characterMotor.velocity.y;
			float num = ((y > 0f) ? risingAcceleration : (risingAcceleration + Mathf.Clamp01((0f - y) / 30f) * dynamicAccelerationDifference));
			character.characterMotor.velocity = new Vector3(character.characterMotor.velocity.x, Mathf.MoveTowards(y, maxVelocity, num * Time.fixedDeltaTime), character.characterMotor.velocity.z);
			if (firstJet)
			{
				firstJet = false;
			}
			else
			{
				ReduceFuel();
			}
			lastJetTime = Time.time;
		}

		protected void ReduceFuel()
		{
			fuelUsed = Mathf.Min(fuelUsed + timeSinceLastJet, fuelCapacity);
		}

		protected void SyncJetpack()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)character == (Object)(object)Utils.localPlayerBody && (Object)(object)Utils.netUtils != (Object)null)
			{
				Utils.netUtils.SyncJetpack(((Component)this).GetComponent<NetworkIdentity>().netId, new JetpackSyncData(fuelUsed, jetActivated));
			}
		}

		[Command]
		public void CmdSyncJetpack(JetpackSyncData _data)
		{
			CallRpcSyncJetpack(_data);
		}

		[ClientRpc]
		private void RpcSyncJetpack(JetpackSyncData _data)
		{
			if (!((Object)(object)character == (Object)(object)Utils.localPlayerBody))
			{
				fuelUsed = _data.fuelUsed;
				jetActivated = _data.jetActivated;
			}
		}

		private void UNetVersion()
		{
		}

		protected static void InvokeCmdCmdSyncJetpack(NetworkBehaviour obj, NetworkReader reader)
		{
			if (!NetworkServer.active)
			{
				Debug.LogError((object)"Command CmdSyncJetpack called on client.");
			}
			else
			{
				((FaithfulTJetpackBehaviour)(object)obj).CmdSyncJetpack(GeneratedNetworkCode._ReadJetpackSyncData_None(reader));
			}
		}

		public void CallCmdSyncJetpack(JetpackSyncData _data)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"Command function CmdSyncJetpack called on server.");
				return;
			}
			if (((NetworkBehaviour)this).isServer)
			{
				CmdSyncJetpack(_data);
				return;
			}
			NetworkWriter val = new NetworkWriter();
			val.Write((short)0);
			val.Write((short)5);
			val.WritePackedUInt32((uint)kCmdCmdSyncJetpack);
			val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
			GeneratedNetworkCode._WriteJetpackSyncData_None(val, _data);
			((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdSyncJetpack");
		}

		protected static void InvokeRpcRpcSyncJetpack(NetworkBehaviour obj, NetworkReader reader)
		{
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"RPC RpcSyncJetpack called on server.");
			}
			else
			{
				((FaithfulTJetpackBehaviour)(object)obj).RpcSyncJetpack(GeneratedNetworkCode._ReadJetpackSyncData_None(reader));
			}
		}

		public void CallRpcSyncJetpack(JetpackSyncData _data)
		{
			//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 RpcSyncJetpack called on client.");
				return;
			}
			NetworkWriter val = new NetworkWriter();
			val.Write((short)0);
			val.Write((short)2);
			val.WritePackedUInt32((uint)kRpcRpcSyncJetpack);
			val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
			GeneratedNetworkCode._WriteJetpackSyncData_None(val, _data);
			((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcSyncJetpack");
		}

		static FaithfulTJetpackBehaviour()
		{
			//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
			kCmdCmdSyncJetpack = -1222377709;
			NetworkBehaviour.RegisterCommandDelegate(typeof(FaithfulTJetpackBehaviour), kCmdCmdSyncJetpack, new CmdDelegate(InvokeCmdCmdSyncJetpack));
			kRpcRpcSyncJetpack = 1274165629;
			NetworkBehaviour.RegisterRpcDelegate(typeof(FaithfulTJetpackBehaviour), kRpcRpcSyncJetpack, new CmdDelegate(InvokeRpcRpcSyncJetpack));
			NetworkCRC.RegisterBehaviour("FaithfulTJetpackBehaviour", 0);
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			bool result = default(bool);
			return result;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
		}
	}
	internal class TJetpackJetFlare : MonoBehaviour
	{
		private Renderer renderer;

		private void Awake()
		{
			renderer = ((Component)this).GetComponent<Renderer>();
			renderer.material = Assets.mageJetMaterial;
		}

		private void FixedUpdate()
		{
			if (!((Object)renderer.material).name.Contains("mage"))
			{
				renderer.material = Assets.mageJetMaterial;
			}
		}
	}
	internal struct JetpackSyncData
	{
		public float fuelUsed;

		public bool jetActivated;

		public JetpackSyncData(float _fuelUsed, bool _jetActivated)
		{
			fuelUsed = _fuelUsed;
			jetActivated = _jetActivated;
		}
	}
	internal class Buff
	{
		public BuffDef buffDef;

		public string token;

		public Buff(string _token, string _iconName, Color _colour, bool _canStack = true, bool _isDebuff = false, bool _isHidden = false)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			bool flag = !Utils.debugMode && (_iconName == "texbufftemporalcube" || !Assets.HasAsset(_iconName));
			if (!flag)
			{
				flag = !Config.CheckTag(_token);
			}
			token = _token;
			buffDef = ScriptableObject.CreateInstance<BuffDef>();
			((Object)buffDef).name = "FAITHFUL_" + _token + "_BUFF";
			buffDef.buffColor = _colour;
			buffDef.canStack = _canStack;
			buffDef.isDebuff = _isDebuff;
			buffDef.isHidden = _isHidden || flag;
			buffDef.iconSprite = Assets.GetIcon(_iconName);
			ContentAddition.AddBuffDef(buffDef);
			Log.Debug("Created buff '" + _token + "'");
			if (flag)
			{
				if (!Config.CheckTag(_token))
				{
					Log.Debug("Hiding buff '" + _token + "' due to user preference");
				}
				else
				{
					Log.Debug("Hiding buff '" + _token + "' due to use of temporary assets outside of debug mode");
				}
			}
		}
	}
	internal static class Buffs
	{
		private static List<Buff> buffs;

		public static void Init()
		{
			buffs = new List<Buff>();
		}

		public static Buff AddBuff(string _token, string _iconDir, Color _colour, bool _canStack = true, bool _isDebuff = false, bool _isHidden = false)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			Buff buff = new Buff(_token, _iconDir, _colour, _canStack, _isDebuff, _isHidden);
			buffs.Add(buff);
			return buff;
		}

		public static Buff GetBuff(string _token)
		{
			foreach (Buff buff in buffs)
			{
				if (buff.token == _token)
				{
					return buff;
				}
			}
			Log.Error("Attempted to fetch buff '" + _token + "' but couldn't find it");
			return null;
		}
	}
	internal class GodMode
	{
		protected Toolbox toolbox;

		private Buff godModeBuff;

		public GodMode(Toolbox _toolbox)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			toolbox = _toolbox;
			godModeBuff = Buffs.AddBuff("DEBUG_MODE", "texbuffdevmode", Color.white, _canStack: false);
			Behaviour.AddInHoldoutZoneCallback(InHoldoutZone);
			Behaviour.AddOnIncomingDamageCallback(OnIncomingDamage);
			Behaviour.AddOnPurchaseInteractionBeginCallback(OnPurchaseInteractionBegin);
			Behaviour.AddOnPurchaseCanBeAffordedCallback(OnPurchaseCanBeAfforded);
			Behaviour.AddStatsMod(godModeBuff, GodModeStatsMod);
			Behaviour.AddOnHealCallback(OnHeal);
			Behaviour.AddUpdateCallback(Update, _debugOnly: true);
			CharacterBody.GetUserName += new hook_GetUserName(OnGetUsername);
			MapZone.TeleportBody += new hook_TeleportBody(OnMapTeleportBody);
		}

		private void InHoldoutZone(CharacterBody _body, HoldoutZoneController _zone)
		{
			if (Utils.debugMode && _body.GetBuffCount(godModeBuff.buffDef) > 0)
			{
				Utils.ChargeHoldoutZone(_zone);
			}
		}

		private void OnIncomingDamage(DamageInfo _report, CharacterMaster _attacker, CharacterMaster _victim)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_victim == (Object)null) && _victim.hasBody)
			{
				CharacterBody body = _victim.GetBody();
				if (body.GetBuffCount(godModeBuff.buffDef) > 0)
				{
					_report.rejected = true;
					_report.canRejectForce = true;
					_report.damage = 0f;
					_report.force = default(Vector3);
				}
			}
		}

		private void OnPurchaseInteractionBegin(PurchaseInteraction _shop, CharacterMaster _activator)
		{
			if (_activator.hasBody && _activator.GetBody().GetBuffCount(godModeBuff.buffDef) > 0)
			{
				_shop.cost = 0;
			}
		}

		private bool OnPurchaseCanBeAfforded(PurchaseInteraction _shop, CharacterMaster _activator)
		{
			if (!_activator.hasBody)
			{
				return false;
			}
			if (_activator.GetBody().GetBuffCount(godModeBuff.buffDef) > 0)
			{
				return true;
			}
			return false;
		}

		private void GodModeStatsMod(int _count, StatHookEventArgs _stats)
		{
			_stats.baseDamageAdd += float.PositiveInfinity;
			_stats.attackSpeedMultAdd += 3f;
			_stats.baseRegenAdd += 10000000f;
			_stats.moveSpeedMultAdd += 2f;
			_stats.jumpPowerMultAdd += 0.5f;
			_stats.cooldownReductionAdd += float.PositiveInfinity;
		}

		private void OnHeal(HealthComponent _healthComponent, ref float _amount, ref ProcChainMask _procChainMask, ref bool _nonRegen)
		{
			CharacterBody component = ((Component)_healthComponent).gameObject.GetComponent<CharacterBody>();
			if ((Object)(object)component != (Object)null && component.GetBuffCount(godModeBuff.buffDef) > 0)
			{
				_amount = float.PositiveInfinity;
			}
		}

		private void Update()
		{
			if (!Utils.hosting || PlayerCharacterMasterController.instances.Count <= 0)
			{
				return;
			}
			CharacterBody body = PlayerCharacterMasterController.instances[0].master.GetBody();
			if (Object.op_Implicit((Object)(object)body) && Input.GetKeyDown((KeyCode)283))
			{
				if (body.GetBuffCount(godModeBuff.buffDef) > 0)
				{
					body.RemoveBuff(godModeBuff.buffDef);
					Log.Debug("God Mode disabled");
				}
				else
				{
					body.AddBuff(godModeBuff.buffDef);
					Log.Debug("God Mode enabled!");
				}
			}
		}

		private string OnGetUsername(orig_GetUserName orig, CharacterBody self)
		{
			if (self.GetBuffCount(godModeBuff.buffDef) > 0)
			{
				return "Godly " + orig.Invoke(self);
			}
			return orig.Invoke(self);
		}

		private void OnMapTeleportBody(orig_TeleportBody orig, MapZone self, CharacterBody characterBody)
		{
			if (characterBody.GetBuffCount(godModeBuff.buffDef) <= 0)
			{
				orig.Invoke(self, characterBody);
			}
		}
	}
	internal class Inspiration
	{
		protected Toolbox toolbox;

		private Buff inspirationBuff;

		public Inspiration(Toolbox _toolbox)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			toolbox = _toolbox;
			inspirationBuff = Buffs.AddBuff("INSPIRATION", "texbuffinspiredboost", Color.white);
			Behaviour.AddStatsMod(inspirationBuff, InspirationStatsMod);
		}

		private void InspirationStatsMod(int _count, StatHookEventArgs _stats)
		{
			_stats.critAdd += 1f * (float)_count;
			_stats.critDamageMultAdd += 0.2f * (float)_count;
		}
	}
	internal class Vengeance
	{
		protected Toolbox toolbox;

		private Buff vengeanceBuff;

		public Vengeance(Toolbox _toolbox)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			toolbox = _toolbox;
			vengeanceBuff = Buffs.AddBuff("VENGEANCE", "texbuffvengefulboost", Color.red);
			Behaviour.AddOnDamageDealtCallback(OnDamageDealt);
			Behaviour.AddStatsMod(vengeanceBuff, VengeanceStatsMod);
		}

		private void OnDamageDealt(DamageReport report)
		{
			CharacterBody attackerBody = report.attackerBody;
			if (Object.op_Implicit((Object)(object)attackerBody) && report.attackerBody.GetBuffCount(vengeanceBuff.buffDef) > 0)
			{
				report.attackerBody.ClearTimedBuffs(vengeanceBuff.buffDef);
			}
		}

		private void VengeanceStatsMod(int _count, StatHookEventArgs _stats)
		{
			_stats.damageMultAdd += 0.75f * (float)_count;
		}
	}
	internal class FaithfulCharacterBodyBehaviour : NetworkBehaviour
	{
		public Flags frameFlags = new Flags();

		public Flags stageFlags = new Flags();

		[SyncVar(hook = "CharacterIDChanged")]
		public NetworkInstanceId characterID;

		private CharacterBody character;

		private bool characterBodyFound = false;

		public FaithfulTJetpackBehaviour tJetpack;

		public FaithfulLeadersPennonBehaviour leadersPennon;

		private bool searchingForCharacterBody = false;

		public NetworkInstanceId NetworkcharacterID
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return characterID;
			}
			[param: In]
			set
			{
				//IL_0001: 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)
				ref NetworkInstanceId reference = ref characterID;
				if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard)
				{
					((NetworkBehaviour)this).syncVarHookGuard = true;
					CharacterIDChanged(value);
					((NetworkBehaviour)this).syncVarHookGuard = false;
				}
				((NetworkBehaviour)this).SetSyncVar<NetworkInstanceId>(value, ref reference, 1u);
			}
		}

		private void CharacterIDChanged(NetworkInstanceId _newValue)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			NetworkcharacterID = _newValue;
			((MonoBehaviour)this).StartCoroutine(LinkCharacterBody());
		}

		public override void OnStartClient()
		{
			((NetworkBehaviour)this).OnStartClient();
			((MonoBehaviour)this).StartCoroutine(LinkCharacterBody());
			((MonoBehaviour)this).Invoke("CheckForCharacterBody", 8f);
		}

		private void CheckForCharacterBody()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (!characterBodyFound && !NetworkServer.active && Utils.debugMode)
			{
				Log.Warning($"Faithful Character Body behaviour not linked for net ID {characterID}.");
			}
		}

		private void LateUpdate()
		{
			frameFlags.Reset();
			if (characterBodyFound && (Object)(object)character == (Object)null && NetworkServer.active)
			{
				NetworkServer.Destroy(((Component)this).gameObject);
			}
		}

		private IEnumerator LinkCharacterBody()
		{
			if (!searchingForCharacterBody)
			{
				searchingForCharacterBody = true;
				while ((Object)(object)character == (Object)null)
				{
					FaithfulCharacterBodyBehaviour faithfulCharacterBodyBehaviour = this;
					GameObject obj = ClientScene.FindLocalObject(characterID);
					faithfulCharacterBodyBehaviour.character = ((obj != null) ? obj.GetComponent<CharacterBody>() : null);
					yield return null;
				}
				characterBodyFound = true;
				Utils.RegisterFaithfulCharacterBodyBehaviour(character, this);
				tJetpack = ((Component)this).GetComponent<FaithfulTJetpackBehaviour>();
				tJetpack.AssignCharacter(character);
				leadersPennon = ((Component)this).GetComponent<FaithfulLeadersPennonBehaviour>();
				leadersPennon.Init(character);
				if ((Object)(object)character.inventory != (Object)null)
				{
					tJetpack.UpdateItemCount(character.inventory.GetItemCount(Items.GetItem("4T0N_JETPACK").itemDef));
				}
				if (Utils.debugMode)
				{
					string messageSource = (NetworkServer.active ? "SERVER" : "CLIENT");
					Log.Message($"[{messageSource}] - Faithful Character Body behaviour linked for character '{((Object)character).name}' with net ID {characterID}.");
				}
				searchingForCharacterBody = false;
			}
		}

		private void UNetVersion()
		{
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			//IL_0008: 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)
			if (forceAll)
			{
				writer.Write(characterID);
				return true;
			}
			bool flag = false;
			if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				writer.Write(characterID);
			}
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
			}
			return flag;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (initialState)
			{
				characterID = reader.ReadNetworkId();
				return;
			}
			int num = (int)reader.ReadPackedUInt32();
			if (((uint)num & (true ? 1u : 0u)) != 0)
			{
				CharacterIDChanged(reader.ReadNetworkId());
			}
		}
	}
	internal class FaithfulHealthComponentBehaviour : MonoBehaviour, IOnIncomingDamageServerReceiver
	{
		public CharacterBody character;

		public CharacterMaster lastAttacker;

		private void Start()
		{
			character = ((Component)this).gameObject.GetComponent<CharacterBody>();
		}

		public void OnIncomingDamageServer(DamageInfo _damageInfo)
		{
			lastAttacker = null;
			if (_damageInfo == null)
			{
				return;
			}
			CharacterMaster victim = (Object.op_Implicit((Object)(object)character) ? character.master : null);
			CharacterMaster attacker = null;
			if (Object.op_Implicit((Object)(object)_damageInfo.attacker))
			{
				CharacterBody component = _damageInfo.attacker.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					attacker = (lastAttacker = component.master);
				}
			}
			Behaviour.OnIncomingDamageServer(_damageInfo, attacker, victim);
		}
	}
	internal class FaithfulHoldoutZoneBehaviour : MonoBehaviour
	{
		private HoldoutZoneController zone;

		private List<OnHoldoutZoneCalcRadiusCallback> onHoldoutZoneCalcRadiusCallbacks;

		private void Awake()
		{
			zone = ((Component)this).GetComponent<HoldoutZoneController>();
		}

		private void OnEnable()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			if (((Object)zone).name != "HoldoutZone")
			{
				zone.calcRadius += new CalcRadiusDelegate(OnCalcRadius);
			}
		}

		private void OnDisable()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			if (((Object)zone).name != "HoldoutZone")
			{
				zone.calcRadius -= new CalcRadiusDelegate(OnCalcRadius);
			}
		}

		public void Init(List<OnHoldoutZoneCalcRadiusCallback> _onHoldoutZoneCalcRadiusCallbacks)
		{
			onHoldoutZoneCalcRadiusCallbacks = _onHoldoutZoneCalcRadiusCallbacks;
		}

		private void OnCalcRadius(ref float _radius)
		{
			foreach (OnHoldoutZoneCalcRadiusCallback onHoldoutZoneCalcRadiusCallback in onHoldoutZoneCalcRadiusCallbacks)
			{
				onHoldoutZoneCalcRadiusCallback(ref _radius, zone);
			}
		}
	}
	internal class FaithfulRadiusIndicatorBehaviour : MonoBehaviour
	{
		private Transform parent;

		private float adjustmentSpeed;

		private float m_targetSize;

		public float size => ((Component)this).transform.lossyScale.x * 13f;

		public float targetSize => m_targetSize;

		public void Init(Transform _parent, float _startingSize, Color _colour, float _adjustmentSpeed = 1f)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			parent = _parent;
			((Component)this).transform.parent = parent;
			adjustmentSpeed = _adjustmentSpeed;
			m_targetSize = _startingSize;
			SetSize(_startingSize);
			SetColour(_colour);
		}

		private IEnumerator AdjustToSize(float _targetSize)
		{
			float startingSize = size;
			float sizeDif = _targetSize - startingSize;
			float timeSpent = 0f;
			while (timeSpent < 1f)
			{
				timeSpent = Mathf.Min(timeSpent + Time.deltaTime * adjustmentSpeed, 1f);
				SetSize(startingSize + sizeDif * Mathf.SmoothStep(0f, 1f, timeSpent));
				yield return null;
			}
		}

		public void SetColour(Color _colour)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			((Renderer)((Component)((Component)this).transform.Find("Donut")).GetComponent<MeshRenderer>()).material.SetColor("_Color", _colour);
			((Renderer)((Component)((Component)this).transform.Find("Donut")).GetComponent<MeshRenderer>()).material.SetColor("_TintColor", _colour);
			((Renderer)((Component)((Component)this).transform.Find("Radius, Spherical")).GetComponent<MeshRenderer>()).material.SetColor("_Color", _colour);
			((Renderer)((Component)((Component)this).transform.Find("Radius, Spherical")).GetComponent<MeshRenderer>()).material.SetColor("_TintColor", _colour);
		}

		public void SetTargetSize(float _targetSize)
		{
			m_targetSize = _targetSize;
			((MonoBehaviour)this).StopAllCoroutines();
			((MonoBehaviour)this).StartCoroutine(AdjustToSize(_targetSize));
		}

		private void SetSize(float _size)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			float num = _size / 13f;
			((Component)this).transform.parent = null;
			((Component)this).transform.localScale = new Vector3(num, num, num);
			((Component)this).transform.parent = parent;
		}
	}
	internal class FaithfulRotatorBehaviour : MonoBehaviour
	{
		[SerializeField]
		private Vector3 rotationAxis = Vector3.up;

		[SerializeField]
		private float rotationSpeed = 1f;

		public void Init(Vector3 _rotationAxis, float _rotationSpeed)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			rotationAxis = ((Vector3)(ref _rotationAxis)).normalized;
			rotationSpeed = _rotationSpeed;
		}

		private void Update()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.Rotate(rotationAxis * rotationSpeed * Time.deltaTime, (Space)1);
		}
	}
	internal static class Config
	{
		public static PluginInfo pluginInfo;

		private static List<ConfigTag> tags = new List<ConfigTag>();

		private static ConfigTag defaultItemFlags;

		public static string ConfigFilePath => Path.Combine(Path.GetDirectoryName(pluginInfo.Location), "config.cfg");

		public static void Init(PluginInfo _pluginInfo)
		{
			pluginInfo = _pluginInfo;
			if (File.Exists(ConfigFilePath))
			{
				Log.Debug("Reading config file");
				ReadConfig();
			}
			else
			{
				Log.Debug("No config file found");
			}
			Log.Debug("Config initialised");
		}

		private static void ReadConfig()
		{
			using StreamReader streamReader = File.OpenText(ConfigFilePath);
			while (streamReader.Peek() > -1)
			{
				string text = streamReader.ReadLine();
				if (text.StartsWith("/") || text.StartsWith("#"))
				{
					continue;
				}
				text = text.Replace(" ", "");
				string[] array = text.Split(':');
				if (array.Length >= 2)
				{
					string text2 = array[0].ToUpper();
					bool enabled = array[1].ToLower().Contains("true");
					string[] flags = Array.Empty<string>();
					if (array.Length >= 3)
					{
						flags = array[2].ToUpper().Split('|');
					}
					ConfigTag item = new ConfigTag(text2, enabled, flags);
					if (text2 == "DEFAULT_ITEM_FLAGS")
					{
						defaultItemFlags = item;
					}
					else
					{
						tags.Add(item);
					}
				}
			}
		}

		public static bool CheckTag(string _tag)
		{
			_tag = _tag.ToUpper();
			foreach (ConfigTag tag in tags)
			{
				if (tag.tag == _tag)
				{
					return tag.enabled;
				}
			}
			if (_tag == "DEBUG_MODE")
			{
				return false;
			}
			return true;
		}

		public static bool CheckTagFlag(string _tag, string _flag, bool _isItem = false)
		{
			_tag = _tag.ToUpper();
			bool flag = false;
			foreach (ConfigTag tag in tags)
			{
				if (tag.tag == _tag)
				{
					flag = tag.GetFlag(_flag);
					break;
				}
			}
			if (_isItem && !flag && defaultItemFlags != null)
			{
				flag = defaultItemFlags.GetFlag(_flag);
			}
			return flag;
		}
	}
	internal class ConfigTag
	{
		public string tag;

		public bool enabled;

		public string[] flags;

		public ConfigTag(string _tag, bool _enabled, string[] _flags)
		{
			tag = _tag;
			enabled = _enabled;
			flags = _flags;
		}

		public bool GetFlag(string _flag)
		{
			string[] array = flags;
			foreach (string text in array)
			{
				if (_flag == text)
				{
					return true;
				}
			}
			return false;
		}
	}
	internal class DebugAudioAnalysis : DebugPanel
	{
		private DebugToggle logAudioToggle;

		private DebugToggle displayAudioToggle;

		public override void Awake()
		{
			base.Awake();
			logAudioToggle = ((Component)((Component)this).transform.Find("LogAudioToggle")).gameObject.AddComponent<DebugToggle>();
			displayAudioToggle = ((Component)((Component)this).transform.Find("DisplayAudioToggle")).gameObject.AddComponent<DebugToggle>();
			logAudioToggle.Init(OnLogEnable, OnLogDisable);
			displayAudioToggle.Init(OnDisplayEnable, OnDisplayDisable);
		}

		private void OnDisable()
		{
			AkSoundEngineDynamicPatcher.logAudio = false;
			AkSoundEngineDynamicPatcher.analyseAudio = false;
			logAudioToggle.SetState(_state: false);
			displayAudioToggle.SetState(_state: false);
		}

		private void OnLogEnable()
		{
			AkSoundEngineDynamicPatcher.logAudio = true;
		}

		private void OnLogDisable()
		{
			AkSoundEngineDynamicPatcher.logAudio = false;
		}

		private void OnDisplayEnable()
		{
			AkSoundEngineDynamicPatcher.analyseAudio = true;
		}

		private void OnDisplayDisable()
		{
			AkSoundEngineDynamicPatcher.analyseAudio = false;
		}
	}
	internal static class AkSoundEngineDynamicPatcher
	{
		private static GameObject audioAnalysisPrefab;

		public static bool logAudio = false;

		public static bool analyseAudio = false;

		private static List<AudioAnalysisOwner> audioAnalysisOwnerList = new List<AudioAnalysisOwner>();

		public static void Init()
		{
			audioAnalysisPrefab = Assets.GetObject("DebugAudioInstanceCanvas");
		}

		public static void PatchAll(Harmony _harmony)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			MethodInfo[] methods = typeof(AkSoundEngine).GetMethods(BindingFlags.Static | BindingFlags.Public);
			MethodInfo[] array = methods;
			foreach (MethodInfo methodInfo in array)
			{
				if (methodInfo.Name == "PostEvent")
				{
					_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(AkSoundEngineDynamicPatcher).GetMethod("PostEventPrefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
		}

		public static void PostEventPrefix(MethodBase __originalMethod, object[] __args)
		{
			if (__args.Length == 2 && __args[0] is string && __args[1] is GameObject)
			{
				string eventName = __args[0] as string;
				object obj = __args[1];
				AnalyseAudio(eventName, (GameObject)((obj is GameObject) ? obj : null));
				return;
			}
			if (__args.Length == 2 && __args[0] is uint && __args[1] is GameObject)
			{
				uint eventID = Convert.ToUInt32(__args[0]);
				object obj2 = __args[1];
				AnalyseAudio(eventID, (GameObject)((obj2 is GameObject) ? obj2 : null));
				return;
			}
			if (__args.Length == 2 && __args[0] is string && __args[1] is ulong)
			{
				AnalyseAudio(__args[0] as string, Convert.ToUInt64(__args[1]));
				return;
			}
			string text = "";
			ParameterInfo[] parameters = __originalMethod.GetParameters();
			foreach (ParameterInfo parameterInfo in parameters)
			{
				text = ((!(text == "")) ? (text + ", " + parameterInfo.ParameterType.Name + " " + parameterInfo.Name) : ("Unmanaged PostEvent called with args: " + parameterInfo.ParameterType.Name + " " + parameterInfo.Name));
			}
			Log.Info(text + ".");
		}

		private static void AnalyseAudio(string _eventName, GameObject _source)
		{
			if (logAudio)
			{
				Log.Info("Sound event '" + _eventName + "' playing on game object '" + ((Object)_source).name + "'.");
			}
			if (analyseAudio)
			{
				CreateAudioAnalysisCanvas("Event Name:\n" + _eventName, _source);
			}
		}

		private static void AnalyseAudio(uint _eventID, GameObject _source)
		{
			if (logAudio)
			{
				Log.Info($"Sound event with ID {_eventID} playing on game object '{((Object)_source).name}'.");
			}
			if (analyseAudio)
			{
				CreateAudioAnalysisCanvas($"Event ID:\n{_eventID}", _source);
			}
		}

		private static void AnalyseAudio(string _eventName, ulong _sourceID)
		{
			if (logAudio)
			{
				Log.Info($"Sound event '{_eventName}' playing on game object with ID {_sourceID}.");
			}
		}

		private static void CreateAudioAnalysisCanvas(string _eventID, GameObject _owner)
		{
			if (!((Object)(object)_owner == (Object)null))
			{
				GameObject val = Object.Instantiate<GameObject>(audioAnalysisPrefab);
				AudioAnalysisCanvas audioAnalysisCanvas = val.AddComponent<AudioAnalysisCanvas>();
				audioAnalysisCanvas.Init(_eventID);
				GetAudioAnalysisOwner(_owner).AddAudioAnalysis(audioAnalysisCanvas);
			}
		}

		public static void ForgetAudioAnalysisOwner(AudioAnalysisOwner _owner)
		{
			audioAnalysisOwnerList.Remove(_owner);
		}

		private static AudioAnalysisOwner GetAudioAnalysisOwner(GameObject _owner)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			foreach (AudioAnalysisOwner audioAnalysisOwner2 in audioAnalysisOwnerList)
			{
				if ((Object)(object)audioAnalysisOwner2.ownerObject == (Object)(object)_owner)
				{
					return audioAnalysisOwner2;
				}
			}
			GameObject val = new GameObject("FaithfulAudioAnalysis");
			AudioAnalysisOwner audioAnalysisOwner = val.AddComponent<AudioAnalysisOwner>();
			audioAnalysisOwner.Init(_owner);
			return audioAnalysisOwner;
		}
	}
	internal class AudioAnalysisOwner : MonoBehaviour
	{
		private Transform mainCameraTransform;

		private GameObject owner;

		private List<AudioAnalysisCanvas> audioAnalysisList = new List<AudioAnalysisCanvas>();

		public GameObject ownerObject => owner;

		public void Init(GameObject _owner)
		{
			owner = _owner;
			((Component)this).gameObject.layer = LayerMask.NameToLayer("UI, WorldSpace");
			UpdatePosition();
			UpdateRotation();
		}

		private void OnDestroy()
		{
			AkSoundEngineDynamicPatcher.ForgetAudioAnalysisOwner(this);
		}

		private void LateUpdate()
		{
			UpdatePosition();
			UpdateRotation();
			UpdateState();
		}

		private void UpdatePosition()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown