Decompiled source of SteelMechorilla v1.0.3

SteelMechorilla.dll

Decompiled 7 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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.BrotherMonster;
using EntityStates.LemurianBruiserMonster;
using EntityStates.TitanMonster;
using HG;
using HG.BlendableTypes;
using KinematicCharacterController;
using On.RoR2;
using R2API;
using R2API.Networking.Interfaces;
using R2API.Utils;
using Risky_Artifacts.Artifacts;
using RoR2;
using RoR2.Achievements;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using SteelMechorilla.Modules;
using SteelMechorilla.Modules.Achievements;
using SteelMechorilla.Modules.Components;
using SteelMechorilla.Modules.Enemies;
using SteelMechorilla.SkillStates.Mechorilla;
using SteelMechorilla.SkillStates.Mechorilla.Cannon;
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("SteelMechorilla")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SteelMechorilla")]
[assembly: AssemblyTitle("SteelMechorilla")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
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);
	}
}
internal class BodyInfo
{
	internal string bodyName = "";

	internal string bodyNameToken = "";

	internal string subtitleNameToken = "";

	internal Color bodyColor = Color.white;

	internal Texture characterPortrait = null;

	internal GameObject crosshair = null;

	internal GameObject podPrefab = null;

	internal float maxHealth = 100f;

	internal float healthGrowth = 2f;

	internal float healthRegen = 0f;

	internal float shield = 0f;

	internal float shieldGrowth = 0f;

	internal float moveSpeed = 7f;

	internal float moveSpeedGrowth = 0f;

	internal float acceleration = 80f;

	internal float jumpPower = 15f;

	internal float jumpPowerGrowth = 0f;

	internal float damage = 12f;

	internal float attackSpeed = 1f;

	internal float attackSpeedGrowth = 0f;

	internal float armor = 0f;

	internal float armorGrowth = 0f;

	internal float crit = 1f;

	internal float critGrowth = 0f;

	internal int jumpCount = 1;
}
internal class CustomRendererInfo
{
	internal string childName;

	internal Material material;

	internal bool ignoreOverlays;
}
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 skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName, InterruptPriority interruptPriority, bool isCombatSkill, float baseRechargeInterval)
	{
		//IL_0063: 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_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		this.skillName = skillName;
		this.skillNameToken = skillNameToken;
		this.skillDescriptionToken = skillDescriptionToken;
		this.skillIcon = skillIcon;
		this.activationState = activationState;
		this.activationStateMachineName = activationStateMachineName;
		this.interruptPriority = interruptPriority;
		this.isCombatSkill = isCombatSkill;
		this.baseRechargeInterval = baseRechargeInterval;
	}

	public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false)
	{
		//IL_0063: 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_0074: Unknown result type (might be due to invalid IL or missing references)
		this.skillName = skillName;
		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" };
		}
	}
}
namespace SteelMechorilla
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.rob.SteelMechorilla", "SteelMechorilla", "1.0.3")]
	[R2APISubmoduleDependency(new string[] { "PrefabAPI", "LanguageAPI", "SoundAPI", "DirectorAPI", "LoadoutAPI", "UnlockableAPI", "NetworkingAPI", "RecalculateStatsAPI" })]
	public class MechorillaPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.rob.SteelMechorilla";

		public const string MODNAME = "SteelMechorilla";

		public const string MODVERSION = "1.0.3";

		public const string developerPrefix = "ROB";

		public static MechorillaPlugin instance;

		public static bool riskyArtifactsInstalled => Chainloader.PluginInfos.ContainsKey("com.Moffein.RiskyArtifacts");

		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Config.ReadConfig();
			Assets.PopulateAssets();
			CameraParams.InitializeParams();
			States.RegisterStates();
			Buffs.RegisterBuffs();
			Projectiles.RegisterProjectiles();
			Tokens.AddTokens();
			ItemDisplays.PopulateDisplays();
			NetMessages.RegisterNetworkMessages();
			new Mechorilla().CreateCharacter();
			Hook();
			new ContentPacks().Initialize();
			ContentManager.onContentPacksAssigned += LateSetup;
		}

		private void LateSetup(ReadOnlyArray<ReadOnlyContentPack> obj)
		{
			Mechorilla.SetItemDisplays();
		}

		private void Hook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
		}

		private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
		}
	}
}
namespace SteelMechorilla.SkillStates.Mechorilla
{
	public class DeathState : GenericCharacterDeath
	{
		private bool p;

		public override void OnEnter()
		{
			Animator modelAnimator = ((EntityState)this).GetModelAnimator();
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			Util.PlaySound("sfx_mechorilla_zap", ((EntityState)this).gameObject);
			((GenericCharacterDeath)this).OnEnter();
		}

		public override void FixedUpdate()
		{
			((GenericCharacterDeath)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= 1f && !p)
			{
				p = true;
				Util.PlaySound("sfx_mechorilla_death", ((EntityState)this).gameObject);
			}
		}
	}
	public class GroundSmash : BaseSkillState
	{
		public static float baseDuration = 9f;

		public float damageCoefficient = 3f;

		public float meleeDamageCoefficient = 2f;

		protected float smashTime;

		private bool hasSmashed;

		protected float duration;

		public override void OnEnter()
		{
			//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)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			smashTime = 0.15f * duration;
			hasSmashed = false;
			((EntityState)this).characterDirection.moveVector = ((EntityState)this).characterDirection.forward;
			Util.PlaySound("sfx_mechorilla_grunt", ((EntityState)this).gameObject);
			PlayAnimation();
		}

		protected virtual void PlayAnimation()
		{
			((EntityState)this).PlayAnimation("FullBody, Override", "GroundSlam", "Action.playbackRate", duration);
		}

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

		private void Smash()
		{
			//IL_0061: 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_006e: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			hasSmashed = true;
			Util.PlaySound("sfx_mechorilla_smash", ((EntityState)this).gameObject);
			Util.PlaySound("sfx_mechorilla_bigsmash", ((EntityState)this).gameObject);
			EffectManager.SimpleMuzzleFlash(Resources.Load<GameObject>("Prefabs/Effects/ImpactEffects/PodGroundImpact"), ((EntityState)this).gameObject, "GroundSmashMuzzle", false);
			if (((EntityState)this).isAuthority)
			{
				Transform val = ((BaseState)this).FindModelChild("GroundSmashMuzzle");
				Vector3 position = val.position;
				FireProjectile();
				new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					attackerFiltering = (AttackerFiltering)2,
					baseDamage = meleeDamageCoefficient * ((BaseState)this).damageStat,
					baseForce = 800f,
					bonusForce = Vector3.up * 2000f,
					crit = ((BaseState)this).RollCrit(),
					damageColorIndex = (DamageColorIndex)5,
					damageType = (DamageType)131072,
					falloffModel = (FalloffModel)0,
					inflictor = ((EntityState)this).gameObject,
					losType = (LoSType)0,
					position = position,
					procChainMask = default(ProcChainMask),
					procCoefficient = 1f,
					radius = 12f,
					teamIndex = ((BaseState)this).GetTeam()
				}.Fire();
			}
		}

		protected virtual void FireProjectile()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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)
			Transform val = ((BaseState)this).FindModelChild("GroundSmashMuzzleA");
			ProjectileManager.instance.FireProjectile(Projectiles.shockwave, val.position, Util.QuaternionSafeLookRotation(val.forward), ((EntityState)this).gameObject, ((EntityState)this).characterBody.damage * damageCoefficient, WeaponSlam.waveProjectileForce, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f);
			val = ((BaseState)this).FindModelChild("GroundSmashMuzzleB");
			ProjectileManager.instance.FireProjectile(Projectiles.shockwave, val.position, Util.QuaternionSafeLookRotation(val.forward), ((EntityState)this).gameObject, ((EntityState)this).characterBody.damage * damageCoefficient, WeaponSlam.waveProjectileForce, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f);
		}

		public override void OnExit()
		{
			((EntityState)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)2;
		}
	}
	public class GroundSmashQuick : GroundSmash
	{
		protected override void PlayAnimation()
		{
			duration = 4f / ((BaseState)this).attackSpeedStat;
			smashTime = 0.18f * duration;
			meleeDamageCoefficient = 1.2f;
			((EntityState)this).PlayAnimation("FullBody, Override", "GroundSlamQuick", "Action.playbackRate", duration);
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (((EntityState)this).fixedAge >= 0.75f * duration && ((BaseSkillState)this).IsKeyDownAuthority())
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new GroundSmashQuick());
			}
		}

		protected override void FireProjectile()
		{
		}
	}
	public class JumpState : BaseState
	{
		private float duration;

		private bool hasInputJump;

		private Animator animator;

		public override void OnEnter()
		{
			//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)
			((BaseState)this).OnEnter();
			animator = ((EntityState)this).GetModelAnimator();
			if (Object.op_Implicit((Object)(object)animator))
			{
				int layerIndex = animator.GetLayerIndex("Body");
				animator.CrossFadeInFixedTime("AnimatedJump", 0.25f);
				animator.Update(0f);
				AnimatorStateInfo nextAnimatorStateInfo = animator.GetNextAnimatorStateInfo(layerIndex);
				duration = ((AnimatorStateInfo)(ref nextAnimatorStateInfo)).length;
			}
		}

		public override void FixedUpdate()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)animator))
			{
				animator.SetBool("isGrounded", false);
			}
			if (((EntityState)this).fixedAge >= duration / 2f && ((EntityState)this).isAuthority && !hasInputJump)
			{
				hasInputJump = true;
				((EntityState)this).characterMotor.moveDirection = ((EntityState)this).inputBank.moveVector;
				int itemCount = ((EntityState)this).characterBody.inventory.GetItemCount(Items.JumpBoost);
				float num = 1f;
				float num2 = 1f;
				bool flag = false;
				if (itemCount > 0 && ((EntityState)this).characterBody.isSprinting)
				{
					float num3 = ((EntityState)this).characterBody.acceleration * ((EntityState)this).characterMotor.airControl;
					if (((EntityState)this).characterBody.moveSpeed > 0f && num3 > 0f)
					{
						flag = true;
						float num4 = Mathf.Sqrt(10f * (float)itemCount / num3);
						float num5 = ((EntityState)this).characterBody.moveSpeed / num3;
						num = (num4 + num5) / num5;
					}
				}
				GenericCharacterMain.ApplyJumpVelocity(((EntityState)this).characterMotor, ((EntityState)this).characterBody, num, num2, false);
				if (flag)
				{
					EffectManager.SpawnEffect(Resources.Load<GameObject>("Prefabs/Effects/BoostJumpEffect"), new EffectData
					{
						origin = ((EntityState)this).characterBody.footPosition,
						rotation = Util.QuaternionSafeLookRotation(((EntityState)this).characterMotor.velocity)
					}, true);
				}
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}
	}
	public class MainState : GenericCharacterMain
	{
		public override void ProcessJump()
		{
			if (((EntityState)this).characterMotor.jumpCount > ((EntityState)this).characterBody.maxJumpCount)
			{
				((GenericCharacterMain)this).ProcessJump();
			}
			else if (base.jumpInputReceived && ((EntityState)this).characterMotor.isGrounded)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new JumpState());
			}
		}
	}
	public class SpawnState : BaseState
	{
		public float duration = 2f;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			Util.PlaySound(SpawnState.spawnSoundString, ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation("Body", "Spawn", "Spawn.playbackRate", duration);
			if (Object.op_Implicit((Object)(object)SpawnState.spawnEffectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(SpawnState.spawnEffectPrefab, ((EntityState)this).gameObject, "Model", false);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).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)6;
		}
	}
	public class SweepingBeam : BaseState
	{
		public float baseDuration = 16f;

		private float duration;

		private bool hasFired;

		private float fireStopwatch;

		private float stopwatch;

		private Transform modelTransform;

		private GameObject laserEffect;

		private ChildLocator laserChildLocator;

		private Transform laserEffectEnd;

		protected Transform muzzleTransform;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / base.attackSpeedStat;
			muzzleTransform = ((BaseState)this).FindModelChild("BeamMuzzle");
			((EntityState)this).characterBody.SetAimTimer(duration);
			((EntityState)this).PlayCrossfade("FullBody, Override", "SweepingBeam", "Action.playbackRate", duration, 0.1f);
			modelTransform = ((EntityState)this).GetModelTransform();
			Util.PlaySound("sfx_mechorilla_foley_01", ((EntityState)this).gameObject);
		}

		public override void OnExit()
		{
			StopBeam();
			((EntityState)this).characterBody.SetAimTimer(2f);
			((EntityState)this).OnExit();
		}

		private void StartBeam()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			Util.PlaySound(FireMegaLaser.playAttackSoundString, ((EntityState)this).gameObject);
			Util.PlaySound(FireMegaLaser.playLoopSoundString, ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)modelTransform) && Object.op_Implicit((Object)(object)muzzleTransform) && Object.op_Implicit((Object)(object)new FireMegaLaser().effectPrefab))
			{
				laserEffect = Object.Instantiate<GameObject>(new FireMegaLaser().laserPrefab, muzzleTransform.position, muzzleTransform.rotation);
				laserEffect.transform.parent = muzzleTransform;
				laserChildLocator = laserEffect.GetComponent<ChildLocator>();
				laserEffectEnd = laserChildLocator.FindChild("LaserEnd");
				LineRenderer component = laserEffect.GetComponent<LineRenderer>();
				component.startWidth = 20f;
				component.endWidth = 20f;
				((Renderer)component).sharedMaterial = Assets.matBlueLightningLong;
				laserEffect.GetComponent<LineBetweenTransforms>().transformNodes[0] = muzzleTransform;
				((Renderer)((Component)laserEffect.transform.Find("Start").Find("Flare")).GetComponent<ParticleSystemRenderer>()).sharedMaterial = Assets.helfireFlareMat;
				((Renderer)((Component)laserEffect.transform.Find("Start").Find("ArcaneFlare")).GetComponent<ParticleSystemRenderer>()).sharedMaterial = Assets.matBrotherArcaneFlare;
			}
		}

		private void StopBeam()
		{
			if (Object.op_Implicit((Object)(object)laserEffect))
			{
				EntityState.Destroy((Object)(object)laserEffect);
				Util.PlaySound(FireMegaLaser.stopLoopSoundString, ((EntityState)this).gameObject);
			}
		}

		private void EvaluateBeam()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)laserEffect))
			{
				return;
			}
			Vector3 position = muzzleTransform.position;
			Ray val = default(Ray);
			((Ray)(ref val)).direction = muzzleTransform.forward;
			position = muzzleTransform.position + muzzleTransform.forward * FireMegaLaser.maxDistance;
			((Ray)(ref val))..ctor(muzzleTransform.position, position - muzzleTransform.position);
			bool flag = false;
			if (Object.op_Implicit((Object)(object)laserEffect) && Object.op_Implicit((Object)(object)laserChildLocator))
			{
				laserEffect.transform.rotation = Util.QuaternionSafeLookRotation(position - muzzleTransform.position);
				((Component)laserEffectEnd).transform.position = position;
			}
			if (fireStopwatch > 1f / FireMegaLaser.fireFrequency)
			{
				if (!flag)
				{
					Transform obj = modelTransform;
					Ray aimRay = val;
					Vector3 val2 = position - ((Ray)(ref val)).origin;
					FireBullet(obj, aimRay, "BeamMuzzle", ((Vector3)(ref val2)).magnitude + 0.1f);
				}
				fireStopwatch -= 1f / FireMegaLaser.fireFrequency;
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			fireStopwatch += Time.fixedDeltaTime;
			stopwatch += Time.fixedDeltaTime;
			if (hasFired)
			{
				if ((double)stopwatch >= 0.53 * (double)duration)
				{
					StopBeam();
				}
				else
				{
					EvaluateBeam();
				}
			}
			else if (stopwatch >= 0.16f * duration)
			{
				hasFired = true;
				StartBeam();
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((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;
		}

		private void FireBullet(Transform modelTransform, Ray aimRay, string targetMuzzle, float maxDistance)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_004f: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_009c: 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)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = muzzleTransform.position,
					aimVector = muzzleTransform.forward,
					minSpread = 0f,
					maxSpread = 0f,
					bulletCount = 1u,
					damage = 3f * FireMegaLaser.damageCoefficient * base.damageStat / FireMegaLaser.fireFrequency,
					force = FireMegaLaser.force,
					muzzleName = targetMuzzle,
					hitEffectPrefab = null,
					isCrit = ((BaseState)this).RollCrit(),
					procCoefficient = FireMegaLaser.procCoefficientPerTick,
					HitEffectNormal = false,
					radius = 8f,
					procChainMask = default(ProcChainMask),
					falloffModel = (FalloffModel)0,
					hitMask = CommonMasks.bullet,
					stopperMask = LayerMask.op_Implicit(LayerIndex.ui.intVal),
					maxDistance = maxDistance
				}.Fire();
				new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					attackerFiltering = (AttackerFiltering)2,
					baseDamage = 1.5f * FireMegaLaser.damageCoefficient * base.damageStat / FireMegaLaser.fireFrequency,
					baseForce = 400f,
					bonusForce = Vector3.up * 100f,
					crit = ((BaseState)this).RollCrit(),
					damageType = (DamageType)131072,
					falloffModel = (FalloffModel)1,
					inflictor = ((EntityState)this).gameObject,
					losType = (LoSType)0,
					position = muzzleTransform.position,
					procChainMask = default(ProcChainMask),
					procCoefficient = 1f,
					radius = 2.5f,
					teamIndex = ((EntityState)this).teamComponent.teamIndex
				}.Fire();
			}
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((EntityState)this).OnSerialize(writer);
			writer.Write(stopwatch);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((EntityState)this).OnDeserialize(reader);
			stopwatch = reader.ReadSingle();
		}
	}
}
namespace SteelMechorilla.SkillStates.Mechorilla.Cannon
{
	public class EndBlasts : BaseSkillState
	{
		public static float baseDuration = 2f;

		private float duration;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = PrepBlasts.baseDuration;
			((EntityState)this).PlayCrossfade("FullBody, Override", "StopBlasts", "Action.playbackRate", duration, 0.1f);
			Util.PlaySound("sfx_mechorilla_blast_end", ((EntityState)this).gameObject);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration)
			{
				((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 FireBlasts : BaseSkillState
	{
		public static int blastCount = 8;

		public static float baseShotDuration = 0.3f;

		public static float damageCoefficient = 4.5f;

		private int remainingBlasts;

		private float shotTimer;

		private float shotDuration;

		protected Vector3 predictedTargetPosition;

		private Predictor predictor;

		public override void OnEnter()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_00db: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			shotDuration = baseShotDuration;
			remainingBlasts = blastCount;
			if (NetworkServer.active)
			{
				BullseyeSearch val = new BullseyeSearch();
				val.teamMaskFilter = TeamMask.allButNeutral;
				if (Object.op_Implicit((Object)(object)((EntityState)this).teamComponent))
				{
					((TeamMask)(ref val.teamMaskFilter)).RemoveTeam(((EntityState)this).teamComponent.teamIndex);
				}
				val.maxDistanceFilter = FireFist.maxDistance;
				val.maxAngleFilter = 90f;
				Ray aimRay = ((BaseState)this).GetAimRay();
				val.searchOrigin = ((Ray)(ref aimRay)).origin;
				val.searchDirection = ((Ray)(ref aimRay)).direction;
				val.filterByLoS = false;
				val.sortMode = (SortMode)2;
				val.RefreshCandidates();
				HurtBox val2 = val.GetResults().FirstOrDefault();
				if (Object.op_Implicit((Object)(object)val2))
				{
					predictor = new Predictor(((EntityState)this).transform);
					predictor.SetTargetTransform(((Component)val2).transform);
				}
			}
			Fire();
		}

		private void Fire()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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)
			shotTimer = shotDuration;
			remainingBlasts--;
			((EntityState)this).PlayAnimation("FullBody, Override", "FireBlast", "Action.playbackRate", shotDuration);
			EffectManager.SimpleMuzzleFlash(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LightningStrikeOnHit/SimpleLightningStrikeImpact.prefab").WaitForCompletion(), ((EntityState)this).gameObject, "CannonMuzzle", false);
			if (((EntityState)this).isAuthority)
			{
				FireProjectileInfo val = default(FireProjectileInfo);
				val.projectilePrefab = Projectiles.blastProjectile;
				val.position = predictedTargetPosition;
				val.rotation = Quaternion.identity;
				val.owner = ((EntityState)this).gameObject;
				val.damage = ((BaseState)this).damageStat * damageCoefficient;
				val.force = 2000f;
				val.crit = ((EntityState)this).characterBody.RollCrit();
				((FireProjectileInfo)(ref val)).fuseOverride = FireFist.entryDuration - FireFist.trackingDuration;
				ProjectileManager.instance.FireProjectile(val);
			}
			Util.PlaySound("sfx_mechorilla_blast", ((EntityState)this).gameObject);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			shotTimer -= Time.fixedDeltaTime;
			if (predictor != null)
			{
				predictor.Update();
				predictor.GetPredictedTargetPosition(FireFist.entryDuration - FireFist.trackingDuration, ref predictedTargetPosition);
			}
			if (shotTimer <= 0f)
			{
				if (remainingBlasts <= 0)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new EndBlasts());
				}
				else
				{
					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)3;
		}
	}
	public class PrepBlasts : BaseSkillState
	{
		public static float baseDuration = 3f;

		private float duration;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration;
			((EntityState)this).PlayCrossfade("FullBody, Override", "StartBlasts", "Action.playbackRate", duration, 0.1f);
			Util.PlaySound("sfx_mechorilla_blast_prep", ((EntityState)this).gameObject);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new FireBlasts());
			}
		}

		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;
		}
	}
}
namespace SteelMechorilla.Modules
{
	internal static class Assets
	{
		internal static AssetBundle mainAssetBundle;

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

		internal static Material commandoMat;

		internal static Material matBlueLightningLong;

		internal static Material matJellyfishLightningLarge;

		internal static Material matMageMatrixDirectionalLightning;

		internal static Material matClaySwing;

		internal static Material matDistortion;

		internal static Material matMercSwipe;

		internal static Material matMercSwipeRed;

		internal static Material matLunarGolem;

		internal static Material matMoonElevator;

		internal static Material matLunarMinigunTracer;

		internal static Material matBrotherArcaneFlare;

		internal static Material helfireFlareMat;

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

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

		internal static void PopulateAssets()
		{
			if ((Object)(object)mainAssetBundle == (Object)null)
			{
				using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SteelMechorilla.mechorilla");
				mainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
			using (Stream stream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("SteelMechorilla.MechorillaBank.bnk"))
			{
				byte[] array = new byte[stream2.Length];
				stream2.Read(array, 0, array.Length);
				SoundBanks.Add(array);
			}
			GrabMaterials();
		}

		internal static void GrabMaterials()
		{
			//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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//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)
			matBlueLightningLong = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matLightningLongBlue.mat").WaitForCompletion();
			matMoonElevator = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matLightningLongBlue.mat").WaitForCompletion();
			matLunarMinigunTracer = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/LunarWisp/matLunarWispMinigunTracer.mat").WaitForCompletion();
			matBrotherArcaneFlare = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matArcaneCircleBrother.mat").WaitForCompletion();
			helfireFlareMat = ((Renderer)((Component)Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/BurnNearby/HelfireIgniteEffect.prefab").WaitForCompletion().transform.Find("Flare")).GetComponent<ParticleSystemRenderer>()).sharedMaterial;
		}

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

		internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert)
		{
			Renderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.material))
				{
					val.material.shader = hotpoo;
				}
			}
		}

		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 name in your code matches the name of the object in Unity");
				return null;
			}
			return PrefabAPI.InstantiateClone(val, ((Object)val).name, false);
		}

		internal static Texture LoadCharacterIcon(string characterName)
		{
			return mainAssetBundle.LoadAsset<Texture>("tex" + characterName + "Icon");
		}

		internal static GameObject LoadCrosshair(string crosshairName)
		{
			return Resources.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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = mainAssetBundle.LoadAsset<GameObject>(resourceName);
			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;
		}

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

		internal 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;
			effectDefs.Add(val);
		}

		public static Material CreateMaterial(string materialName, float emission, Color emissionColor, float normalStrength)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)commandoMat))
			{
				commandoMat = Resources.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial;
			}
			Material val = Object.Instantiate<Material>(commandoMat);
			Material val2 = mainAssetBundle.LoadAsset<Material>(materialName);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				return commandoMat;
			}
			((Object)val).name = materialName;
			val.SetColor("_Color", val2.GetColor("_Color"));
			val.SetTexture("_MainTex", val2.GetTexture("_MainTex"));
			val.SetColor("_EmColor", emissionColor);
			val.SetFloat("_EmPower", emission);
			val.SetTexture("_EmTex", val2.GetTexture("_EmissionMap"));
			val.SetFloat("_NormalStrength", normalStrength);
			return val;
		}

		public static Material CreateMaterial(string materialName)
		{
			return CreateMaterial(materialName, 0f);
		}

		public static Material CreateMaterial(string materialName, float emission)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return CreateMaterial(materialName, emission, Color.black);
		}

		public static Material CreateMaterial(string materialName, float emission, Color emissionColor)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return CreateMaterial(materialName, emission, emissionColor, 0f);
		}
	}
	public static class Buffs
	{
		internal static List<BuffDef> buffDefs = new List<BuffDef>();

		internal static void RegisterBuffs()
		{
		}

		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;
			buffDefs.Add(val);
			return val;
		}
	}
	internal static class CameraParams
	{
		internal static CharacterCameraParams defaultCameraParams;

		internal static void InitializeParams()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			defaultCameraParams = NewCameraParams("ccpMechorilla", 70f, 1.37f, new Vector3(0f, 10f, -30f));
		}

		private static CharacterCameraParams NewCameraParams(string name, float pitch, float pivotVerticalOffset, Vector3 standardPosition)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			return NewCameraParams(name, pitch, pivotVerticalOffset, standardPosition, 0.1f);
		}

		private static CharacterCameraParams NewCameraParams(string name, float pitch, float pivotVerticalOffset, Vector3 standardPosition, float wallCushion)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			CharacterCameraParams val = ScriptableObject.CreateInstance<CharacterCameraParams>();
			val.data.maxPitch = BlendableFloat.op_Implicit(pitch);
			val.data.minPitch = BlendableFloat.op_Implicit(0f - pitch);
			val.data.pivotVerticalOffset = BlendableFloat.op_Implicit(pivotVerticalOffset);
			val.data.idealLocalCameraPos = BlendableVector3.op_Implicit(standardPosition);
			val.data.wallCushion = BlendableFloat.op_Implicit(wallCushion);
			return val;
		}
	}
	internal static class Config
	{
		public static List<StageSpawnInfo> StageList = new List<StageSpawnInfo>();

		internal static void ReadConfig()
		{
			string value = ((BaseUnityPlugin)MechorillaPlugin.instance).Config.Bind<string>("Steel Mechorilla", "Stage List", "golemplains, golemplains2, shipgraveyard, frozenwall, goldshores, arena, goolake, foggyswamp, snowyforest, itfrozenwall, itgolemplains, itgoolake, rootjungle", "What stages the boss will show up on. Add a '- loop' after the stagename to make it only spawn after looping. List of stage names can be found at https://github.com/risk-of-thunder/R2Wiki/wiki/Mod-Creation_Developer-Reference_Scene-Names").Value;
			value = new string((from c in value.ToCharArray()
				where !char.IsWhiteSpace(c)
				select c).ToArray());
			string[] array = value.Split(new char[1] { ',' });
			string[] array2 = array;
			foreach (string text in array2)
			{
				string[] array3 = text.Split(new char[1] { '-' });
				string stageName = array3[0];
				int minStages = 0;
				if (array3.Length > 1)
				{
					minStages = 5;
				}
				StageList.Add(new StageSpawnInfo(stageName, minStages));
			}
		}

		internal static ConfigEntry<bool> EnemyEnableConfig(string characterName)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_002c: Expected O, but got Unknown
			return ((BaseUnityPlugin)MechorillaPlugin.instance).Config.Bind<bool>(new ConfigDefinition(characterName, "Enabled"), true, new ConfigDescription("Set to false to disable this enemy", (AcceptableValueBase)null, Array.Empty<object>()));
		}

		internal static ConfigEntry<bool> CharacterEnableConfig(string characterName)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_002c: Expected O, but got Unknown
			return ((BaseUnityPlugin)MechorillaPlugin.instance).Config.Bind<bool>(new ConfigDefinition(characterName, "Enabled"), false, new ConfigDescription("Set to false to disable this character", (AcceptableValueBase)null, Array.Empty<object>()));
		}
	}
	public class StageSpawnInfo
	{
		private string stageName;

		private int minStages;

		public StageSpawnInfo(string stageName, int minStages)
		{
			this.stageName = stageName;
			this.minStages = minStages;
		}

		public string GetStageName()
		{
			return stageName;
		}

		public int GetMinStages()
		{
			return minStages;
		}
	}
	internal class ContentPacks : IContentPackProvider
	{
		internal ContentPack contentPack = new ContentPack();

		public string identifier => "com.rob.SteelMechorilla";

		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(Prefabs.bodyPrefabs.ToArray());
			contentPack.buffDefs.Add(Buffs.buffDefs.ToArray());
			contentPack.effectDefs.Add(Assets.effectDefs.ToArray());
			contentPack.entityStateTypes.Add(States.entityStates.ToArray());
			contentPack.masterPrefabs.Add(Prefabs.masterPrefabs.ToArray());
			contentPack.networkSoundEventDefs.Add(Assets.networkSoundEventDefs.ToArray());
			contentPack.projectilePrefabs.Add(Prefabs.projectilePrefabs.ToArray());
			contentPack.skillDefs.Add(Skills.skillDefs.ToArray());
			contentPack.skillFamilies.Add(Skills.skillFamilies.ToArray());
			contentPack.survivorDefs.Add(Prefabs.survivorDefinitions.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 static class DamageTypes
	{
		public static void RegisterDamageTypes()
		{
		}
	}
	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>";
		}
	}
	internal static class ItemDisplays
	{
		private static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>();

		internal static void PopulateDisplays()
		{
			PopulateFromBody("Commando");
			PopulateFromBody("Croco");
		}

		private static void PopulateFromBody(string bodyName)
		{
			ItemDisplayRuleSet itemDisplayRuleSet = ((Component)Resources.Load<GameObject>("Prefabs/CharacterBodies/" + bodyName + "Body").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?.ToLower();
						if (!itemDisplayPrefabs.ContainsKey(key))
						{
							itemDisplayPrefabs[key] = followerPrefab;
						}
					}
				}
			}
		}

		internal static GameObject LoadDisplay(string name)
		{
			if (itemDisplayPrefabs.ContainsKey(name.ToLower()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLower()]))
			{
				return itemDisplayPrefabs[name.ToLower()];
			}
			return null;
		}
	}
	internal static class NetMessages
	{
		public class SyncLifeSteal : INetMessage, ISerializableObject
		{
			private NetworkInstanceId netId;

			private float healAmount;

			public SyncLifeSteal()
			{
			}

			public SyncLifeSteal(NetworkInstanceId netId_, float healAmount_)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				netId = netId_;
				healAmount = healAmount_;
			}

			public void Serialize(NetworkWriter writer)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				writer.Write(netId);
				writer.Write(healAmount);
			}

			public void Deserialize(NetworkReader reader)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				netId = reader.ReadNetworkId();
				healAmount = reader.ReadSingle();
			}

			public void OnReceived()
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				if (NetworkServer.active)
				{
					GameObject val = Util.FindNetworkObject(netId);
					if (!Object.op_Implicit((Object)(object)val))
					{
						Log.Warning("SyncLifeSteal: bodyObject is null.");
					}
					else
					{
						val.GetComponent<HealthComponent>().Heal(healAmount, default(ProcChainMask), true);
					}
				}
			}
		}

		public static void RegisterNetworkMessages()
		{
		}
	}
	internal static class Prefabs
	{
		private static PhysicMaterial ragdollMaterial;

		internal static List<SurvivorDef> survivorDefinitions = new List<SurvivorDef>();

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

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

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

		internal static void RegisterNewSurvivor(GameObject bodyPrefab, GameObject displayPrefab, string namePrefix, UnlockableDef unlockableDef)
		{
			string displayNameToken = "ROB_" + namePrefix + "_BODY_NAME";
			string descriptionToken = "ROB_" + namePrefix + "_BODY_DESCRIPTION";
			string outroFlavorToken = "ROB_" + namePrefix + "_BODY_OUTRO_FLAVOR";
			string mainEndingEscapeFailureFlavorToken = "ROB_" + namePrefix + "_BODY_OUTRO_FAILURE";
			SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>();
			val.bodyPrefab = bodyPrefab;
			val.displayPrefab = displayPrefab;
			val.displayNameToken = displayNameToken;
			val.descriptionToken = descriptionToken;
			val.outroFlavorToken = outroFlavorToken;
			val.mainEndingEscapeFailureFlavorToken = mainEndingEscapeFailureFlavorToken;
			val.desiredSortPosition = 100f;
			val.unlockableDef = unlockableDef;
			survivorDefinitions.Add(val);
		}

		internal static void RegisterNewSurvivor(GameObject bodyPrefab, GameObject displayPrefab, string namePrefix)
		{
			RegisterNewSurvivor(bodyPrefab, displayPrefab, namePrefix, null);
		}

		internal static GameObject CreateDisplayPrefab(string modelName, GameObject prefab)
		{
			GameObject val = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody"), modelName + "Prefab");
			GameObject val2 = CreateModel(val, modelName);
			Transform val3 = SetupModel(val, val2.transform);
			val2.AddComponent<CharacterModel>().baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos;
			return val2.gameObject;
		}

		internal static GameObject CreatePrefab(string bodyName, string modelName, BodyInfo bodyInfo)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody"), bodyName);
			GameObject val2 = CreateModel(val, modelName);
			Transform val3 = SetupModel(val, val2.transform);
			CharacterBody component = val.GetComponent<CharacterBody>();
			((Object)component).name = bodyInfo.bodyName;
			component.baseNameToken = bodyInfo.bodyNameToken;
			component.subtitleNameToken = bodyInfo.subtitleNameToken;
			component.portraitIcon = bodyInfo.characterPortrait;
			component._defaultCrosshairPrefab = bodyInfo.crosshair;
			component.bodyColor = bodyInfo.bodyColor;
			component.bodyFlags = (BodyFlags)16;
			component.rootMotionInMainState = false;
			component.baseMaxHealth = bodyInfo.maxHealth;
			component.levelMaxHealth = bodyInfo.healthGrowth;
			component.baseRegen = bodyInfo.healthRegen;
			component.levelRegen = component.baseRegen * 0.2f;
			component.baseMaxShield = bodyInfo.shield;
			component.levelMaxShield = bodyInfo.shieldGrowth;
			component.baseMoveSpeed = bodyInfo.moveSpeed;
			component.levelMoveSpeed = bodyInfo.moveSpeedGrowth;
			component.baseAcceleration = bodyInfo.acceleration;
			component.baseJumpPower = bodyInfo.jumpPower;
			component.levelJumpPower = bodyInfo.jumpPowerGrowth;
			component.baseDamage = bodyInfo.damage;
			component.levelDamage = component.baseDamage * 0.2f;
			component.baseAttackSpeed = bodyInfo.attackSpeed;
			component.levelAttackSpeed = bodyInfo.attackSpeedGrowth;
			component.baseArmor = bodyInfo.armor;
			component.levelArmor = bodyInfo.armorGrowth;
			component.baseCrit = bodyInfo.crit;
			component.levelCrit = bodyInfo.critGrowth;
			component.baseJumpCount = bodyInfo.jumpCount;
			component.sprintingSpeedMultiplier = 1.45f;
			component.hideCrosshair = false;
			component.aimOriginTransform = val3.Find("AimOrigin");
			component.hullClassification = (HullClassification)0;
			component.preferredPodPrefab = bodyInfo.podPrefab;
			component.isChampion = false;
			SetupCharacterDirection(val, val3, val2.transform);
			SetupCameraTargetParams(val);
			SetupModelLocator(val, val3, val2.transform);
			SetupRigidbody(val);
			SetupCapsuleCollider(val);
			SetupMainHurtbox(val, val2);
			SetupFootstepController(val2);
			SetupRagdoll(val2);
			SetupAimAnimator(val, val2);
			bodyPrefabs.Add(val);
			return val;
		}

		internal static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy)
		{
			GameObject val = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true);
			val.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab;
			masterPrefabs.Add(val);
		}

		private static Transform SetupModel(GameObject prefab, Transform modelTransform)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0033: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_00a1: 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)
			//IL_00c3: 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_00d9: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("ModelBase");
			val.transform.parent = prefab.transform;
			val.transform.localPosition = new Vector3(0f, -4.92f, 0f);
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = new Vector3(1f, 1f, 1f);
			GameObject val2 = new GameObject("CameraPivot");
			val2.transform.parent = val.transform;
			val2.transform.localPosition = new Vector3(0f, 2.5f, 0f);
			val2.transform.localRotation = Quaternion.identity;
			val2.transform.localScale = Vector3.one;
			GameObject val3 = new GameObject("AimOrigin");
			val3.transform.parent = val.transform;
			val3.transform.localPosition = new Vector3(0f, 8f, 0f);
			val3.transform.localRotation = Quaternion.identity;
			val3.transform.localScale = Vector3.one;
			prefab.GetComponent<CharacterBody>().aimOriginTransform = val3.transform;
			modelTransform.parent = val.transform;
			modelTransform.localPosition = Vector3.zero;
			modelTransform.localRotation = Quaternion.identity;
			return val.transform;
		}

		private static GameObject CreateModel(GameObject main, string modelName)
		{
			Object.DestroyImmediate((Object)(object)((Component)main.transform.Find("ModelBase")).gameObject);
			Object.DestroyImmediate((Object)(object)((Component)main.transform.Find("CameraPivot")).gameObject);
			Object.DestroyImmediate((Object)(object)((Component)main.transform.Find("AimOrigin")).gameObject);
			if ((Object)(object)Assets.mainAssetBundle.LoadAsset<GameObject>(modelName) == (Object)null)
			{
				Log.Error("Trying to load a null model- check to see if the name in your code matches the name of the object in Unity");
				return null;
			}
			return Object.Instantiate<GameObject>(Assets.mainAssetBundle.LoadAsset<GameObject>(modelName));
		}

		internal static void SetupCharacterModel(GameObject prefab, CustomRendererInfo[] rendererInfo, int mainRendererIndex)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			CharacterModel val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.AddComponent<CharacterModel>();
			ChildLocator component = ((Component)val).GetComponent<ChildLocator>();
			val.body = prefab.GetComponent<CharacterBody>();
			List<RendererInfo> list = new List<RendererInfo>();
			for (int i = 0; i < rendererInfo.Length; i++)
			{
				list.Add(new RendererInfo
				{
					renderer = ((Component)component.FindChild(rendererInfo[i].childName)).GetComponent<Renderer>(),
					defaultMaterial = rendererInfo[i].material,
					ignoreOverlays = rendererInfo[i].ignoreOverlays,
					defaultShadowCastingMode = (ShadowCastingMode)1
				});
			}
			val.baseRendererInfos = list.ToArray();
			val.autoPopulateLightInfos = true;
			val.invisibilityCount = 0;
			val.temporaryOverlays = new List<TemporaryOverlay>();
			val.mainSkinnedMeshRenderer = ((Component)val.baseRendererInfos[mainRendererIndex].renderer).GetComponent<SkinnedMeshRenderer>();
		}

		private static void SetupCharacterDirection(GameObject prefab, Transform modelBaseTransform, Transform modelTransform)
		{
			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)
		{
			CameraTargetParams component = prefab.GetComponent<CameraTargetParams>();
			component.cameraParams = Resources.Load<GameObject>("Prefabs/CharacterBodies/MercBody").GetComponent<CameraTargetParams>().cameraParams;
			component.cameraPivotTransform = prefab.transform.Find("ModelBase").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 SetupRigidbody(GameObject prefab)
		{
			Rigidbody component = prefab.GetComponent<Rigidbody>();
			component.mass = 100f;
		}

		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)
			HurtBoxGroup val = model.AddComponent<HurtBoxGroup>();
			ChildLocator component = model.GetComponent<ChildLocator>();
			if (!Object.op_Implicit((Object)(object)component.FindChild("MainHurtbox")))
			{
				Log.Error("Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator component called 'MainHurtbox'");
				return;
			}
			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;
		}

		private static void SetupFootstepController(GameObject model)
		{
			FootstepHandler val = model.AddComponent<FootstepHandler>();
			val.baseFootstepString = "Play_player_footstep";
			val.sprintFootstepOverrideString = "";
			val.enableFootstepDust = true;
			val.footstepDustPrefab = Resources.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)Resources.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>();
		}

		internal 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;
		}
	}
	internal static class Projectiles
	{
		public static GameObject shockwave;

		public static GameObject blastProjectile;

		public static GameObject blastProjectileGhost;

		internal static void RegisterProjectiles()
		{
			//IL_003f: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			shockwave = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/BrotherSunderWave"), "MechorillaShockwave", true);
			((Component)shockwave.transform.GetChild(0)).transform.localScale = new Vector3(10f, 1.5f, 1f);
			shockwave.GetComponent<ProjectileCharacterController>().lifetime = 2f;
			shockwave.GetComponent<ProjectileDamage>().damageType = (DamageType)131072;
			GameObject val = CreateGhostPrefab("MechorillaShockwaveGhost");
			val.AddComponent<FuckShitThisIsBad>();
			shockwave.GetComponent<ProjectileController>().ghostPrefab = val;
			Prefabs.projectilePrefabs.Add(shockwave);
			blastProjectile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Captain/CaptainAirstrikeProjectile1.prefab").WaitForCompletion(), "MechorillaBlastProjectile", true);
			blastProjectileGhost = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Captain/CaptainAirstrikeGhost1.prefab").WaitForCompletion(), "MechorillaBlastProjectileGhost", true);
			((Renderer)((Component)blastProjectileGhost.transform.Find("Expander").Find("Sphere, Inner Expanding")).GetComponent<MeshRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/matTeamAreaIndicatorIntersectionMonster.mat").WaitForCompletion();
			blastProjectile.GetComponent<ProjectileImpactExplosion>().impactEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lightning/LightningStrikeImpact.prefab").WaitForCompletion();
			blastProjectile.GetComponent<ProjectileController>().ghostPrefab = blastProjectileGhost;
			Prefabs.projectilePrefabs.Add(blastProjectile);
		}

		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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			((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).explosionSoundString = "";
			((ProjectileExplosion)projectileImpactExplosion).falloffModel = (FalloffModel)0;
			((ProjectileExplosion)projectileImpactExplosion).fireChildren = false;
			projectileImpactExplosion.impactEffect = null;
			projectileImpactExplosion.lifetime = 0f;
			projectileImpactExplosion.lifetimeAfterImpact = 0f;
			projectileImpactExplosion.lifetimeExpiredSoundString = "";
			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);
			val.AddComponent<NetworkIdentity>();
			val.AddComponent<ProjectileGhostController>();
			Assets.ConvertAllRenderersToHopooShader(val);
			return val;
		}

		private static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName)
		{
			return PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName);
		}
	}
	internal static class Skills
	{
		internal static List<SkillFamily> skillFamilies = new List<SkillFamily>();

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

		public static void CreateSkillFamilies(GameObject targetPrefab, int families = 15, 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>();
			if (((uint)families & (true ? 1u : 0u)) != 0)
			{
				component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary");
			}
			if (((uint)families & 2u) != 0)
			{
				component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary");
			}
			if (((uint)families & 4u) != 0)
			{
				component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility");
			}
			if (((uint)families & 8u) != 0)
			{
				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;
			skillFamilies.Add(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
		{
			T val = ScriptableObject.CreateInstance<T>();
			popuplateSKillDef(skillDefInfo, (SkillDef)(object)val);
			skillDefs.Add((SkillDef)(object)val);
			return val;
		}

		private static void popuplateSKillDef(SkillDefInfo skillDefInfo, SkillDef skillDef)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			skillDef.skillName = skillDefInfo.skillName;
			((Object)skillDef).name = skillDefInfo.skillName;
			skillDef.skillNameToken = skillDefInfo.skillNameToken;
			skillDef.skillDescriptionToken = skillDefInfo.skillDescriptionToken;
			skillDef.icon = skillDefInfo.skillIcon;
			skillDef.activationState = skillDefInfo.activationState;
			skillDef.activationStateMachineName = skillDefInfo.activationStateMachineName;
			skillDef.baseMaxStock = skillDefInfo.baseMaxStock;
			skillDef.baseRechargeInterval = skillDefInfo.baseRechargeInterval;
			skillDef.beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd;
			skillDef.canceledFromSprinting = skillDefInfo.canceledFromSprinting;
			skillDef.forceSprintDuringState = skillDefInfo.forceSprintDuringState;
			skillDef.fullRestockOnAssign = skillDefInfo.fullRestockOnAssign;
			skillDef.interruptPriority = skillDefInfo.interruptPriority;
			skillDef.resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse;
			skillDef.isCombatSkill = skillDefInfo.isCombatSkill;
			skillDef.mustKeyPress = skillDefInfo.mustKeyPress;
			skillDef.cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation;
			skillDef.rechargeStock = skillDefInfo.rechargeStock;
			skillDef.requiredStock = skillDefInfo.requiredStock;
			skillDef.stockToConsume = skillDefInfo.stockToConsume;
			skillDef.keywordTokens = skillDefInfo.keywordTokens;
		}

		internal static SkillDef CreatePrimarySkillDef(SerializableEntityStateType state, string stateMachine, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, bool agile)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			SkillDefInfo skillDefInfo = new SkillDefInfo(skillNameToken, skillNameToken, skillDescriptionToken, skillIcon, state, stateMachine, agile);
			return CreateSkillDef(skillDefInfo);
		}
	}
	public static class Skins
	{
		public static SkinDef CreateSkinDef(string skinName, Sprite skinIcon, RendererInfo[] rendererInfos, SkinnedMeshRenderer mainRenderer, GameObject root)
		{
			return CreateSkinDef(skinName, skinIcon, rendererInfos, mainRenderer, root, null);
		}

		public static SkinDef CreateSkinDef(string skinName, Sprite skinIcon, RendererInfo[] rendererInfos, SkinnedMeshRenderer mainRenderer, GameObject root, UnlockableDef unlockableDef)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			SkinDefInfo val = default(SkinDefInfo);
			val.BaseSkins = Array.Empty<SkinDef>();
			val.GameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0];
			val.Icon = skinIcon;
			val.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0];
			val.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0];
			val.Name = skinName;
			val.NameToken = skinName;
			val.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0];
			val.RendererInfos = rendererInfos;
			val.RootObject = root;
			val.UnlockableDef = unlockableDef;
			SkinDefInfo val2 = val;
			return LoadoutAPI.CreateNewSkinDef(val2);
		}
	}
	public static class States
	{
		internal static List<Type> entityStates = new List<Type>();

		internal static void AddSkill(Type t)
		{
			entityStates.Add(t);
		}

		public static void RegisterStates()
		{
			AddSkill(typeof(DeathState));
			AddSkill(typeof(GroundSmash));
			AddSkill(typeof(GroundSmashQuick));
			AddSkill(typeof(JumpState));
			AddSkill(typeof(MainState));
			AddSkill(typeof(SpawnState));
			AddSkill(typeof(SweepingBeam));
			AddSkill(typeof(EndBlasts));
			AddSkill(typeof(FireBlasts));
			AddSkill(typeof(PrepBlasts));
		}
	}
	internal static class Tokens
	{
		internal static void AddTokens()
		{
			string text = "ROB_MECHORILLA_BODY_";
			string text2 = "The Steel Mechorilla is a big guy.<color=#CCD3E0>" + Environment.NewLine + Environment.NewLine;
			text2 = text2 + "< ! > This 'character' is not viable." + Environment.NewLine + Environment.NewLine;
			text2 = text2 + "< ! > He genuinely is not fun." + Environment.NewLine + Environment.NewLine;
			text2 = text2 + "< ! > Don't play this expecting to have a good time." + Environment.NewLine + Environment.NewLine;
			text2 = text2 + "< ! > Thank you." + Environment.NewLine + Environment.NewLine;
			string text3 = "..and so it left, leaving irreparable damage in its wake.";
			string text4 = "..and so it vanished, returning to its eternal slumber.";
			string text5 = "A construction Chimera designed to destroy the old Chimera Lab to make way for a new building. Seems to have gotten lost in transit at some point and went berserk as a result.";
			LanguageAPI.Add(text + "NAME", "Steel Mechorilla");
			LanguageAPI.Add(text + "DESCRIPTION", text2);
			LanguageAPI.Add(text + "SUBTITLE", "Mechanical Chimera");
			LanguageAPI.Add(text + "LORE", text5);
			LanguageAPI.Add(text + "OUTRO_FLAVOR", text3);
			LanguageAPI.Add(text + "OUTRO_FAILURE", text4);
			LanguageAPI.Add(text + "DEFAULT_SKIN_NAME", "Default");
			LanguageAPI.Add(text + "MONSOON_SKIN_NAME", "Gorilla");
			LanguageAPI.Add(text + "PRIMARY_GRAB_NAME", "Slam");
			LanguageAPI.Add(text + "PRIMARY_GRAB_DESCRIPTION", $"Slam the ground in front for <style=cIsDamage>{150f}% damage</style>.");
			LanguageAPI.Add(text + "SECONDARY_GROUNDSMASH_NAME", "Ground Smash");
			LanguageAPI.Add(text + "SECONDARY_GROUNDSMASH_DESCRIPTION", $"Smash the ground with all your might, sending forth two <style=cIsDamage>shockwaves</style> along the ground that deal <style=cIsDamage>{250f}% damage</style>.");
			LanguageAPI.Add(text + "UTILITY_SWEEPINGBEAM_NAME", "Sweeping Beam");
			LanguageAPI.Add(text + "UTILITY_SWEEPINGBEAM_DESCRIPTION", "Fire a sweeping laser beam in front.");
			LanguageAPI.Add(text + "SPECIAL_BLAST_NAME", "Blast");
			LanguageAPI.Add(text + "SPECIAL_BLAST_DESCRIPTION", $"Fire a barrage of aerial blasts for <style=cIsDamage>{500f}% damage</style> each.");
			LanguageAPI.Add(text + "MONSOONUNLOCKABLE_UNLOCKABLE_NAME", "Mechorilla: Mastery");
			LanguageAPI.Add(text + "MONSOONUNLOCKABLE_ACHIEVEMENT_NAME", "Mechorilla: Mastery");
			LanguageAPI.Add(text + "MONSOONUNLOCKABLE_ACHIEVEMENT_DESC", "As Steel Mechorilla, beat the game or obliterate on Monsoon.");
		}
	}
}
namespace SteelMechorilla.Modules.Enemies
{
	internal class Mechorilla
	{
		internal static Mechorilla instance;

		internal static GameObject characterPrefab;

		internal static GameObject survivorPrefab;

		internal static GameObject displayPrefab;

		internal static GameObject bossMaster;

		internal static GameObject umbraMaster;

		internal static ConfigEntry<bool> characterEnabled;

		internal static ConfigEntry<bool> enemyEnabled;

		internal static ConfigEntry<int> minimumStageCount;

		internal static ConfigEntry<int> spawnCost;

		public const string bodyName = "MechorillaBody";

		public static int bodyRendererIndex;

		internal static ItemDisplayRuleSet itemDisplayRuleSet;

		internal static List<KeyAssetRuleGroup> itemDisplayRules;

		internal static UnlockableDef masteryUnlockableDef;

		internal void CreateCharacter()
		{
			instance = this;
			enemyEnabled = Config.EnemyEnableConfig("Steel Mechorilla");
			characterEnabled = Config.CharacterEnableConfig("Steel Mechorilla (Playable)");
			if (enemyEnabled.Value || characterEnabled.Value)
			{
				if (characterEnabled.Value)
				{
					masteryUnlockableDef = UnlockableAPI.AddUnlockable<MasteryAchievement>((Type)null, (UnlockableDef)null);
				}
				characterPrefab = CreateBodyPrefab(isPlayer: false);
				survivorPrefab = CreateBodyPrefab(isPlayer: true);
				CharacterBody component = survivorPrefab.GetComponent<CharacterBody>();
				component.baseMaxHealth = 480f;
				component.levelMaxHealth = 144f;
				displayPrefab = Prefabs.CreateDisplayPrefab("MechorillaDisplay", characterPrefab);
				if (characterEnabled.Value)
				{
					Prefabs.RegisterNewSurvivor(survivorPrefab, displayPrefab, "MECHORILLA");
				}
				bossMaster = CreateMaster(characterPrefab, "MechorillaMaster");
				umbraMaster = CreateMaster(survivorPrefab, "MechorillaMonsterMaster");
				if (enemyEnabled.Value)
				{
					CreateSpawnCard();
				}
			}
			Hook();
		}

		private static GameObject CreateBodyPrefab(bool isPlayer)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			string text = "MechorillaBody";
			if (isPlayer)
			{
				text = "MechorillaPlayerBody";
			}
			string characterName = "Mechorilla";
			if (isPlayer)
			{
				characterName = "MechorillaPlayer";
			}
			GameObject val = Prefabs.CreatePrefab(text, "mdlMechorilla", new BodyInfo
			{
				armor = 20f,
				armorGrowth = 0f,
				bodyName = text,
				bodyNameToken = "ROB_MECHORILLA_BODY_NAME",
				bodyColor = Color.grey,
				characterPortrait = Assets.LoadCharacterIcon(characterName),
				crosshair = Assets.LoadCrosshair("SimpleDot"),
				damage = 40f,
				healthGrowth = 630f,
				healthRegen = 0f,
				jumpCount = 1,
				maxHealth = 2100f,
				subtitleNameToken = "ROB_MECHORILLA_BODY_SUBTITLE",
				podPrefab = null,
				moveSpeed = 6f,
				jumpPower = 35f,
				attackSpeed = 2f
			});
			CharacterBody component = val.GetComponent<CharacterBody>();
			component.hideCrosshair = true;
			component.hullClassification = (HullClassification)1;
			component.bodyFlags = (BodyFlags)0;
			component.isChampion = true;
			component.preferredInitialStateType = new SerializableEntityStateType(typeof(SpawnState));
			CharacterMotor component2 = val.GetComponent<CharacterMotor>();
			component2.mass = 10000f;
			SfxLocator component3 = val.GetComponent<SfxLocator>();
			component3.barkSound = "";
			component3.landingSound = "Play_gravekeeper_land";
			component3.deathSound = "";
			component3.fallDamageSound = "";
			FootstepHandler componentInChildren = val.GetComponentInChildren<FootstepHandler>();
			componentInChildren.footstepDustPrefab = Resources.Load<GameObject>("Prefabs/GenericHugeFootstepDust");
			componentInChildren.baseFootstepString = "Play_moonBrother_step";
			componentInChildren.sprintFootstepOverrideString = "Play_moonBrother_sprint";
			CharacterCameraParams defaultCameraParams = CameraParams.defaultCameraParams;
			KinematicCharacterMotor component4 = val.GetComponent<KinematicCharacterMotor>();
			component4.CapsuleRadius = 4f;
			component4.CapsuleHeight = 9f;
			CharacterDirection component5 = val.GetComponent<CharacterDirection>();
			component5.turnSpeed = 135f;
			Interactor component6 = val.GetComponent<Interactor>();
			component6.maxInteractionDistance = 8f;
			val.GetComponent<CameraTargetParams>().cameraParams = defaultCameraParams;
			val.GetComponent<EntityStateMachine>().mainStateType = new SerializableEntityStateType(typeof(MainState));
			Type type = (isPlayer ? typeof(SpawnTeleporterState) : typeof(SpawnState));
			val.GetComponent<EntityStateMachine>().initialStateType = new SerializableEntityStateType(type);
			val.GetComponent<CharacterDeathBehavior>().deathState = new SerializableEntityStateType(typeof(DeathState));
			val.GetComponentInChildren<ModelLocator>().normalizeToFloor = false;
			Object.Destroy((Object)(object)val.GetComponent<SetStateOnHurt>());
			if (!isPlayer)
			{
				DeathRewards val2 = val.AddComponent<DeathRewards>();
				val2.logUnlockableDef = Resources.Load<UnlockableDef>("UnlockableDefs/Logs.Parent.0");
				val2.bossPickup = new SerializablePickupIndex
				{
					pickupName = "ItemIndex.Pearl"
				};
			}
			Material material = Assets.CreateMaterial("matMechorilla", 5f, Color.white);
			bodyRendererIndex = 0;
			Prefabs.SetupCharacterModel(val, new CustomRendererInfo[1]
			{
				new CustomRendererInfo
				{
					childName = "Model",
					material = material
				}
			}, bodyRendererIndex);
			CreateHitboxes(val);
			SetupHurtboxes(val);
			CreateSkills(val);
			CreateSkins(val);
			InitializeItemDisplays(val);
			return val;
		}

		private static void CreateSpawnCard()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0030: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0068: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_00de: 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_00ea: 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)
			//IL_00f8: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0110: Unknown resul