Decompiled source of RealDoctor v1.0.0

RealDoctor.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Commando.CommandoWeapon;
using HG;
using HG.BlendableTypes;
using On.RoR2;
using On.RoR2.Projectile;
using R2API;
using R2API.Utils;
using RealDoctor.Modules;
using RealDoctor.Modules.Characters;
using RealDoctor.Modules.Survivors;
using RealDoctor.SkillStates;
using RealDoctor.SkillStates.BaseStates;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.ContentManagement;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("RealDoctor")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RealDoctor")]
[assembly: AssemblyTitle("RealDoctor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace RealDoctor
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.borbreapr.FieldMedicIsAnOriginalCharacter", "FieldMedicIsAnOriginalCharacter", "1.0.0")]
	[R2APISubmoduleDependency(new string[] { "PrefabAPI", "LanguageAPI", "SoundAPI", "UnlockableAPI", "DamageAPI", "RecalculateStatsAPI" })]
	public class MedicPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.borbreapr.FieldMedicIsAnOriginalCharacter";

		public const string MODNAME = "FieldMedicIsAnOriginalCharacter";

		public const string MODVERSION = "1.0.0";

		public const string MODAUTHOR = "borbreapr";

		public const string DEVELOPER_PREFIX = "borbreapr";

		public static MedicPlugin instance;

		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Assets.Initialize();
			Config.ReadConfig();
			States.RegisterStates();
			Buffs.RegisterBuffs();
			Projectiles.RegisterProjectiles();
			Tokens.AddTokens();
			ItemDisplays.PopulateDisplays();
			new FieldMedic().Initialize();
			new ContentPacks().Initialize();
			Hooks.Initialize();
			Hook();
		}

		private void Hook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
			CharacterBody.OnTakeDamageServer += new hook_OnTakeDamageServer(CharacterBody_OnTakeDamageServer);
		}

		private void CharacterBody_OnTakeDamageServer(orig_OnTakeDamageServer orig, CharacterBody self, DamageReport damageReport)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, damageReport);
			if (DamageAPI.HasModdedDamageType(damageReport.damageInfo, Assets.MedicVenom))
			{
				float num = StaticValues.venomBaseDuration * damageReport.damageInfo.procCoefficient;
				damageReport.victimBody.AddTimedBuff(Buffs.Venom, num);
				((Component)damageReport.victimBody).gameObject.AddComponent<Buffs.VenomController>();
				((Component)damageReport.victimBody).gameObject.GetComponent<Buffs.VenomController>().duration = num;
			}
			if (DamageAPI.HasModdedDamageType(damageReport.damageInfo, Assets.MedicToxin))
			{
				damageReport.victimBody.AddTimedBuff(Buffs.Toxin, StaticValues.toxinBaseDuration * damageReport.damageInfo.procCoefficient);
			}
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self) && self.HasBuff(Buffs.armorBuff))
			{
				self.armor += 300f;
			}
		}
	}
}
namespace RealDoctor.SkillStates
{
	public class CastSuperBuff : BaseSkillState
	{
		private float lastTargetAcquiredTime = -1f;

		private float delayAfterTargetLoss = 0.5f;

		private CharacterBody target;

		public static float buffDuration = 5f;

		public static float bonusBuffDuration = 5f;

		public float baseDuration = 0.3f;

		private float duration;

		public override void OnEnter()
		{
			target = ((EntityState)this).characterBody;
			((EntityState)this).characterBody.AddBuff(Buffs.Slow50);
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			((BaseState)this).OnEnter();
		}

		private void AddBuffs()
		{
			if (NetworkServer.active)
			{
				float num = buffDuration;
				if ((Object)(object)target != (Object)(object)((EntityState)this).characterBody)
				{
					num += bonusBuffDuration;
				}
				target.AddTimedBuff(Buffs.Intangible, num);
				target.AddTimedBuff(Buffs.CloakSpeed, num);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (!(((EntityState)this).fixedAge >= duration))
			{
				return;
			}
			if (!((BaseSkillState)this).IsKeyDownAuthority())
			{
				if (((EntityState)this).isAuthority)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
				return;
			}
			float num = 1000f;
			float num2 = 0f;
			Ray aimRay = ((BaseState)this).GetAimRay();
			RaycastHit val = default(RaycastHit);
			if (!Physics.Raycast(CameraRigController.ModifyAimRayIfApplicable(aimRay, ((EntityState)this).gameObject, ref num2), ref val, num + num2, LayerMask.op_Implicit(CommonMasks.bullet), (QueryTriggerInteraction)0))
			{
				return;
			}
			Collider collider = ((RaycastHit)(ref val)).collider;
			GameObject val2 = ((collider != null) ? ((Component)collider).gameObject : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				Debug.Log((object)((Object)val2).name);
				CharacterBody val3 = val2.GetComponent<CharacterBody>();
				if ((Object)(object)val3 == (Object)null)
				{
					HurtBox component = val2.GetComponent<HurtBox>();
					val3 = component.healthComponent.body;
				}
				if ((Object)(object)val3 != (Object)null && val3.teamComponent.teamIndex == ((EntityState)this).teamComponent.teamIndex)
				{
					target = val3;
				}
			}
		}

		public override void OnExit()
		{
			((EntityState)this).characterBody.RemoveBuff(Buffs.Slow50);
			((EntityState)this).OnExit();
			AddBuffs();
		}
	}
	public class DivineIntern : BaseSkillState
	{
		private CharacterBody target;

		public static float buffDuration = 4f;

		public float baseDuration = 0.5f;

		private float duration;

		public override void OnEnter()
		{
			target = ((EntityState)this).characterBody;
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			((BaseState)this).OnEnter();
		}

		private void AddBuffs()
		{
			if (NetworkServer.active)
			{
				float num = buffDuration;
				target.AddTimedBuff(Buffs.Intangible, num);
				target.AddTimedBuff(Buffs.CloakSpeed, num);
				while (target.HasBuff(Buffs.Antidote))
				{
					target.RemoveOldestTimedBuff(Buffs.Antidote);
					target.AddTimedBuff(Buffs.Cure, StaticValues.cureBaseDuration);
				}
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			AddBuffs();
		}
	}
	public class FireShockingRev : BaseSkillState
	{
		public static float damageCoefficient = 1.2f;

		public static float procCoefficient = 1f;

		public static float BaseDuration = 0.75f;

		public static float force = 600f;

		public static float recoil = 1.5f;

		public static float range = 256f;

		public static GameObject tracerEffectPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerGoldGat");

		private Animator animator;

		private float duration;

		private string muzzleString;

		public override void OnEnter()
		{
			duration = BaseDuration / ((BaseState)this).attackSpeedStat;
			((BaseState)this).OnEnter();
			((EntityState)this).characterBody.SetAimTimer(2f);
			muzzleString = "Muzzle";
			animator = ((EntityState)this).GetModelAnimator();
			animator.SetBool("attacking", true);
			animator.SetBool("inCombat", true);
			((EntityState)this).PlayAnimation("Gesture, Override", "Secondary Shoot", "Taser.playbackRate", duration);
			Fire();
		}

		public override void OnExit()
		{
			if (animator.GetBool("secondaryArmed"))
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "Secondary Idle", "Taser.playbackRate", duration);
			}
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void Fire()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).characterBody.AddSpreadBloom(1.5f);
			EffectManager.SimpleMuzzleFlash(FirePistol2.muzzleEffectPrefab, ((EntityState)this).gameObject, muzzleString, false);
			Util.PlaySound("HenryShootPistol", ((EntityState)this).gameObject);
			if (((EntityState)this).isAuthority)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				((BaseState)this).AddRecoil(-1f * recoil, -2f * recoil, -0.5f * recoil, 0.5f * recoil);
				BulletAttack val = new BulletAttack();
				val.bulletCount = 1u;
				val.aimVector = ((Ray)(ref aimRay)).direction;
				val.origin = ((Ray)(ref aimRay)).origin;
				val.damage = damageCoefficient * ((BaseState)this).damageStat;
				val.damageColorIndex = (DamageColorIndex)0;
				val.damageType = (DamageType)16777216;
				val.falloffModel = (FalloffModel)1;
				val.maxDistance = range;
				val.force = force;
				val.minSpread = 0f;
				val.maxSpread = 0f;
				val.isCrit = ((BaseState)this).RollCrit();
				val.owner = ((EntityState)this).gameObject;
				val.muzzleName = muzzleString;
				val.smartCollision = true;
				val.procChainMask = default(ProcChainMask);
				val.procCoefficient = procCoefficient;
				val.radius = 0.7f;
				val.sniper = false;
				val.stopperMask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask;
				val.weapon = null;
				val.tracerEffectPrefab = tracerEffectPrefab;
				val.spreadPitchScale = 0f;
				val.spreadYawScale = 0f;
				val.queryTriggerInteraction = (QueryTriggerInteraction)0;
				val.hitEffectPrefab = FirePistol2.hitEffectPrefab;
				DamageAPI.AddModdedDamageType(val, Assets.MedicElectrifying);
				val.Fire();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	internal class LoadShockingRev : GenericCharacterMain
	{
		private bool isOverriding = false;

		public static float baseMinDuration = 0.5f;

		private float minDuration;

		private GenericSkill overridingSkillSlot;

		private Animator animator;

		public override void OnEnter()
		{
			minDuration = baseMinDuration / ((BaseState)this).attackSpeedStat;
			animator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).PlayAnimation("Gesture, Override", "Secondary Load", "Taser.playbackRate", minDuration);
			overridingSkillSlot = ((EntityState)this).skillLocator.primary;
			((GenericCharacterMain)this).OnEnter();
		}

		public override void FixedUpdate()
		{
			((GenericCharacterMain)this).FixedUpdate();
			if (!(((EntityState)this).fixedAge >= minDuration))
			{
				return;
			}
			if ((Object)(object)overridingSkillSlot != (Object)null)
			{
				if (!isOverriding)
				{
					isOverriding = true;
					Util.PlaySound("HenryBombThrow", ((EntityState)this).gameObject);
					animator.SetBool("secondaryArmed", true);
					overridingSkillSlot.SetSkillOverride((object)this, StaticValues.FireShockingRevolution, (SkillOverridePriority)4);
					((EntityState)this).PlayAnimation("Gesture, Override", "Secondary Idle", "Taser.playbackRate", minDuration);
				}
			}
			else if (Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.secondary))
			{
				((EntityState)this).skillLocator.secondary.AddOneStock();
				((EntityState)this).outer.SetNextStateToMain();
			}
			if ((Object)(object)overridingSkillSlot != (Object)null && overridingSkillSlot.stock <= 0 && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			if ((Object)(object)overridingSkillSlot != (Object)null && isOverriding)
			{
				isOverriding = false;
				Util.PlaySound("HenryBombThrow", ((EntityState)this).gameObject);
				animator.SetBool("secondaryArmed", false);
				overridingSkillSlot.UnsetSkillOverride((object)this, StaticValues.FireShockingRevolution, (SkillOverridePriority)4);
			}
			((GenericCharacterMain)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)4;
		}
	}
	public class MedicalMal : BaseMeleeAttack
	{
		public static float DamageCoefficient = 15f;

		public override void OnEnter()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			hitboxName = "syringeHitbox";
			damageType = (DamageType)0;
			damageCoefficient = DamageCoefficient;
			procCoefficient = 1f;
			pushForce = 300f;
			bonusForce = Vector3.zero;
			baseDuration = 1.1f;
			attackStartTime = 0.5f;
			attackEndTime = 0.7f;
			baseEarlyExitTime = 0.35f;
			hitStopDuration = 0.012f;
			attackRecoil = 0.25f;
			hitHopVelocity = 1f;
			duration = baseDuration;
			((EntityState)this).characterBody.SetAimTimer(duration);
			animator = ((EntityState)this).GetModelAnimator();
			animator.SetBool("attacking", true);
			animator.SetBool("inCombat", true);
			((EntityState)this).GetModelAnimator().SetFloat("Syringe.playbackRate", 1f);
			((EntityState)this).PlayCrossfade("Gesture, Override", "Syringe Stab", "Syringe.playbackRate", duration, 0.1f);
			base.OnEnter();
		}

		public override void OnExit()
		{
			base.OnExit();
			animator.SetBool("inCombat", false);
			animator.SetBool("attacking", false);
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)3;
		}
	}
	public class PoisonBolt : GenericProjectileBaseState
	{
		public static float baseDelayBeforeFirstShot = 0.1f;

		public static float baseDelayBeforeSecondShot = 0.45f;

		private float delayBeforeSecondShot;

		public static float BaseDuration = 1f;

		private Animator animator;

		public static float DamageCoefficient = 2.4f;

		private int shotsFired = 0;

		public override void OnEnter()
		{
			base.projectilePrefab = Projectiles.poisonBoltSeekingPrefab;
			base.attackSoundString = "HenryShootPistol";
			base.baseDuration = BaseDuration;
			base.baseDelayBeforeFiringProjectile = baseDelayBeforeFirstShot;
			delayBeforeSecondShot = baseDelayBeforeSecondShot / ((BaseState)this).attackSpeedStat;
			base.damageCoefficient = DamageCoefficient;
			base.force = 600f;
			animator = ((EntityState)this).GetModelAnimator();
			animator.SetBool("attacking", true);
			animator.SetBool("inCombat", true);
			base.recoilAmplitude = 0.3f;
			base.bloom = 10f;
			((GenericProjectileBaseState)this).OnEnter();
		}

		public override void FixedUpdate()
		{
			((GenericProjectileBaseState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= delayBeforeSecondShot && shotsFired < 2)
			{
				((GenericProjectileBaseState)this).FireProjectile();
				((GenericProjectileBaseState)this).DoFireEffects();
			}
			if (((EntityState)this).fixedAge >= base.duration && ((EntityState)this).isAuthority)
			{
				animator.SetBool("attacking", false);
				animator.SetBool("inCombat", false);
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void FireProjectile()
		{
			shotsFired++;
			((GenericProjectileBaseState)this).FireProjectile();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}

		public override void PlayAnimation(float duration)
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).GetModelAnimator()))
			{
				((EntityState)this).PlayAnimation("Gesture, Override", "Primary Shoot", "PoisonDart.playbackRate", base.duration / 2f);
			}
		}
	}
	internal class PreventionPassiveComponent : MonoBehaviour
	{
		private CharacterBody body;

		private float countdown = 0f;

		private static BuffDef buff => Buffs.PassivePrevention;

		private void Awake()
		{
			body = ((Component)this).GetComponent<CharacterBody>();
		}

		private void FixedUpdate()
		{
			if (!body.HasBuff(buff))
			{
				countdown -= Time.fixedDeltaTime;
				if (countdown <= 0f)
				{
					countdown = StaticValues.passiveBuffInterval;
					body.AddBuff(buff);
				}
			}
		}

		private void OnEnable()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			if (NetworkServer.active)
			{
				CharacterBody.AddTimedBuff_BuffIndex_float += new hook_AddTimedBuff_BuffIndex_float(TryOverrideBuffIndex);
				CharacterBody.AddTimedBuff_BuffDef_float_int += new hook_AddTimedBuff_BuffDef_float_int(TryOverrideTimedBuffMaxStacks);
				CharacterBody.AddTimedBuff_BuffDef_float += new hook_AddTimedBuff_BuffDef_float(TryOverrideTimedBuff);
				DotController.InflictDot_refInflictDotInfo += new hook_InflictDot_refInflictDotInfo(TryOverrideInflictDot);
			}
		}

		private void OnDisable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			CharacterBody.AddTimedBuff_BuffDef_float_int -= new hook_AddTimedBuff_BuffDef_float_int(TryOverrideTimedBuffMaxStacks);
			CharacterBody.AddTimedBuff_BuffDef_float -= new hook_AddTimedBuff_BuffDef_float(TryOverrideTimedBuff);
			DotController.InflictDot_refInflictDotInfo -= new hook_InflictDot_refInflictDotInfo(TryOverrideInflictDot);
		}

		public static bool OverrideDebuff(BuffIndex buffIndex, CharacterBody body)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			BuffDef buffDef = BuffCatalog.GetBuffDef(buffIndex);
			return Object.op_Implicit((Object)(object)buffDef) && OverrideDebuff(buffDef, body);
		}

		public static bool OverrideDebuff(BuffDef buffDef, CharacterBody body)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			return (int)buffDef.buffIndex != -1 && buffDef.isDebuff && TryApplyOverride(body);
		}

		public static bool OverrideDot(InflictDotInfo inflictDotInfo)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			GameObject victimObject = inflictDotInfo.victimObject;
			CharacterBody val = (((Object)(object)victimObject != (Object)null) ? victimObject.GetComponent<CharacterBody>() : null);
			return Object.op_Implicit((Object)(object)val) && TryApplyOverride(val);
		}

		private static bool TryApplyOverride(CharacterBody body)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			PreventionPassiveComponent component = ((Component)body).GetComponent<PreventionPassiveComponent>();
			if (Object.op_Implicit((Object)(object)component) && body.HasBuff(buff))
			{
				body.RemoveBuff(buff);
				body.AddTimedBuff(Buffs.Cure, StaticValues.cureBaseDuration);
				EffectManager.SimpleImpactEffect(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/ImmuneToDebuff/ImmuneToDebuffEffect.prefab").WaitForCompletion(), body.corePosition, Vector3.up, true);
				return true;
			}
			return false;
		}

		private void TryOverrideInflictDot(orig_InflictDot_refInflictDotInfo orig, ref InflictDotInfo inflictDotInfo)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !OverrideDot(inflictDotInfo))
			{
				orig.Invoke(ref inflictDotInfo);
			}
		}

		private void TryOverrideTimedBuff(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration)
		{
			if (!NetworkServer.active || !OverrideDebuff(buffDef, self))
			{
				orig.Invoke(self, buffDef, duration);
			}
		}

		private void TryOverrideTimedBuffMaxStacks(orig_AddTimedBuff_BuffDef_float_int orig, CharacterBody self, BuffDef buffDef, float duration, int maxStacks)
		{
			if (!NetworkServer.active || !OverrideDebuff(buffDef, self))
			{
				orig.Invoke(self, buffDef, duration, maxStacks);
			}
		}

		private void TryOverrideBuffIndex(orig_AddTimedBuff_BuffIndex_float orig, CharacterBody self, BuffIndex buffIndex, float duration)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !OverrideDebuff(buffIndex, self))
			{
				orig.Invoke(self, buffIndex, duration);
			}
		}
	}
}
namespace RealDoctor.SkillStates.BaseStates
{
	public class BaseMeleeAttack : BaseSkillState
	{
		public int swingIndex;

		protected string hitboxName = "Sword";

		protected DamageType damageType = (DamageType)0;

		protected float damageCoefficient = 3.5f;

		protected float procCoefficient = 1f;

		protected float pushForce = 300f;

		protected Vector3 bonusForce = Vector3.zero;

		protected float baseDuration = 1f;

		protected float attackStartTime = 0.2f;

		protected float attackEndTime = 0.4f;

		protected float baseEarlyExitTime = 0.4f;

		protected float hitStopDuration = 0.012f;

		protected float attackRecoil = 0.75f;

		protected float hitHopVelocity = 4f;

		protected bool cancelled = false;

		protected string swingSoundString = "";

		protected string hitSoundString = "";

		protected string muzzleString = "SwingCenter";

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab;

		protected NetworkSoundEventIndex impactSound;

		private float earlyExitTime;

		public float duration;

		private bool hasFired;

		private float hitPauseTimer;

		private OverlapAttack attack;

		protected bool inHitPause;

		private bool hasHopped;

		protected float stopwatch;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		public override void OnEnter()
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			earlyExitTime = baseEarlyExitTime / ((BaseState)this).attackSpeedStat;
			hasFired = false;
			animator = ((EntityState)this).GetModelAnimator();
			((BaseState)this).StartAimMode(0.5f + duration, false);
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
			HitBoxGroup hitBoxGroup = null;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == hitboxName);
			}
			PlayAttackAnimation();
			attack = new OverlapAttack();
			attack.damageType = damageType;
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.procCoefficient = procCoefficient;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.forceVector = bonusForce;
			attack.pushAwayForce = pushForce;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = ((BaseState)this).RollCrit();
			attack.impactSound = impactSound;
		}

		protected virtual void PlayAttackAnimation()
		{
			((EntityState)this).PlayCrossfade("Gesture, Override", "Slash" + (1 + swingIndex), "Slash.playbackRate", duration, 0.05f);
		}

		public override void OnExit()
		{
			if (!hasFired && !cancelled)
			{
				FireAttack();
			}
			((EntityState)this).OnExit();
			animator.SetBool("attacking", false);
		}

		protected virtual void PlaySwingEffect()
		{
			EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, muzzleString, true);
		}

		protected virtual void OnHitEnemyAuthority()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			Util.PlaySound(hitSoundString, ((EntityState)this).gameObject);
			if (!hasHopped)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded && hitHopVelocity > 0f)
				{
					((BaseState)this).SmallHop(((EntityState)this).characterMotor, hitHopVelocity);
				}
				hasHopped = true;
			}
			if (!inHitPause && hitStopDuration > 0f)
			{
				storedVelocity = ((EntityState)this).characterMotor.velocity;
				hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, "Slash.playbackRate");
				hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat;
				inHitPause = true;
			}
		}

		private void FireAttack()
		{
			if (!hasFired)
			{
				hasFired = true;
				Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
				if (((EntityState)this).isAuthority)
				{
					PlaySwingEffect();
					((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil);
				}
			}
			if (((EntityState)this).isAuthority && attack.Fire((List<HurtBox>)null))
			{
				OnHitEnemyAuthority();
			}
		}

		protected virtual void SetNextState()
		{
			int num = ((swingIndex == 0) ? 1 : 0);
			((EntityState)this).outer.SetNextState((EntityState)(object)new BaseMeleeAttack
			{
				swingIndex = num
			});
		}

		public override void FixedUpdate()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			hitPauseTimer -= Time.fixedDeltaTime;
			if (hitPauseTimer <= 0f && inHitPause)
			{
				((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
				inHitPause = false;
				((EntityState)this).characterMotor.velocity = storedVelocity;
			}
			if (!inHitPause)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			else
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
				}
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.SetFloat("Swing.playbackRate", 0f);
				}
			}
			if (stopwatch >= duration * attackStartTime && stopwatch <= duration * attackEndTime)
			{
				FireAttack();
			}
			if (stopwatch >= duration - earlyExitTime && ((EntityState)this).isAuthority && ((EntityState)this).inputBank.skill1.down)
			{
				if (!hasFired)
				{
					FireAttack();
				}
				SetNextState();
			}
			else if (stopwatch >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(swingIndex);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			swingIndex = reader.ReadInt32();
		}
	}
	public class BaseTimedSkillState : BaseSkillState
	{
		public static float TimedBaseDuration;

		public static float TimedBaseCastStartTime;

		public static float TimedBaseCastEndTime;

		protected float duration;

		protected float castStartTime;

		protected float castEndTime;

		protected bool hasFired;

		protected bool isFiring;

		protected bool hasExited;

		protected virtual void InitDurationValues(float baseDuration, float baseCastStartTime, float baseCastEndTime = 1f)
		{
			TimedBaseDuration = baseDuration;
			TimedBaseCastStartTime = baseCastStartTime;
			TimedBaseCastEndTime = baseCastEndTime;
			duration = TimedBaseDuration / ((BaseState)this).attackSpeedStat;
			castStartTime = baseCastStartTime * duration;
			castEndTime = baseCastEndTime * duration;
		}

		protected virtual void OnCastEnter()
		{
		}

		protected virtual void OnCastFixedUpdate()
		{
		}

		protected virtual void OnCastUpdate()
		{
		}

		protected virtual void OnCastExit()
		{
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!hasFired && ((EntityState)this).fixedAge > castStartTime)
			{
				hasFired = true;
				OnCastEnter();
			}
			bool flag = ((EntityState)this).fixedAge >= castStartTime;
			bool flag2 = ((EntityState)this).fixedAge >= castEndTime;
			isFiring = false;
			if ((flag && !flag2) || (flag && flag2 && !hasFired))
			{
				isFiring = true;
				OnCastFixedUpdate();
			}
			if (flag2 && !hasExited)
			{
				hasExited = true;
				OnCastExit();
			}
			if (((EntityState)this).fixedAge > duration)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void Update()
		{
			((EntityState)this).Update();
			if (isFiring)
			{
				OnCastUpdate();
			}
		}
	}
	public class ExampleTimedSkillState : BaseTimedSkillState
	{
		public static float SkillBaseDuration = 1.5f;

		public static float SkillStartTime = 0.2f;

		public static float SkillEndTime = 0.9f;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			InitDurationValues(SkillBaseDuration, SkillStartTime, SkillEndTime);
		}

		protected override void OnCastEnter()
		{
		}

		protected override void OnCastFixedUpdate()
		{
		}

		protected override void OnCastExit()
		{
		}
	}
	public class ExampleDelayedSkillState : BaseTimedSkillState
	{
		public static float SkillBaseDuration = 1.5f;

		public static float SkillStartTime = 0.2f;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			InitDurationValues(SkillBaseDuration, SkillStartTime);
		}

		protected override void OnCastEnter()
		{
		}
	}
}
namespace RealDoctor.Modules
{
	internal static class Assets
	{
		internal static GameObject swordSwingEffect;

		internal static GameObject swordHitImpactEffect;

		internal static GameObject bombExplosionEffect;

		internal static NetworkSoundEventDef swordHitSoundEvent;

		internal static GameObject boltTrail;

		internal static ModdedDamageType MedicElectrifying;

		internal static ModdedDamageType MedicVenom;

		internal static ModdedDamageType MedicToxin;

		internal static ModdedDamageType MedicAntidote;

		internal static AssetBundle mainAssetBundle;

		private const string assetbundleName = "medicbundle";

		private const string csProjName = "RealDoctor";

		internal static void Initialize()
		{
			bool flag = false;
			LoadAssetBundle();
			LoadSoundbank();
			PopulateAssets();
			ReserveDamageTypes();
		}

		private static void ReserveDamageTypes()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			MedicElectrifying = DamageAPI.ReserveDamageType();
			MedicAntidote = DamageAPI.ReserveDamageType();
			MedicVenom = DamageAPI.ReserveDamageType();
			MedicToxin = DamageAPI.ReserveDamageType();
		}

		internal static void LoadAssetBundle()
		{
			try
			{
				if ((Object)(object)mainAssetBundle == (Object)null)
				{
					using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RealDoctor.medicbundle"))
					{
						mainAssetBundle = AssetBundle.LoadFromStream(stream);
						return;
					}
				}
			}
			catch (Exception ex)
			{
				Log.Error("Failed to load assetbundle. Make sure your assetbundle name is setup correctly\n" + ex);
			}
		}

		internal static void LoadSoundbank()
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("RealDoctor.HenryBank.bnk");
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			SoundBanks.Add(array);
		}

		internal static void PopulateAssets()
		{
			if (!Object.op_Implicit((Object)(object)mainAssetBundle))
			{
				Log.Error("There is no AssetBundle to load assets from.");
				return;
			}
			boltTrail = mainAssetBundle.LoadAsset<GameObject>("dart_poison");
			swordHitSoundEvent = CreateNetworkSoundEventDef("HenrySwordHit");
		}

		private static GameObject CreateTracer(string originalTracerName, string newTracerName)
		{
			if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null)
			{
				return null;
			}
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true);
			if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>()))
			{
				val.AddComponent<EffectComponent>();
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>()))
			{
				val.AddComponent<VFXAttributes>();
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
			{
				val.AddComponent<NetworkIdentity>();
			}
			val.GetComponent<Tracer>().speed = 250f;
			val.GetComponent<Tracer>().length = 50f;
			AddNewEffectDef(val);
			return val;
		}

		internal static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName)
		{
			NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
			val.akId = AkSoundEngine.GetIDFromString(eventName);
			val.eventName = eventName;
			Content.AddNetworkSoundEventDef(val);
			return val;
		}

		internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert)
		{
			if (!Object.op_Implicit((Object)(object)objectToConvert))
			{
				return;
			}
			Renderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				if (val != null)
				{
					val.material?.SetHopooMaterial();
				}
			}
		}

		internal static RendererInfo[] SetupRendererInfos(GameObject obj)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length];
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				array[i] = new RendererInfo
				{
					defaultMaterial = ((Renderer)componentsInChildren[i]).material,
					renderer = (Renderer)(object)componentsInChildren[i],
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				};
			}
			return array;
		}

		public static GameObject LoadSurvivorModel(string modelName)
		{
			GameObject val = mainAssetBundle.LoadAsset<GameObject>(modelName);
			if ((Object)(object)val == (Object)null)
			{
				Log.Error("Trying to load a null model- check to see if the BodyName in your code matches the prefab name of the object in Unity\nFor Example, if your prefab in unity is 'mdlHenry', then your BodyName must be 'Henry'");
				return null;
			}
			return PrefabAPI.InstantiateClone(val, ((Object)val).name, false);
		}

		internal static GameObject LoadCrosshair(string crosshairName)
		{
			if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair") == (Object)null)
			{
				return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair");
			}
			return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair");
		}

		private static GameObject LoadEffect(string resourceName)
		{
			return LoadEffect(resourceName, "", parentToTransform: false);
		}

		private static GameObject LoadEffect(string resourceName, string soundName)
		{
			return LoadEffect(resourceName, soundName, parentToTransform: false);
		}

		private static GameObject LoadEffect(string resourceName, bool parentToTransform)
		{
			return LoadEffect(resourceName, "", parentToTransform);
		}

		private static GameObject LoadEffect(string resourceName, string soundName, bool parentToTransform)
		{
			//IL_0053: 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)
			GameObject val = mainAssetBundle.LoadAsset<GameObject>(resourceName);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error("Failed to load effect: " + resourceName + " because it does not exist in the AssetBundle");
				return null;
			}
			val.AddComponent<DestroyOnTimer>().duration = 12f;
			val.AddComponent<NetworkIdentity>();
			val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
			EffectComponent val2 = val.AddComponent<EffectComponent>();
			val2.applyScale = false;
			val2.effectIndex = (EffectIndex)(-1);
			val2.parentToReferencedTransform = parentToTransform;
			val2.positionAtReferencedTransform = true;
			val2.soundName = soundName;
			AddNewEffectDef(val, soundName);
			return val;
		}

		private static void AddNewEffectDef(GameObject effectPrefab)
		{
			AddNewEffectDef(effectPrefab, "");
		}

		private static void AddNewEffectDef(GameObject effectPrefab, string soundName)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			EffectDef val = new EffectDef();
			val.prefab = effectPrefab;
			val.prefabEffectComponent = effectPrefab.GetComponent<EffectComponent>();
			val.prefabName = ((Object)effectPrefab).name;
			val.prefabVfxAttributes = effectPrefab.GetComponent<VFXAttributes>();
			val.spawnSoundEventName = soundName;
			Content.AddEffectDef(val);
		}
	}
	public static class Buffs
	{
		public class VenomController : MonoBehaviour
		{
			public float interval = 0.2f;

			public float timer;

			public float totalDamage = 5f;

			public float damageCoefficient;

			public float duration = 1f;

			public HealthComponent victimHealthComponent;

			public CharacterBody victimBody;

			public CharacterBody attackerBody;

			public DamageInfo info;

			private void Start()
			{
				attackerBody = ((Component)this).GetComponent<CharacterBody>();
				victimHealthComponent = ((Component)attackerBody).GetComponent<HealthComponent>();
				victimBody = ((Component)attackerBody).GetComponent<CharacterBody>();
				damageCoefficient = interval / duration;
			}

			private void FixedUpdate()
			{
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//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_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Expected O, but got Unknown
				timer += Time.fixedDeltaTime;
				duration -= Time.fixedDeltaTime;
				if (timer >= interval && duration >= 0f)
				{
					if (Object.op_Implicit((Object)(object)victimHealthComponent))
					{
						info = new DamageInfo
						{
							attacker = ((Component)this).gameObject,
							crit = false,
							damage = damageCoefficient * totalDamage,
							damageColorIndex = (DamageColorIndex)9,
							force = Vector3.zero,
							procCoefficient = 0.01f,
							damageType = (DamageType)4096,
							position = victimHealthComponent.body.corePosition,
							dotIndex = (DotIndex)(-1),
							inflictor = ((Component)this).gameObject
						};
						victimHealthComponent.TakeDamage(info);
					}
					timer = 0f;
				}
				if (duration < 0f)
				{
					Object.Destroy((Object)(object)this);
				}
			}
		}

		internal static BuffDef armorBuff;

		internal static BuffDef Antidote;

		internal static BuffDef Cure;

		internal static BuffDef Toxin;

		internal static BuffDef Venom;

		internal static BuffDef Electrocuted;

		internal static BuffDef PassivePrevention;

		internal static void RegisterBuffs()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			armorBuff = AddNewBuff("HenryArmorBuff", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/HiddenInvincibility").iconSprite, Color.white, canStack: false, isDebuff: false);
			Antidote = AddNewBuff("MedicAntitode", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/HiddenInvincibility").iconSprite, Color.green, canStack: true, isDebuff: true);
			Cure = AddNewBuff("MedicCure", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/HiddenInvincibility").iconSprite, Color.green, canStack: true, isDebuff: true);
			Toxin = AddNewBuff("MedicToxin", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/HiddenInvincibility").iconSprite, Color.green, canStack: true, isDebuff: true);
			Venom = AddNewBuff("MedicVenom", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/HiddenInvincibility").iconSprite, Color.magenta, canStack: true, isDebuff: true);
			Electrocuted = AddNewBuff("MedicShocking", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/HiddenInvincibility").iconSprite, Color.blue, canStack: true, isDebuff: true);
			PassivePrevention = AddNewBuff("MedicDebuffPrevention", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/HiddenInvincibility").iconSprite, Color.blue, canStack: false, isDebuff: false);
		}

		internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val).name = buffName;
			val.buffColor = buffColor;
			val.canStack = canStack;
			val.isDebuff = isDebuff;
			val.eliteDef = null;
			val.iconSprite = buffIcon;
			Content.AddBuffDef(val);
			return val;
		}
	}
	public static class Config
	{
		public static void ReadConfig()
		{
		}

		public static ConfigEntry<bool> CharacterEnableConfig(string characterName, string description = "Set to false to disable this character", bool enabledDefault = true)
		{
			return ((BaseUnityPlugin)MedicPlugin.instance).Config.Bind<bool>("General", "Enable " + characterName, enabledDefault, description);
		}
	}
	internal class ContentPacks : IContentPackProvider
	{
		internal ContentPack contentPack = new ContentPack();

		public static List<GameObject> bodyPrefabs = new List<GameObject>();

		public static List<GameObject> masterPrefabs = new List<GameObject>();

		public static List<GameObject> projectilePrefabs = new List<GameObject>();

		public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>();

		public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>();

		public static List<SkillFamily> skillFamilies = new List<SkillFamily>();

		public static List<SkillDef> skillDefs = new List<SkillDef>();

		public static List<Type> entityStates = new List<Type>();

		public static List<BuffDef> buffDefs = new List<BuffDef>();

		public static List<EffectDef> effectDefs = new List<EffectDef>();

		public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();

		public string identifier => "com.borbreapr.FieldMedicIsAnOriginalCharacter";

		public void Initialize()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)this);
		}

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			contentPack.identifier = identifier;
			contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray());
			contentPack.masterPrefabs.Add(masterPrefabs.ToArray());
			contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
			contentPack.survivorDefs.Add(survivorDefs.ToArray());
			contentPack.unlockableDefs.Add(unlockableDefs.ToArray());
			contentPack.skillDefs.Add(skillDefs.ToArray());
			contentPack.skillFamilies.Add(skillFamilies.ToArray());
			contentPack.entityStateTypes.Add(entityStates.ToArray());
			contentPack.buffDefs.Add(buffDefs.ToArray());
			contentPack.effectDefs.Add(effectDefs.ToArray());
			contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray());
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	internal class Content
	{
		public static void AddCharacterBodyPrefab(GameObject bprefab)
		{
			ContentPacks.bodyPrefabs.Add(bprefab);
		}

		public static void AddMasterPrefab(GameObject prefab)
		{
			ContentPacks.masterPrefabs.Add(prefab);
		}

		public static void AddProjectilePrefab(GameObject prefab)
		{
			ContentPacks.projectilePrefabs.Add(prefab);
		}

		public static void AddSurvivorDef(SurvivorDef survivorDef)
		{
			ContentPacks.survivorDefs.Add(survivorDef);
		}

		public static void AddUnlockableDef(UnlockableDef unlockableDef)
		{
			ContentPacks.unlockableDefs.Add(unlockableDef);
		}

		public static void AddSkillDef(SkillDef skillDef)
		{
			ContentPacks.skillDefs.Add(skillDef);
		}

		public static void AddSkillFamily(SkillFamily skillFamily)
		{
			ContentPacks.skillFamilies.Add(skillFamily);
		}

		public static void AddEntityState(Type entityState)
		{
			ContentPacks.entityStates.Add(entityState);
		}

		public static void AddBuffDef(BuffDef buffDef)
		{
			ContentPacks.buffDefs.Add(buffDef);
		}

		public static void AddEffectDef(EffectDef effectDef)
		{
			ContentPacks.effectDefs.Add(effectDef);
		}

		public static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef)
		{
			ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef);
		}
	}
	internal static class Helpers
	{
		internal const string agilePrefix = "<style=cIsUtility>Agile.</style> ";

		internal static string ScepterDescription(string desc)
		{
			return "\n<color=#d299ff>SCEPTER: " + desc + "</color>";
		}

		public static T[] Append<T>(ref T[] array, List<T> list)
		{
			int num = array.Length;
			int count = list.Count;
			Array.Resize(ref array, num + count);
			list.CopyTo(array, num);
			return array;
		}

		public static Func<T[], T[]> AppendDel<T>(List<T> list)
		{
			return (T[] r) => Append(ref r, list);
		}
	}
	internal static class Hooks
	{
		internal static void Initialize()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(MedicDamageTypeOnHit);
			GlobalEventManager.OnHitAll += new hook_OnHitAll(MedicFriendlyFireDamageType);
			ProjectileDirectionalTargetFinder.SearchForTarget += new hook_SearchForTarget(OverrideTargetFinderTeamIfApplicable);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(MedicStatBuffs);
		}

		private static void MedicStatBuffs(CharacterBody sender, StatHookEventArgs args)
		{
			float num = 1f + 0.2f * (sender.level - 1f);
			int buffCount = sender.GetBuffCount(Buffs.Antidote);
			if (buffCount > 0)
			{
				args.baseRegenAdd += StaticValues.antidoteRegen * (float)buffCount * num;
			}
			int buffCount2 = sender.GetBuffCount(Buffs.Cure);
			if (buffCount2 > 0)
			{
				args.baseRegenAdd += StaticValues.cureRegen * (float)buffCount2 * num;
				args.armorAdd += StaticValues.cureRegen;
			}
		}

		private static void OverrideTargetFinderTeamIfApplicable(orig_SearchForTarget orig, ProjectileDirectionalTargetFinder self)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (self is ProjectileDirectionalTargetFinderNoTeam)
			{
				self.bullseyeSearch.teamMaskFilter = TeamMask.allButNeutral;
				self.bullseyeSearch.filterByLoS = self.testLoS;
				self.bullseyeSearch.searchOrigin = self.transform.position;
				self.bullseyeSearch.searchDirection = self.transform.forward;
				self.bullseyeSearch.maxDistanceFilter = self.lookRange;
				self.bullseyeSearch.sortMode = (SortMode)3;
				self.bullseyeSearch.maxAngleFilter = self.lookCone;
				self.bullseyeSearch.RefreshCandidates();
				IEnumerable<HurtBox> source = self.bullseyeSearch.GetResults().Where((Func<HurtBox, bool>)self.PassesFilters);
				self.SetTarget(source.FirstOrDefault());
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private static void MedicFriendlyFireDamageType(orig_OnHitAll orig, GlobalEventManager self, DamageInfo damageInfo, GameObject hitObject)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			if (DamageAPI.HasModdedDamageType(damageInfo, Assets.MedicAntidote))
			{
				GameObject attacker = damageInfo.attacker;
				CharacterBody val = ((attacker != null) ? attacker.GetComponent<CharacterBody>() : null);
				HurtBox component = hitObject.GetComponent<HurtBox>();
				if ((Object)(object)val != (Object)null && (Object)(object)component != (Object)null)
				{
					CharacterBody body = component.healthComponent.body;
					if ((Object)(object)body != (Object)null && val.teamComponent.teamIndex == body.teamComponent.teamIndex && NetworkServer.active)
					{
						val.AddTimedBuff(Buffs.Antidote, StaticValues.antidoteBaseDuration);
						body.AddTimedBuff(Buffs.Antidote, StaticValues.antidoteBaseDuration);
					}
				}
			}
			orig.Invoke(self, damageInfo, hitObject);
		}

		private static void MedicDamageTypeOnHit(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_0002: 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_0035: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			if (DamageAPI.HasModdedDamageType(damageInfo, Assets.MedicElectrifying))
			{
				TeamComponent component = damageInfo.attacker.GetComponent<TeamComponent>();
				if ((Object)(object)component != (Object)null)
				{
					LightningOrb val = new LightningOrb();
					((Orb)val).origin = damageInfo.position;
					val.damageValue = damageInfo.damage * 0.5f;
					val.isCrit = damageInfo.crit;
					val.bouncesRemaining = 2;
					val.teamIndex = component.teamIndex;
					val.attacker = damageInfo.attacker;
					val.bouncedObjects = new List<HealthComponent> { victim.GetComponent<HealthComponent>() };
					val.procChainMask = damageInfo.procChainMask;
					((ProcChainMask)(ref val.procChainMask)).AddProc((ProcType)3);
					val.procCoefficient = 0.2f;
					val.lightningType = (LightningType)1;
					val.damageColorIndex = (DamageColorIndex)0;
					val.range += 12f;
					val.damageType = (DamageType)(val.damageType | 0x20);
					HurtBox val2 = val.PickNextTarget(damageInfo.position);
					if (Object.op_Implicit((Object)(object)val2))
					{
						((Orb)val).target = val2;
						OrbManager.instance.AddOrb((Orb)(object)val);
					}
				}
			}
			orig.Invoke(self, damageInfo, victim);
		}
	}
	internal static class ItemDisplays
	{
		private static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>();

		internal static void PopulateDisplays()
		{
			PopulateFromBody("MageBody");
			PopulateFromBody("LunarExploderBody");
			PopulateCustomLightningArm();
		}

		private static void PopulateFromBody(string bodyName)
		{
			ItemDisplayRuleSet itemDisplayRuleSet = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyName).GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>().itemDisplayRuleSet;
			KeyAssetRuleGroup[] keyAssetRuleGroups = itemDisplayRuleSet.keyAssetRuleGroups;
			for (int i = 0; i < keyAssetRuleGroups.Length; i++)
			{
				ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules;
				for (int j = 0; j < rules.Length; j++)
				{
					GameObject followerPrefab = rules[j].followerPrefab;
					if (Object.op_Implicit((Object)(object)followerPrefab))
					{
						string key = ((Object)followerPrefab).name?.ToLowerInvariant();
						if (!itemDisplayPrefabs.ContainsKey(key))
						{
							itemDisplayPrefabs[key] = followerPrefab;
						}
					}
				}
			}
		}

		private static void PopulateCustomLightningArm()
		{
			GameObject val = PrefabAPI.InstantiateClone(itemDisplayPrefabs["displaylightningarmright"], "DisplayLightningCustom", false);
			LimbMatcher component = val.GetComponent<LimbMatcher>();
			component.limbPairs[0].targetChildLimb = "LightningArm1";
			component.limbPairs[1].targetChildLimb = "LightningArm2";
			component.limbPairs[2].targetChildLimb = "LightningArmEnd";
			itemDisplayPrefabs["displaylightningarmcustom"] = val;
		}

		public static GameObject LoadDisplay(string name)
		{
			if (itemDisplayPrefabs.ContainsKey(name.ToLowerInvariant()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLowerInvariant()]))
			{
				return itemDisplayPrefabs[name.ToLowerInvariant()];
			}
			Log.Error("item display " + name + " returned null");
			return null;
		}
	}
	internal static class Materials
	{
		private static List<Material> cachedMaterials = new List<Material>();

		internal static Shader hotpoo = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard");

		public static Material CreateHopooMaterial(string materialName)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			Material val = cachedMaterials.Find(delegate(Material mat)
			{
				materialName.Replace(" (Instance)", "");
				return ((Object)mat).name.Contains(materialName);
			});
			if (Object.op_Implicit((Object)(object)val))
			{
				return val;
			}
			val = Assets.mainAssetBundle.LoadAsset<Material>(materialName);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error("Failed to load material: " + materialName + " - Check to see that the material in your Unity project matches this name");
				return new Material(hotpoo);
			}
			return val.SetHopooMaterial();
		}

		public static Material SetHopooMaterial(this Material tempMat)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			if (cachedMaterials.Contains(tempMat))
			{
				return tempMat;
			}
			float? num = null;
			Color? val = null;
			if (tempMat.IsKeywordEnabled("_NORMALMAP"))
			{
				num = tempMat.GetFloat("_BumpScale");
			}
			if (tempMat.IsKeywordEnabled("_EMISSION"))
			{
				val = tempMat.GetColor("_EmissionColor");
			}
			tempMat.shader = hotpoo;
			tempMat.SetColor("_Color", tempMat.GetColor("_Color"));
			tempMat.SetTexture("_MainTex", tempMat.GetTexture("_MainTex"));
			tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap"));
			tempMat.EnableKeyword("DITHER");
			if (num.HasValue)
			{
				tempMat.SetFloat("_NormalStrength", num.Value);
			}
			if (val.HasValue)
			{
				tempMat.SetColor("_EmColor", val.Value);
				tempMat.SetFloat("_EmPower", 1f);
			}
			if (tempMat.IsKeywordEnabled("NOCULL"))
			{
				tempMat.SetInt("_Cull", 0);
			}
			if (tempMat.IsKeywordEnabled("LIMBREMOVAL"))
			{
				tempMat.SetInt("_LimbRemovalOn", 1);
			}
			cachedMaterials.Add(tempMat);
			return tempMat;
		}

		public static Material MakeUnique(this Material material)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (cachedMaterials.Contains(material))
			{
				return new Material(material);
			}
			return material;
		}

		public static Material SetColor(this Material material, Color color)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			material.SetColor("_Color", color);
			return material;
		}

		public static Material SetNormal(this Material material, float normalStrength = 1f)
		{
			material.SetFloat("_NormalStrength", normalStrength);
			return material;
		}

		public static Material SetEmission(this Material material)
		{
			return material.SetEmission(1f);
		}

		public static Material SetEmission(this Material material, float emission)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return material.SetEmission(emission, Color.white);
		}

		public static Material SetEmission(this Material material, float emission, Color emissionColor)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			material.SetFloat("_EmPower", emission);
			material.SetColor("_EmColor", emissionColor);
			return material;
		}

		public static Material SetCull(this Material material, bool cull = false)
		{
			material.SetInt("_Cull", cull ? 1 : 0);
			return material;
		}
	}
	internal static class Prefabs
	{
		private static PhysicMaterial ragdollMaterial;

		public static GameObject CreateDisplayPrefab(string displayModelName, GameObject prefab, BodyInfo bodyInfo)
		{
			GameObject val = Assets.LoadSurvivorModel(displayModelName);
			CharacterModel val2 = val.GetComponent<CharacterModel>();
			if (!Object.op_Implicit((Object)(object)val2))
			{
				val2 = val.AddComponent<CharacterModel>();
			}
			val2.baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos;
			Assets.ConvertAllRenderersToHopooShader(val);
			return val.gameObject;
		}

		public static GameObject CreateBodyPrefab(string bodyName, string modelName, BodyInfo bodyInfo)
		{
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyInfo.bodyNameToClone + "Body");
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.Error(bodyInfo.bodyNameToClone + "Body is not a valid body, character creation failed");
				return null;
			}
			GameObject val2 = PrefabAPI.InstantiateClone(val, bodyName);
			Transform val3 = null;
			GameObject val4 = null;
			if (modelName != "mdl")
			{
				val4 = Assets.LoadSurvivorModel(modelName);
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = ((Component)val2.GetComponentInChildren<CharacterModel>()).gameObject;
				}
				val3 = AddCharacterModelToSurvivorBody(val2, val4.transform, bodyInfo);
			}
			CharacterBody component = val2.GetComponent<CharacterBody>();
			((Object)component).name = bodyInfo.bodyName;
			component.baseNameToken = bodyInfo.bodyNameToken;
			component.subtitleNameToken = bodyInfo.subtitleNameToken;
			component.portraitIcon = bodyInfo.characterPortrait;
			component.bodyColor = bodyInfo.bodyColor;
			component._defaultCrosshairPrefab = bodyInfo.crosshair;
			component.hideCrosshair = false;
			component.preferredPodPrefab = bodyInfo.podPrefab;
			component.baseMaxHealth = bodyInfo.maxHealth;
			component.baseRegen = bodyInfo.healthRegen;
			component.baseArmor = bodyInfo.armor;
			component.baseMaxShield = bodyInfo.shield;
			component.baseDamage = bodyInfo.damage;
			component.baseAttackSpeed = bodyInfo.attackSpeed;
			component.baseCrit = bodyInfo.crit;
			component.baseMoveSpeed = bodyInfo.moveSpeed;
			component.baseJumpPower = bodyInfo.jumpPower;
			component.autoCalculateLevelStats = bodyInfo.autoCalculateLevelStats;
			if (bodyInfo.autoCalculateLevelStats)
			{
				component.levelMaxHealth = Mathf.Round(component.baseMaxHealth * 0.3f);
				component.levelMaxShield = Mathf.Round(component.baseMaxShield * 0.3f);
				component.levelRegen = component.baseRegen * 0.2f;
				component.levelMoveSpeed = 0f;
				component.levelJumpPower = 0f;
				component.levelDamage = component.baseDamage * 0.2f;
				component.levelAttackSpeed = 0f;
				component.levelCrit = 0f;
				component.levelArmor = 0f;
			}
			else
			{
				component.levelMaxHealth = bodyInfo.healthGrowth;
				component.levelMaxShield = bodyInfo.shieldGrowth;
				component.levelRegen = bodyInfo.regenGrowth;
				component.levelMoveSpeed = bodyInfo.moveSpeedGrowth;
				component.levelJumpPower = bodyInfo.jumpPowerGrowth;
				component.levelDamage = bodyInfo.damageGrowth;
				component.levelAttackSpeed = bodyInfo.attackSpeedGrowth;
				component.levelCrit = bodyInfo.critGrowth;
				component.levelArmor = bodyInfo.armorGrowth;
			}
			component.baseAcceleration = bodyInfo.acceleration;
			component.baseJumpCount = bodyInfo.jumpCount;
			component.sprintingSpeedMultiplier = 1.45f;
			component.bodyFlags = (BodyFlags)16;
			component.rootMotionInMainState = false;
			component.hullClassification = (HullClassification)0;
			component.isChampion = false;
			SetupCameraTargetParams(val2, bodyInfo);
			SetupModelLocator(val2, val3, val4.transform);
			SetupCapsuleCollider(val2);
			SetupMainHurtbox(val2, val4);
			SetupAimAnimator(val2, val4);
			if ((Object)(object)val3 != (Object)null)
			{
				SetupCharacterDirection(val2, val3, val4.transform);
			}
			SetupFootstepController(val4);
			SetupRagdoll(val4);
			Content.AddCharacterBodyPrefab(val2);
			return val2;
		}

		public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy)
		{
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true);
			val.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab;
			Content.AddMasterPrefab(val);
		}

		private static Transform AddCharacterModelToSurvivorBody(GameObject bodyPrefab, Transform modelTransform, BodyInfo bodyInfo)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			for (int num = bodyPrefab.transform.childCount - 1; num >= 0; num--)
			{
				Object.DestroyImmediate((Object)(object)((Component)bodyPrefab.transform.GetChild(num)).gameObject);
			}
			Transform transform = new GameObject("ModelBase").transform;
			transform.parent = bodyPrefab.transform;
			transform.localPosition = bodyInfo.modelBasePosition;
			transform.localRotation = Quaternion.identity;
			modelTransform.parent = ((Component)transform).transform;
			modelTransform.localPosition = Vector3.zero;
			modelTransform.localRotation = Quaternion.identity;
			GameObject val = new GameObject("CameraPivot");
			val.transform.parent = bodyPrefab.transform;
			val.transform.localPosition = bodyInfo.cameraPivotPosition;
			val.transform.localRotation = Quaternion.identity;
			GameObject val2 = new GameObject("AimOrigin");
			val2.transform.parent = bodyPrefab.transform;
			val2.transform.localPosition = bodyInfo.aimOriginPosition;
			val2.transform.localRotation = Quaternion.identity;
			bodyPrefab.GetComponent<CharacterBody>().aimOriginTransform = val2.transform;
			return ((Component)transform).transform;
		}

		public static CharacterModel SetupCharacterModel(GameObject prefab)
		{
			return SetupCharacterModel(prefab, null);
		}

		public static CharacterModel SetupCharacterModel(GameObject prefab, CustomRendererInfo[] customInfos)
		{
			CharacterModel val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponent<CharacterModel>();
			bool flag = (Object)(object)val != (Object)null;
			if (!flag)
			{
				val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.AddComponent<CharacterModel>();
			}
			val.body = prefab.GetComponent<CharacterBody>();
			val.autoPopulateLightInfos = true;
			val.invisibilityCount = 0;
			val.temporaryOverlays = new List<TemporaryOverlay>();
			if (!flag)
			{
				SetupCustomRendererInfos(val, customInfos);
			}
			else
			{
				SetupPreAttachedRendererInfos(val);
			}
			return val;
		}

		public static void SetupPreAttachedRendererInfos(CharacterModel characterModel)
		{
			for (int i = 0; i < characterModel.baseRendererInfos.Length; i++)
			{
				if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null)
				{
					characterModel.baseRendererInfos[i].defaultMaterial = characterModel.baseRendererInfos[i].renderer.sharedMaterial;
				}
				characterModel.baseRendererInfos[i].defaultMaterial.SetHopooMaterial();
			}
		}

		public static void SetupCustomRendererInfos(CharacterModel characterModel, CustomRendererInfo[] customInfos)
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			ChildLocator component = ((Component)characterModel).GetComponent<ChildLocator>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				Log.Error("Failed CharacterModel setup: ChildLocator component does not exist on the model");
				return;
			}
			List<RendererInfo> list = new List<RendererInfo>();
			for (int i = 0; i < customInfos.Length; i++)
			{
				if (!Object.op_Implicit((Object)(object)component.FindChild(customInfos[i].childName)))
				{
					Log.Error("Trying to add a RendererInfo for a renderer that does not exist: " + customInfos[i].childName);
					continue;
				}
				Renderer component2 = ((Component)component.FindChild(customInfos[i].childName)).GetComponent<Renderer>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					Material val = customInfos[i].material;
					if ((Object)(object)val == (Object)null)
					{
						val = ((!customInfos[i].dontHotpoo) ? component2.material.SetHopooMaterial() : component2.material);
					}
					list.Add(new RendererInfo
					{
						renderer = component2,
						defaultMaterial = val,
						ignoreOverlays = customInfos[i].ignoreOverlays,
						defaultShadowCastingMode = (ShadowCastingMode)1
					});
				}
			}
			characterModel.baseRendererInfos = list.ToArray();
		}

		private static void SetupCharacterDirection(GameObject prefab, Transform modelBaseTransform, Transform modelTransform)
		{
			if (Object.op_Implicit((Object)(object)prefab.GetComponent<CharacterDirection>()))
			{
				CharacterDirection component = prefab.GetComponent<CharacterDirection>();
				component.targetTransform = modelBaseTransform;
				component.overrideAnimatorForwardTransform = null;
				component.rootMotionAccumulator = null;
				component.modelAnimator = ((Component)modelTransform).GetComponent<Animator>();
				component.driveFromRootRotation = false;
				component.turnSpeed = 720f;
			}
		}

		private static void SetupCameraTargetParams(GameObject prefab, BodyInfo bodyInfo)
		{
			CameraTargetParams component = prefab.GetComponent<CameraTargetParams>();
			component.cameraParams = bodyInfo.cameraParams;
			component.cameraPivotTransform = prefab.transform.Find("CameraPivot");
		}

		private static void SetupModelLocator(GameObject prefab, Transform modelBaseTransform, Transform modelTransform)
		{
			ModelLocator component = prefab.GetComponent<ModelLocator>();
			component.modelTransform = modelTransform;
			component.modelBaseTransform = modelBaseTransform;
		}

		private static void SetupCapsuleCollider(GameObject prefab)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			CapsuleCollider component = prefab.GetComponent<CapsuleCollider>();
			component.center = new Vector3(0f, 0f, 0f);
			component.radius = 0.5f;
			component.height = 1.82f;
			component.direction = 1;
		}

		private static void SetupMainHurtbox(GameObject prefab, GameObject model)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			ChildLocator component = model.GetComponent<ChildLocator>();
			if (!Object.op_Implicit((Object)(object)component.FindChild("MainHurtbox")))
			{
				Debug.LogWarning((object)"Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator component called 'MainHurtbox'");
				return;
			}
			HurtBoxGroup val = model.AddComponent<HurtBoxGroup>();
			HurtBox val2 = ((Component)component.FindChild("MainHurtbox")).gameObject.AddComponent<HurtBox>();
			((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal;
			val2.healthComponent = prefab.GetComponent<HealthComponent>();
			val2.isBullseye = true;
			val2.damageModifier = (DamageModifier)0;
			val2.hurtBoxGroup = val;
			val2.indexInGroup = 0;
			val.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val2 };
			val.mainHurtBox = val2;
			val.bullseyeCount = 1;
		}

		public static void SetupHurtBoxes(GameObject bodyPrefab)
		{
			HealthComponent component = bodyPrefab.GetComponent<HealthComponent>();
			HurtBoxGroup[] componentsInChildren = bodyPrefab.GetComponentsInChildren<HurtBoxGroup>();
			foreach (HurtBoxGroup val in componentsInChildren)
			{
				val.mainHurtBox.healthComponent = component;
				for (int j = 0; j < val.hurtBoxes.Length; j++)
				{
					val.hurtBoxes[j].healthComponent = component;
				}
			}
		}

		private static void SetupFootstepController(GameObject model)
		{
			FootstepHandler val = model.AddComponent<FootstepHandler>();
			val.baseFootstepString = "Play_player_footstep";
			val.sprintFootstepOverrideString = "";
			val.enableFootstepDust = true;
			val.footstepDustPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/GenericFootstepDust");
		}

		private static void SetupRagdoll(GameObject model)
		{
			RagdollController component = model.GetComponent<RagdollController>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			if ((Object)(object)ragdollMaterial == (Object)null)
			{
				ragdollMaterial = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<RagdollController>().bones[1]).GetComponent<Collider>().material;
			}
			Transform[] bones = component.bones;
			foreach (Transform val in bones)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					((Component)val).gameObject.layer = LayerIndex.ragdoll.intVal;
					Collider component2 = ((Component)val).GetComponent<Collider>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						component2.material = ragdollMaterial;
						component2.sharedMaterial = ragdollMaterial;
					}
				}
			}
		}

		private static void SetupAimAnimator(GameObject prefab, GameObject model)
		{
			AimAnimator val = model.AddComponent<AimAnimator>();
			val.directionComponent = prefab.GetComponent<CharacterDirection>();
			val.pitchRangeMax = 60f;
			val.pitchRangeMin = -60f;
			val.yawRangeMin = -80f;
			val.yawRangeMax = 80f;
			val.pitchGiveupRange = 30f;
			val.yawGiveupRange = 10f;
			val.giveupDuration = 3f;
			val.inputBank = prefab.GetComponent<InputBankTest>();
		}

		public static void SetupHitbox(GameObject prefab, Transform hitboxTransform, string hitboxName)
		{
			HitBoxGroup val = prefab.AddComponent<HitBoxGroup>();
			HitBox val2 = ((Component)hitboxTransform).gameObject.AddComponent<HitBox>();
			((Component)hitboxTransform).gameObject.layer = LayerIndex.projectile.intVal;
			val.hitBoxes = (HitBox[])(object)new HitBox[1] { val2 };
			val.groupName = hitboxName;
		}

		public static void SetupHitbox(GameObject prefab, string hitboxName, params Transform[] hitboxTransforms)
		{
			HitBoxGroup val = prefab.AddComponent<HitBoxGroup>();
			List<HitBox> list = new List<HitBox>();
			foreach (Transform val2 in hitboxTransforms)
			{
				HitBox item = ((Component)val2).gameObject.AddComponent<HitBox>();
				((Component)val2).gameObject.layer = LayerIndex.projectile.intVal;
				list.Add(item);
			}
			val.hitBoxes = list.ToArray();
			val.groupName = hitboxName;
		}
	}
	public class CustomRendererInfo
	{
		public string childName;

		public Material material = null;

		public bool dontHotpoo = false;

		public bool ignoreOverlays = false;
	}
	internal static class Projectiles
	{
		internal static GameObject bombPrefab;

		internal static GameObject poisonBoltSeekingPrefab;

		internal static GameObject poisonBoltPrefab;

		internal static void RegisterProjectiles()
		{
			CreatePoisonBolt();
			CreateSeekingPoisonBolt();
			AddProjectile(poisonBoltPrefab);
			AddProjectile(poisonBoltSeekingPrefab);
		}

		private static void CreatePoisonBolt()
		{
			//IL_0021: 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)
			poisonBoltPrefab = CloneProjectilePrefab("SyringeProjectile", "MedicPoisonBolt");
			ModdedDamageTypeHolderComponent val = poisonBoltPrefab.AddComponent<ModdedDamageTypeHolderComponent>();
			val.Add(Assets.MedicToxin);
			val.Add(Assets.MedicAntidote);
			ProjectileDamage component = poisonBoltPrefab.GetComponent<ProjectileDamage>();
			ProjectileSimple component2 = poisonBoltPrefab.GetComponent<ProjectileSimple>();
			component2.updateAfterFiring = true;
			component2.desiredForwardSpeed = 120f;
			ProjectileSingleTargetImpact component3 = poisonBoltPrefab.GetComponent<ProjectileSingleTargetImpact>();
			ProjectileController component4 = poisonBoltPrefab.GetComponent<ProjectileController>();
			component4.procCoefficient = 1f;
			component4.ghostPrefab = CreateGhostPrefab("mdlBolt_Big");
			GameObject boltTrail = Assets.boltTrail;
			boltTrail.transform.parent = component4.ghostPrefab.transform;
		}

		private static void CreateSeekingPoisonBolt()
		{
			poisonBoltSeekingPrefab = PrefabAPI.InstantiateClone(poisonBoltPrefab, "MedicPoisonBoltSeeking");
			ProjectileSteerTowardTarget val = poisonBoltSeekingPrefab.AddComponent<ProjectileSteerTowardTarget>();
			val.rotationSpeed = 180f;
			ProjectileDirectionalTargetFinderNoTeam projectileDirectionalTargetFinderNoTeam = poisonBoltSeekingPrefab.AddComponent<ProjectileDirectionalTargetFinderNoTeam>();
			((ProjectileDirectionalTargetFinder)projectileDirectionalTargetFinderNoTeam).lookCone = 8f;
			((ProjectileDirectionalTargetFinder)projectileDirectionalTargetFinderNoTeam).lookRange = 35f;
		}

		internal static void AddProjectile(GameObject projectileToAdd)
		{
			Content.AddProjectilePrefab(projectileToAdd);
		}

		private static void CreateBomb()
		{
			bombPrefab = CloneProjectilePrefab("CommandoGrenadeProjectile", "HenryBombProjectile");
			ProjectileImpactExplosion component = bombPrefab.GetComponent<ProjectileImpactExplosion>();
			InitializeImpactExplosion(component);
			((ProjectileExplosion)component).blastRadius = 16f;
			component.destroyOnEnemy = true;
			component.lifetime = 12f;
			component.impactEffect = Assets.bombExplosionEffect;
			component.timerAfterImpact = true;
			component.lifetimeAfterImpact = 0.1f;
			ProjectileController component2 = bombPrefab.GetComponent<ProjectileController>();
			if ((Object)(object)Assets.mainAssetBundle.LoadAsset<GameObject>("HenryBombGhost") != (Object)null)
			{
				component2.ghostPrefab = CreateGhostPrefab("HenryBombGhost");
			}
			component2.startSound = "";
		}

		private static void InitializeImpactExplosion(ProjectileImpactExplosion projectileImpactExplosion)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			((ProjectileExplosion)projectileImpactExplosion).blastDamageCoefficient = 1f;
			((ProjectileExplosion)projectileImpactExplosion).blastProcCoefficient = 1f;
			((ProjectileExplosion)projectileImpactExplosion).blastRadius = 1f;
			((ProjectileExplosion)projectileImpactExplosion).bonusBlastForce = Vector3.zero;
			((ProjectileExplosion)projectileImpactExplosion).childrenCount = 0;
			((ProjectileExplosion)projectileImpactExplosion).childrenDamageCoefficient = 0f;
			((ProjectileExplosion)projectileImpactExplosion).childrenProjectilePrefab = null;
			projectileImpactExplosion.destroyOnEnemy = false;
			projectileImpactExplosion.destroyOnWorld = false;
			((ProjectileExplosion)projectileImpactExplosion).falloffModel = (FalloffModel)0;
			((ProjectileExplosion)projectileImpactExplosion).fireChildren = false;
			projectileImpactExplosion.impactEffect = null;
			projectileImpactExplosion.lifetime = 0f;
			projectileImpactExplosion.lifetimeAfterImpact = 0f;
			projectileImpactExplosion.lifetimeRandomOffset = 0f;
			projectileImpactExplosion.offsetForLifetimeExpiredSound = 0f;
			projectileImpactExplosion.timerAfterImpact = false;
			((Component)projectileImpactExplosion).GetComponent<ProjectileDamage>().damageType = (DamageType)0;
		}

		private static GameObject CreateGhostPrefab(string ghostName)
		{
			GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>(ghostName);
			if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
			{
				val.AddComponent<NetworkIdentity>();
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>()))
			{
				val.AddComponent<ProjectileGhostController>();
			}
			Assets.ConvertAllRenderersToHopooShader(val);
			return val;
		}

		private static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName)
		{
			return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName);
		}
	}
	public class ProjectileDirectionalTargetFinderNoTeam : ProjectileDirectionalTargetFinder
	{
	}
	internal static class Skills
	{
		public static void CreateSkillFamilies(GameObject targetPrefab, bool destroyExisting = true)
		{
			if (destroyExisting)
			{
				GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>();
				foreach (GenericSkill val in componentsInChildren)
				{
					Object.DestroyImmediate((Object)(object)val);
				}
			}
			SkillLocator component = targetPrefab.GetComponent<SkillLocator>();
			component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary");
			component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary");
			component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility");
			component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special");
		}

		public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false)
		{
			GenericSkill val = targetPrefab.AddComponent<GenericSkill>();
			val.skillName = familyName;
			val.hideInCharacterSelect = hidden;
			SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)val2).name = ((Object)targetPrefab).name + familyName + "Family";
			val2.variants = (Variant[])(object)new Variant[0];
			val._skillFamily = val2;
			Content.AddSkillFamily(val2);
			return val;
		}

		public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val = new Variant
			{
				skillDef = skillDef,
				unlockableDef = unlockableDef
			};
			((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
			variants[num] = val;
		}

		public static void AddSkillsToFamily(SkillFamily skillFamily, params SkillDef[] skillDefs)
		{
			foreach (SkillDef skillDef in skillDefs)
			{
				AddSkillToFamily(skillFamily, skillDef);
			}
		}

		public static void AddPrimarySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
		{
			AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().primary.skillFamily, skillDefs);
		}

		public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
		{
			AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().secondary.skillFamily, skillDefs);
		}

		public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs)
		{
			AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().utility.skillFamily, skillDefs);
		}

		public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs)
		{
			AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().special.skillFamily, skillDefs);
		}

		public static void AddUnlockablesToFamily(SkillFamily skillFamily, params UnlockableDef[] unlockableDefs)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < unlockableDefs.Length; i++)
			{
				Variant val = skillFamily.variants[i];
				val.unlockableDef = unlockableDefs[i];
				skillFamily.variants[i] = val;
			}
		}

		public static SkillDef CreateSkillDef(SkillDefInfo skillDefInfo)
		{
			return Skills.CreateSkillDef<SkillDef>(skillDefInfo);
		}

		public static T CreateSkillDef<T>(SkillDefInfo skillDefInfo) where T : SkillDef
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			T val = ScriptableObject.CreateInstance<T>();
			((SkillDef)val).skillName = skillDefInfo.skillName;
			((Object)(object)val).name = skillDefInfo.skillName;
			((SkillDef)val).skillNameToken = skillDefInfo.skillNameToken;
			((SkillDef)val).skillDescriptionToken = skillDefInfo.skillDescriptionToken;
			((SkillDef)val).icon = skillDefInfo.skillIcon;
			((SkillDef)val).activationState = skillDefInfo.activationState;
			((SkillDef)val).activationStateMachineName = skillDefInfo.activationStateMachineName;
			((SkillDef)val).baseMaxStock = skillDefInfo.baseMaxStock;
			((SkillDef)val).baseRechargeInterval = skillDefInfo.baseRechargeInterval;
			((SkillDef)val).beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd;
			((SkillDef)val).canceledFromSprinting = skillDefInfo.canceledFromSprinting;
			((SkillDef)val).forceSprintDuringState = skillDefInfo.forceSprintDuringState;
			((SkillDef)val).fullRestockOnAssign = skillDefInfo.fullRestockOnAssign;
			((SkillDef)val).interruptPriority = skillDefInfo.interruptPriority;
			((SkillDef)val).resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse;
			((SkillDef)val).isCombatSkill = skillDefInfo.isCombatSkill;
			((SkillDef)val).mustKeyPress = skillDefInfo.mustKeyPress;
			((SkillDef)val).cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation;
			((SkillDef)val).rechargeStock = skillDefInfo.rechargeStock;
			((SkillDef)val).requiredStock = skillDefInfo.requiredStock;
			((SkillDef)val).stockToConsume = skillDefInfo.stockToConsume;
			((SkillDef)val).keywordTokens = skillDefInfo.keywordTokens;
			Content.AddSkillDef((SkillDef)(object)val);
			return val;
		}
	}
	internal class SkillDefInfo
	{
		public string skillName;

		public string skillNameToken;

		public string skillDescriptionToken;

		public string[] keywordTokens = new string[0];

		public Sprite skillIcon;

		public SerializableEntityStateType activationState;

		public InterruptPriority interruptPriority;

		public string activationStateMachineName;

		public float baseRechargeInterval;

		public int baseMaxStock = 1;

		public int rechargeStock = 1;

		public int requiredStock = 1;

		public int stockToConsume = 1;

		public bool isCombatSkill = true;

		public bool canceledFromSprinting;

		public bool forceSprintDuringState;

		public bool cancelSprintingOnActivation = true;

		public bool beginSkillCooldownOnSkillEnd;

		public bool fullRestockOnAssign = true;

		public bool resetCooldownTimerOnUse;

		public bool mustKeyPress;

		public SkillDefInfo()
		{
		}

		public SkillDefInfo(string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			skillName = skillNameToken;
			this.skillNameToken = skillNameToken;
			this.skillDescriptionToken = skillDescriptionToken;
			this.skillIcon = skillIcon;
			this.activationState = activationState;
			this.activationStateMachineName = activationStateMachineName;
			interruptPriority = (InterruptPriority)0;
			isCombatSkill = true;
			baseRechargeInterval = 0f;
			requiredStock = 0;
			stockToConsume = 0;
			cancelSprintingOnActivation = !agile;
			if (agile)
			{
				keywordTokens = new string[1] { "KEYWORD_AGILE" };
			}
		}
	}
	internal static class Skins
	{
		internal struct SkinDefInfo
		{
			internal SkinDef[] BaseSkins;

			internal Sprite Icon;

			internal string NameToken;

			internal UnlockableDef UnlockableDef;

			internal GameObject RootObject;

			internal RendererInfo[] RendererInfos;

			internal MeshReplacement[] MeshReplacements;

			internal GameObjectActivation[] GameObjectActivations;

			internal ProjectileGhostReplacement[] ProjectileGhostReplacements;

			internal MinionSkinReplacement[] MinionSkinReplacements;

			internal string Name;
		}

		internal static SkinDef CreateSkinDef(string skinName, Sprite skinIcon, RendererInfo[] defaultRendererInfos, GameObject root, UnlockableDef unlockableDef = null)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			SkinDefInfo skinDefInfo = default(SkinDefInfo);
			skinDefInfo.BaseSkins = Array.Empty<SkinDef>();
			skinDefInfo.GameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0];
			skinDefInfo.Icon = skinIcon;
			skinDefInfo.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0];
			skinDefInfo.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0];
			skinDefInfo.Name = skinName;
			skinDefInfo.NameToken = skinName;
			skinDefInfo.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0];
			skinDefInfo.RendererInfos = (RendererInfo[])(object)new RendererInfo[defaultRendererInfos.Length];
			skinDefInfo.RootObject = root;
			skinDefInfo.UnlockableDef = unlockableDef;
			SkinDefInfo skinDefInfo2 = skinDefInfo;
			SkinDef.Awake += new hook_Awake(DoNothing);
			SkinDef val = ScriptableObject.CreateInstance<SkinDef>();
			val.baseSkins = skinDefInfo2.BaseSkins;
			val.icon = skinDefInfo2.Icon;
			val.unlockableDef = skinDefInfo2.UnlockableDef;
			val.rootObject = skinDefInfo2.RootObject;
			defaultRendererInfos.CopyTo(skinDefInfo2.RendererInfos, 0);
			val.rendererInfos = skinDefInfo2.RendererInfos;
			val.gameObjectActivations = skinDefInfo2.GameObjectActivations;
			val.meshReplacements = skinDefInfo2.MeshReplacements;
			val.projectileGhostReplacements = skinDefInfo2.ProjectileGhostReplacements;
			val.minionSkinReplacements = skinDefInfo2.MinionSkinReplacements;
			val.nameToken = skinDefInfo2.NameToken;
			((Object)val).name = skinDefInfo2.Name;
			SkinDef.Awake -= new hook_Awake(DoNothing);
			return val;
		}

		private static void DoNothing(orig_Awake orig, SkinDef self)
		{
		}

		private static RendererInfo[] getRendererMaterials(RendererInfo[] defaultRenderers, params Material[] materials)
		{
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[defaultRenderers.Length];
			defaultRenderers.CopyTo(array, 0);
			for (int i = 0; i < array.Length; i++)
			{
				try
				{
					array[i].defaultMaterial = materials[i];
				}
				catch
				{
					Log.Error("error adding skin rendererinfo material. make sure you're not passing in too many");
				}
			}
			return array;
		}

		internal static MeshReplacement[] getMeshReplacements(RendererInfo[] defaultRendererInfos, params string[] meshes)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			List<MeshReplacement> list = new List<MeshReplacement>();
			for (int i = 0; i < defaultRendererInfos.Length; i++)
			{
				if (!string.IsNullOrEmpty(meshes[i]))
				{
					list.Add(new MeshReplacement
					{
						renderer = defaultRendererInfos[i].renderer,
						mesh = Assets.mainAssetBundle.LoadAsset<Mesh>(meshes[i])
					});
				}
			}
			return list.ToArray();
		}
	}
	public static class States
	{
		internal static void RegisterStates()
		{
			Content.AddEntityState(typeof(PoisonBolt));
			Content.AddEntityState(typeof(FireShockingRev));
			Content.AddEntityState(typeof(DivineIntern));
			Content.AddEntityState(typeof(BaseMeleeAttack));
			Content.AddEntityState(typeof(MedicalMal));
		}
	}
	internal static class StaticValues
	{
		internal static string antidoteKeywordToken = Tokens.pref