Stol.dll

Decompiled 4 months ago
using System;
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 EntityStates;
using EntityStates.Merc;
using EntityStates.TitanMonster;
using HG.Reflection;
using KinematicCharacterController;
using On.RoR2;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Achievements;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
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: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Stol")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Stol")]
[assembly: AssemblyTitle("Stol")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Stol;

public static class Achievements
{
	[RegisterAchievement("STOL_MASTERY", "ACHIEVEMENT_STOL_MASTERY_UNLOCKABLE_ID", null, null)]
	public class MasteryUnlockable : BasePerSurvivorClearGameMonsoonAchievement
	{
		public override BodyIndex LookUpRequiredBodyIndex()
		{
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			return BodyCatalog.FindBodyIndex("StolBody");
		}
	}

	internal static UnlockableDef masteryUnlock;

	public static void RegisterUnlockables()
	{
	}

	private static UnlockableDef NewUnlockable<T>(string AchievementIdentifier, Sprite Icon, string Title, string Description) where T : BaseAchievement
	{
		string text = "ACHIEVEMENT_STOL_";
		UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>();
		string langName = text + AchievementIdentifier + "_NAME";
		string langDesc = text + AchievementIdentifier + "_DESCRIPTION";
		LanguageAPI.Add(langName, Title);
		LanguageAPI.Add(langDesc, Description);
		Func<string> func = () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2]
		{
			Language.GetString(langName),
			Language.GetString(langDesc)
		});
		Type typeFromHandle = typeof(T);
		val.cachedName = text + AchievementIdentifier + "_UNLOCKABLE_ID";
		val.getHowToUnlockString = func;
		val.getUnlockedString = func;
		val.achievementIcon = Icon;
		val.sortScore = 200;
		val.hidden = false;
		ContentAddition.AddUnlockableDef(val);
		return val;
	}
}
internal class Assets
{
	public static AssetBundle MainAssetBundle;

	public static T Load<T>(string name) where T : Object
	{
		return MainAssetBundle.LoadAsset<T>(name);
	}

	public static void PopulateAssets()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		if ((Object)(object)MainAssetBundle == (Object)null)
		{
			using (Stream stream = executingAssembly.GetManifestResourceStream("Stol.AssetBundle." + "Stol".ToLower() + "assets"))
			{
				MainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
		}
	}
}
internal class DisplayBehaviour : MonoBehaviour
{
	private Animator animator;

	public float spawnDuration = 1.2f;

	private void Awake()
	{
		animator = ((Component)this).GetComponent<Animator>();
	}

	private void Start()
	{
		EntityState.PlayAnimationOnAnimator(animator, "Body", "Spawn", "Spawn.playbackRate", spawnDuration);
	}
}
internal class StupidSHit : MonoBehaviour
{
	private TitanRockController controller;

	private bool repositioned;

	private void Awake()
	{
		controller = ((Component)this).GetComponent<TitanRockController>();
	}

	private void FixedUpdate()
	{
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		if (!repositioned && Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.owner))
		{
			repositioned = true;
			((Component)this).transform.position = ((Component)controller.owner.GetComponent<ModelLocator>().modelTransform).GetComponent<ChildLocator>().FindChild("LeftFist").position;
		}
	}
}
internal class Hook
{
	internal static void Hooks()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
	}

	private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
	{
		if ((self.body.baseNameToken == "STOL_NAME" && Utils.HasDamageType(damageInfo, (DamageType)256)) || Utils.HasDamageType(damageInfo, (DamageType)128) || Utils.HasDamageType(damageInfo, (DamageType)8192) || Utils.HasDamageType(damageInfo, (DamageType)4096) || Utils.HasDamageType(damageInfo, (DamageType)16777216) || Utils.HasDamageType(damageInfo, (DamageType)512) || Utils.HasDamageType(damageInfo, (DamageType)1048576) || Utils.HasDamageType(damageInfo, (DamageType)1024) || Utils.HasDamageType(damageInfo, (DamageType)134217728))
		{
			damageInfo.damage *= 0.7f;
		}
		orig.Invoke(self, damageInfo);
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Dragonyck.Stol", "Stol", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.Stol";

	public const string MODNAME = "Stol";

	public const string VERSION = "1.0.0";

	public const string SURVIVORNAME = "Stol";

	public const string SURVIVORNAMEKEY = "STOL";

	public static GameObject characterPrefab;

	public static readonly Color characterColor = Color32.op_Implicit(new Color32((byte)112, (byte)133, (byte)70, byte.MaxValue));

	public static SkillDef passive;

	private void Awake()
	{
		Assets.PopulateAssets();
		Prefabs.CreatePrefabs();
		CreatePrefab();
		RegisterStates();
		RegisterCharacter();
		Hook.Hooks();
	}

	internal static void CreatePrefab()
	{
		//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_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: 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_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Expected O, but got Unknown
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: 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_03e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_0426: Unknown result type (might be due to invalid IL or missing references)
		//IL_0432: Unknown result type (might be due to invalid IL or missing references)
		//IL_043c: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0509: Unknown result type (might be due to invalid IL or missing references)
		//IL_050e: Unknown result type (might be due to invalid IL or missing references)
		//IL_062f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0634: Unknown result type (might be due to invalid IL or missing references)
		//IL_0657: Unknown result type (might be due to invalid IL or missing references)
		//IL_065c: Unknown result type (might be due to invalid IL or missing references)
		//IL_066d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0672: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a5: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Titan/TitanBody.prefab").WaitForCompletion();
		characterPrefab = PrefabAPI.InstantiateClone(val, "StolBody", true);
		characterPrefab.GetComponent<NetworkIdentity>().localPlayerAuthority = true;
		Object.Destroy((Object)(object)characterPrefab.GetComponent<DeathRewards>());
		Transform child = characterPrefab.transform.GetChild(0);
		child.localPosition = Vector3.up * -0.9f;
		GameObject gameObject = ((Component)characterPrefab.GetComponent<ModelLocator>().modelTransform).gameObject;
		gameObject.transform.localScale = Vector3.one * 0.1f;
		CharacterModel component = gameObject.GetComponent<CharacterModel>();
		Renderer renderer = component.baseRendererInfos[8].renderer;
		component.baseRendererInfos[8] = new RendererInfo
		{
			renderer = component.baseRendererInfos[7].renderer,
			defaultMaterial = component.baseRendererInfos[7].defaultMaterial,
			defaultShadowCastingMode = (ShadowCastingMode)1,
			ignoreOverlays = true
		};
		((Component)renderer).transform.localScale = Vector3.one * 0.25f;
		renderer.material = new Material(renderer.material);
		renderer.material.SetFloat("_AlphaBoost", 2f);
		((Component)component.baseRendererInfos[18].renderer).gameObject.SetActive(false);
		Light componentInChildren = gameObject.GetComponentInChildren<Light>();
		Object.Destroy((Object)(object)((Component)componentInChildren).GetComponent<LightIntensityCurve>());
		componentInChildren.intensity = 70f;
		ModelSkinController component2 = gameObject.GetComponent<ModelSkinController>();
		List<SkinDef> list = component2.skins.ToList();
		list.RemoveAt(1);
		Sprite icon = LoadoutAPI.CreateSkinIcon(Color32.op_Implicit(new Color32((byte)96, (byte)131, (byte)111, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)58, (byte)68, (byte)77, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)123, (byte)124, (byte)145, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)58, (byte)68, (byte)77, byte.MaxValue)));
		for (int i = 0; i < list.Count; i++)
		{
			list[i].icon = icon;
			list[i].nameToken = "Variation " + (i + 1);
		}
		component2.skins = list.ToArray();
		CharacterDirection component3 = characterPrefab.GetComponent<CharacterDirection>();
		component3.turnSpeed = 720f;
		CharacterBody component4 = characterPrefab.GetComponent<CharacterBody>();
		((Object)component4).name = "StolBody";
		component4.baseNameToken = "STOL_NAME";
		component4.subtitleNameToken = "STOL_SUBTITLE";
		component4.bodyFlags = (BodyFlags)16;
		component4.rootMotionInMainState = false;
		component4.mainRootSpeed = 0f;
		component4.baseMaxHealth = 200f;
		component4.levelMaxHealth = 60f;
		component4.baseRegen = 2.5f;
		component4.levelRegen = 0.5f;
		component4.baseMaxShield = 0f;
		component4.levelMaxShield = 0f;
		component4.baseMoveSpeed = 7f;
		component4.levelMoveSpeed = 0f;
		component4.baseAcceleration = 110f;
		component4.baseJumpPower = 15f;
		component4.levelJumpPower = 0f;
		component4.baseDamage = 12f;
		component4.levelDamage = 2.4f;
		component4.baseAttackSpeed = 1f;
		component4.levelAttackSpeed = 0f;
		component4.baseCrit = 1f;
		component4.levelCrit = 0f;
		component4.baseArmor = 20f;
		component4.levelArmor = 0f;
		component4.baseJumpCount = 1;
		component4.sprintingSpeedMultiplier = 1.45f;
		component4.wasLucky = false;
		component4.hideCrosshair = false;
		component4.hullClassification = (HullClassification)0;
		component4.portraitIcon = (Texture)(object)Assets.MainAssetBundle.LoadAsset<Sprite>("portrait").texture;
		component4.isChampion = false;
		component4.currentVehicle = null;
		component4.skinIndex = 0u;
		component4.bodyColor = characterColor;
		component4.aimOriginTransform.localPosition = Vector3.up * 0.6f;
		HealthComponent component5 = characterPrefab.GetComponent<HealthComponent>();
		component5.health = component4.baseMaxHealth;
		component5.shield = 0f;
		component5.barrier = 0f;
		CharacterMotor component6 = characterPrefab.GetComponent<CharacterMotor>();
		component6.walkSpeedPenaltyCoefficient = 1f;
		component6.characterDirection = component3;
		component6.muteWalkMotion = false;
		component6.mass = 200f;
		component6.airControl = 0.25f;
		component6.disableAirControlUntilCollision = false;
		component6.generateParametersOnAwake = true;
		InputBankTest component7 = characterPrefab.GetComponent<InputBankTest>();
		component7.moveVector = Vector3.zero;
		CameraTargetParams component8 = characterPrefab.GetComponent<CameraTargetParams>();
		component8.cameraParams = Prefabs.Load<CharacterCameraParams>("RoR2/Base/Common/ccpStandard.asset");
		component8.cameraPivotTransform = null;
		component8.recoil = Vector2.zero;
		component8.dontRaycastToPivot = false;
		characterPrefab.GetComponent<Interactor>().maxInteractionDistance = 3.5f;
		characterPrefab.GetComponent<InteractionDriver>().highlightInteractor = true;
		SfxLocator component9 = characterPrefab.GetComponent<SfxLocator>();
		component9.deathSound = "Play_titanboss_death";
		component9.barkSound = "Play_titanboss_idle";
		component9.openSound = "";
		component9.landingSound = "Play_char_land";
		component9.fallDamageSound = "Play_char_land_fall_damage";
		component9.aliveLoopStart = "";
		component9.aliveLoopStop = "";
		KinematicCharacterMotor component10 = characterPrefab.GetComponent<KinematicCharacterMotor>();
		component10.CapsuleRadius = 0.5f;
		component10.CapsuleHeight = 1.82f;
		CapsuleCollider component11 = characterPrefab.GetComponent<CapsuleCollider>();
		component11.radius = 0.5f;
		component11.height = 1.82f;
		characterPrefab.GetComponent<Rigidbody>().mass = component6.mass;
		FootstepHandler component12 = gameObject.GetComponent<FootstepHandler>();
		component12.baseFootstepString = "Play_player_footstep";
		component12.sprintFootstepOverrideString = "";
		component12.enableFootstepDust = true;
		component12.footstepDustPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/GenericFootstepDust.prefab").WaitForCompletion();
		EntityStateMachine component13 = ((Component)component4).GetComponent<EntityStateMachine>();
		component13.initialStateType = new SerializableEntityStateType(typeof(SpawnState));
		component13.mainStateType = new SerializableEntityStateType(typeof(CharacterMain));
		CharacterDeathBehavior component14 = characterPrefab.GetComponent<CharacterDeathBehavior>();
		component14.deathStateMachine = characterPrefab.GetComponent<EntityStateMachine>();
		component14.deathState = new SerializableEntityStateType(typeof(GenericCharacterDeath));
		Utils.NewStateMachine<Idle>(characterPrefab, "Switch");
		Utils.NewStateMachine<Idle>(characterPrefab, "Laser");
		Utils.NewStateMachine<Idle>(characterPrefab, "Summon");
		NetworkStateMachine component15 = ((Component)component4).GetComponent<NetworkStateMachine>();
		component15.stateMachines = ((Component)component4).GetComponents<EntityStateMachine>();
		ContentAddition.AddBody(characterPrefab);
	}

	private void RegisterCharacter()
	{
		//IL_0094: 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)
		string text = " <style=cSub>\r\n\r\n< ! > \r\n\r\nRock Throw can be used to deal with enemies within close range, it becomes a lot harder to use the further an enemy is.< ! > \r\n\r\nLaser eye is much more efficient with dealing with ranged and flying enemies, so it would be smart to use laser eye when enemies are to far away for rock throw to reach.< ! > \r\n\r\nWhen dealing with a large hoard of enemies it would be smart to activate stone construct to get some easy damage on multiple enemies around you.";
		string text2 = "..and so it left, finally finding purpose.";
		string text3 = "..and so it vanished, dying with its creator.";
		string text4 = "“A flash of red lightning, and a hillside moved to form this stone warrior. A smaller version of a stone titan, this Thing commands not just lesser stone constructs, but the earth itself. Shaping rudimentary weapons out of dirt, this rock monster is capable of striking from any distance with incredible force.\r\n\r\nThough, reflecting on the rock constructs immense power, that leads me to think... For what purpose does this construct serve?”\r\n\r\nThe Mysteries of Petrichor V, First Draft";
		LanguageAPI.Add("STOL_NAME", "Stol");
		LanguageAPI.Add("STOL_DESCRIPTION", text);
		LanguageAPI.Add("STOL_SUBTITLE", "");
		LanguageAPI.Add("STOL_OUTRO", text2);
		LanguageAPI.Add("STOL_FAIL", text3);
		LanguageAPI.Add("STOL_LORE", text4);
		SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>();
		val.cachedName = "STOL_NAME";
		val.unlockableDef = null;
		val.descriptionToken = "STOL_DESCRIPTION";
		val.primaryColor = characterColor;
		val.bodyPrefab = characterPrefab;
		val.displayPrefab = Utils.NewDisplayModel(((Component)characterPrefab.GetComponent<ModelLocator>().modelBaseTransform).gameObject, "StolDisplay");
		val.outroFlavorToken = "STOL_OUTRO";
		val.desiredSortPosition = 22f;
		val.mainEndingEscapeFailureFlavorToken = "STOL_FAIL";
		ContentAddition.AddSurvivorDef(val);
		SkillSetup();
		GameObject val2 = PrefabAPI.InstantiateClone(Prefabs.Load<GameObject>("RoR2/Base/Commando/CommandoMonsterMaster.prefab"), "StolMaster", true);
		ContentAddition.AddMaster(val2);
		CharacterMaster component = val2.GetComponent<CharacterMaster>();
		component.bodyPrefab = characterPrefab;
	}

	private void RegisterStates()
	{
		//IL_0003: 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_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: 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)
		bool flag = default(bool);
		ContentAddition.AddEntityState<Primary>(ref flag);
		ContentAddition.AddEntityState<PrimaryLaser>(ref flag);
		ContentAddition.AddEntityState<Secondary>(ref flag);
		ContentAddition.AddEntityState<SecondaryCharge>(ref flag);
		ContentAddition.AddEntityState<Utility>(ref flag);
		ContentAddition.AddEntityState<Special>(ref flag);
		ContentAddition.AddEntityState<CharacterMain>(ref flag);
		ContentAddition.AddEntityState<MeleeSkillState>(ref flag);
		ContentAddition.AddEntityState<BasicMeleeSkillState>(ref flag);
		ContentAddition.AddEntityState<SpawnState>(ref flag);
	}

	private void SkillSetup()
	{
		GenericSkill[] componentsInChildren = characterPrefab.GetComponentsInChildren<GenericSkill>();
		foreach (GenericSkill val in componentsInChildren)
		{
			Object.DestroyImmediate((Object)(object)val);
		}
		PassiveSetup();
		PrimarySetup();
		SecondarySetup();
		UtilitySetup();
		SpecialSetup();
	}

	[SystemInitializer(new Type[] { typeof(ItemCatalog) })]
	public static void PassiveItemSetup()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		((PassiveItemSkillDef)passive).passiveItem = Items.Knurl;
	}

	private void PassiveSetup()
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("STOL_PASSIVE_NAME", "Stone Skin");
		LanguageAPI.Add("STOL_PASSIVE_DESCRIPTION", "Start with a titanic knurl, and receive <style=cIsDamage>30%</style> less damage from all elemental attacks.");
		component.passiveSkill.enabled = false;
		component.passiveSkill.skillNameToken = "STOL_PASSIVE_NAME";
		component.passiveSkill.skillDescriptionToken = "STOL_PASSIVE_DESCRIPTION";
		component.passiveSkill.icon = Assets.MainAssetBundle.LoadAsset<Sprite>("passive");
		SkillDef skill = Utils.NewSkillDef<PassiveItemSkillDef>(typeof(Idle), "Weapon", 0, 0f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: true, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: false, cancelSprintingOnActivation: true, 0, 0, 0, Assets.MainAssetBundle.LoadAsset<Sprite>("passive"), "STOL_PASSIVE_DESCRIPTION", "STOL_PASSIVE_NAME", Array.Empty<string>());
		Utils.NewGenericSkill(characterPrefab, skill);
		passive = skill;
	}

	private void PrimarySetup()
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("STOL_M1", "Seismic Punch");
		LanguageAPI.Add("STOL_M1_DESCRIPTION", "Rupture the ground, dealing <style=cIsDamage>400% damage</style> and ejecting a rock from the impact for <style=cIsDamage>200% damage</style>.");
		SkillDef skill = Utils.NewSkillDef<GroundedSkillDef>(typeof(Primary), "Body", 0, 0f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: true, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: false, cancelSprintingOnActivation: true, 0, 0, 0, Assets.MainAssetBundle.LoadAsset<Sprite>("primary"), "STOL_M1_DESCRIPTION", "STOL_M1", Array.Empty<string>());
		component.primary = Utils.NewGenericSkill(characterPrefab, skill);
	}

	private void SecondarySetup()
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("STOL_M2", "Eye Laser");
		LanguageAPI.Add("STOL_M2_DESCRIPTION", "Switch your <style=cIsDamage>primary</style> for <style=cIsUtility>5s</style>, to a long range laser the deals <style=cIsDamage>500% damage</style>.");
		LanguageAPI.Add("STOL_M2_1", "Eye Laser");
		LanguageAPI.Add("STOL_M2_1_DESCRIPTION", "A long range laser the deals <style=cIsDamage>700% damage</style> per second for <style=cIsUtility>5s</style>.");
		SkillDef skill = Utils.NewSkillDef<SkillDef>(typeof(SecondaryCharge), "Switch", 1, 10f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Assets.MainAssetBundle.LoadAsset<Sprite>("secondary"), "STOL_M2_1_DESCRIPTION", "STOL_M2_1", Array.Empty<string>());
		component.secondary = Utils.NewGenericSkill(characterPrefab, skill);
		skill = (Secondary.primaryOverride = Utils.NewSkillDef<SkillDef>(typeof(PrimaryLaser), "Weapon", 1, 0f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Assets.MainAssetBundle.LoadAsset<Sprite>("secondary"), "STOL_M2_1_DESCRIPTION", "STOL_M2_1", Array.Empty<string>()));
	}

	private void UtilitySetup()
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("STOL_UTIL", "Stone Construct");
		LanguageAPI.Add("STOL_UTIL_DESCRIPTION", "Gain <style=cIsDamage>20 armor</style> and create a stone orb above your head, that fires <style=cIsDamage>1</style> laser every second for <style=cIsUtility>10s</style>, each laser deals <style=cIsDamage>100% damage</style>.");
		SkillDef skill = Utils.NewSkillDef<SkillDef>(typeof(Utility), "Laser", 1, 15f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Assets.MainAssetBundle.LoadAsset<Sprite>("utility"), "STOL_UTIL_DESCRIPTION", "STOL_UTIL", Array.Empty<string>());
		component.utility = Utils.NewGenericSkill(characterPrefab, skill);
	}

	private void SpecialSetup()
	{
		SkillLocator component = characterPrefab.GetComponent<SkillLocator>();
		LanguageAPI.Add("STOL_SPEC", "Stone Guards");
		LanguageAPI.Add("STOL_SPEC_DESCRIPTION", "Create <style=cIsDamage>2</style> Stone Golems that inherit all your items, lasting <style=cIsUtility>30s</style>.");
		SkillDef skill = Utils.NewSkillDef<SkillDef>(typeof(Special), "Summon", 1, 35f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, fullRestockOnAssign: false, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: true, cancelSprintingOnActivation: false, 1, 1, 1, Assets.MainAssetBundle.LoadAsset<Sprite>("special"), "STOL_SPEC_DESCRIPTION", "STOL_SPEC", Array.Empty<string>());
		component.special = Utils.NewGenericSkill(characterPrefab, skill);
	}
}
internal class Prefabs
{
	internal static GameObject rockLaser;

	internal static GameObject rockLaserChargeMuzzle;

	internal static GameObject boulderProjectileGhost;

	internal static GameObject boulderProjectile;

	internal static GameObject rayEffect;

	internal static GameObject rayChargeEffect;

	internal static GameObject spawnEffect;

	internal static BuffDef armor;

	internal static T Load<T>(string path)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
	}

	internal static GameObject Instantiate(string path, string name, bool registerNetwork = false)
	{
		return PrefabAPI.InstantiateClone(Load<GameObject>(path), name, registerNetwork);
	}

	internal static GameObject Instantiate(GameObject obj, string name, bool registerNetwork = false)
	{
		return PrefabAPI.InstantiateClone(obj, name, registerNetwork);
	}

	internal static void CreatePrefabs()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: 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_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Expected O, but got Unknown
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0346: Unknown result type (might be due to invalid IL or missing references)
		//IL_0350: Unknown result type (might be due to invalid IL or missing references)
		//IL_0417: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		armor = Utils.NewBuffDef("Armor", stack: false, hidden: false, Load<Sprite>("RoR2/Junk/Common/texBuffBodyArmorIcon.tif"), MainPlugin.characterColor);
		spawnEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Titan/TitanSpawnEffect.prefab"), "SpawnEffect", false);
		ParticleSystem[] componentsInChildren = spawnEffect.GetComponentsInChildren<ParticleSystem>(true);
		foreach (ParticleSystem val in componentsInChildren)
		{
			MainModule main = val.main;
			((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)0;
		}
		spawnEffect.transform.localScale = Vector3.one * 0.25f;
		ContentAddition.AddEffect(spawnEffect);
		rayChargeEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Golem/ChargeGolem.prefab"), "LaserChargeEffect", false);
		rayChargeEffect.AddComponent<DestroyOnParticleEnd>();
		ParticleSystemRenderer[] componentsInChildren2 = rayChargeEffect.GetComponentsInChildren<ParticleSystemRenderer>(true);
		foreach (ParticleSystemRenderer val2 in componentsInChildren2)
		{
			((Component)val2).gameObject.SetActive(true);
			((Component)val2).transform.localScale = Vector3.one * 0.35f;
			if (((Object)val2).name == "Glow")
			{
				Material val3 = new Material(Load<Material>("RoR2/Base/Common/VFX/matArcaneCircleProvi.mat"));
				val3.SetTexture("_MainTex", (Texture)(object)Load<Texture2D>("RoR2/Base/ArtifactCompounds/texArtifactCompoundCircleMask.png"));
				((Renderer)val2).material = val3;
			}
		}
		rayEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Titan/LaserTitan.prefab"), "LaserEffect", false);
		Object.Destroy((Object)(object)rayEffect.GetComponentInChildren<ShakeEmitter>());
		rayEffect.transform.localScale = Vector3.one * 0.0015f;
		Light val4 = rayEffect.AddComponent<Light>();
		val4.range = 50f;
		val4.color = new Color(0.847058f, 0.180392f, 0.180392f);
		ParticleSystemRenderer[] componentsInChildren3 = rayEffect.GetComponentsInChildren<ParticleSystemRenderer>();
		((Renderer)componentsInChildren3[2]).enabled = false;
		ParticleSystemRenderer[] componentsInChildren4 = rayEffect.GetComponentsInChildren<ParticleSystemRenderer>(true);
		foreach (ParticleSystemRenderer val5 in componentsInChildren4)
		{
			((Component)val5).transform.localScale = Vector3.one * 0.15f;
			if (((Object)val5).name == "Flare")
			{
				((Component)val5).transform.localScale = Vector3.one * 0.08f;
			}
		}
		rockLaserChargeMuzzle = Instantiate("RoR2/Base/Titan/TitanRechargeRocksEffect.prefab", "RockLaserChargeMuzzle");
		ParticleSystem[] componentsInChildren5 = rockLaserChargeMuzzle.GetComponentsInChildren<ParticleSystem>();
		foreach (ParticleSystem val6 in componentsInChildren5)
		{
			MainModule main2 = val6.main;
			((MainModule)(ref main2)).scalingMode = (ParticleSystemScalingMode)0;
		}
		Object.Destroy((Object)(object)rockLaserChargeMuzzle.GetComponent<EffectComponent>());
		rockLaserChargeMuzzle.transform.localScale = Vector3.one * 0.1f;
		Object.Destroy((Object)(object)rockLaserChargeMuzzle.GetComponent<ShakeEmitter>());
		rockLaser = Instantiate("RoR2/Base/Titan/TitanRockController.prefab", "RockLaser", registerNetwork: true);
		rockLaser.AddComponent<StupidSHit>();
		ParticleSystem[] componentsInChildren6 = rockLaser.GetComponentsInChildren<ParticleSystem>();
		foreach (ParticleSystem val7 in componentsInChildren6)
		{
			((Component)val7).transform.localScale = Vector3.one * 0.1f;
			((Component)val7).gameObject.AddComponent<DestroyOnParticleEnd>();
		}
		TitanRockController component = rockLaser.GetComponent<TitanRockController>();
		component.damageCoefficient = 1.5f;
		component.damageForce = 240f;
		component.startDelay = 1f;
		GameObject val8 = Instantiate(component.projectilePrefab, "RockProjectile", registerNetwork: true);
		val8.GetComponent<ProjectileSteerTowardTarget>().rotationSpeed = 160f;
		component.projectilePrefab = val8;
		component.fireInterval = 0.5f;
		rockLaser.GetComponent<DestroyOnTimer>().duration = 10f;
		ContentAddition.AddProjectile(val8);
		boulderProjectileGhost = Instantiate("RoR2/Base/Grandparent/GrandparentBoulderGhost.prefab", "BoulderGhost");
		boulderProjectileGhost.transform.GetChild(0).localScale = Vector3.one * 0.2f;
		boulderProjectile = Instantiate("RoR2/Base/Grandparent/GrandparentBoulder.prefab", "BoulderProjectile", registerNetwork: true);
		boulderProjectile.GetComponent<ProjectileController>().ghostPrefab = boulderProjectileGhost;
		boulderProjectile.GetComponent<SphereCollider>().radius = 0.5f;
		((ProjectileExplosion)boulderProjectile.GetComponent<ProjectileImpactExplosion>()).fireChildren = false;
		boulderProjectile.GetComponent<Rigidbody>().useGravity = false;
		ContentAddition.AddProjectile(boulderProjectile);
	}
}
internal class BasicMeleeSkillState : BaseSkillState
{
	private float duration = 0.2f;

	private Vector3 dir;

	private OverlapAttack attack;

	private float damageCoefficient = 4.2f;

	private GameObject hitEffectPrefab = null;

	private bool parried;

	public Animator animator;

	private uint ID;

	private string hitboxGroupName = "";

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		animator = ((EntityState)this).GetModelAnimator();
		if (!animator.GetBool("slide"))
		{
			((BaseState)this).StartAimMode(1f, true);
		}
		((EntityState)this).PlayAnimation("LeftArm, Override", "MeleeAttack");
		AkSoundEngine.PostEvent(ID, ((EntityState)this).gameObject);
		attack = ((BaseState)this).InitMeleeOverlap(damageCoefficient, hitEffectPrefab, ((EntityState)this).GetModelTransform(), hitboxGroupName);
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).isAuthority)
		{
			attack.Fire((List<HurtBox>)null);
		}
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	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)1;
	}
}
internal class SpawnState : BaseState
{
	public float duration = 4f;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		if (Run.instance.stageClearCount > 0)
		{
			((EntityState)this).outer.SetNextStateToMain();
			return;
		}
		Util.PlaySound(SpawnState.spawnSoundString, ((EntityState)this).gameObject);
		((Component)((EntityState)this).GetModelTransform()).GetComponent<ChildLocator>();
		((EntityState)this).PlayAnimation("Body", "Spawn", "Spawn.playbackRate", duration);
		EffectManager.SimpleMuzzleFlash(Prefabs.spawnEffect, ((EntityState)this).gameObject, "BurrowCenter", 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;
	}
}
internal class CharacterMain : GenericCharacterMain
{
	public override void OnEnter()
	{
		((GenericCharacterMain)this).OnEnter();
	}

	public override void UpdateAnimationParameters()
	{
		((BaseCharacterMain)this).UpdateAnimationParameters();
		((BaseCharacterMain)this).modelAnimator.SetBool(AnimationParameters.isSprinting, false);
	}
}
internal class MeleeSkillState : BaseSkillState
{
	public float attackDuration;

	public float earlyExitDuration;

	private bool hopped;

	private bool hasSwung;

	public bool isInHitPause;

	public float hitPauseDuration;

	public float hopVelocity;

	public float hitPauseTimer;

	public float stopwatch;

	public HitStopCachedState hitStopCachedState;

	public OverlapAttack overlapAttack;

	public bool hasHit;

	private bool hasAnimParameter;

	private float attackSpeedScaling;

	public Animator animator;

	public virtual float baseAttackDuration => 0f;

	public virtual float baseEarlyExitDuration => 0f;

	public virtual float damageCoefficient => 0f;

	public virtual float forceMagnitude => 440f;

	public virtual float rootMotionSpeed => 25f;

	public virtual float baseHopVelocity => 4f;

	public virtual string layerName => "FullBody, Override";

	public virtual string animationStateName => "";

	public virtual string animParameter => "M1";

	public virtual string hitBoxGroupName => animationStateName;

	public virtual string hitBoxActiveParameter => "Curve";

	public virtual string swingMuzzle => animationStateName + "Muzzle";

	public virtual GameObject swingEffectPrefab => null;

	public virtual bool hopOnHit => true;

	public virtual bool rootMotion => true;

	public virtual bool rootMotionWhileHitting => false;

	public virtual uint swingSound => 0u;

	public virtual DamageType damageType => (DamageType)0;

	public virtual DamageColorIndex damageColor => (DamageColorIndex)0;

	public virtual Vector3 bonusForce => Vector3.zero;

	public virtual GameObject hitEffectPrefab => null;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		attackSpeedScaling = Math.Min(((BaseState)this).attackSpeedStat, 6f);
		attackDuration = baseAttackDuration / attackSpeedScaling;
		earlyExitDuration = baseEarlyExitDuration / attackSpeedScaling;
		hitPauseDuration = GroundLight.hitPauseDuration / attackSpeedScaling;
		hopVelocity = baseHopVelocity / attackSpeedScaling;
		((EntityState)this).PlayAnimation(layerName, "BufferEmpty");
		animator = ((EntityState)this).GetModelAnimator();
		animator.SetFloat(hitBoxActiveParameter, 0f);
		((BaseState)this).StartAimMode(attackDuration + 1f, false);
		overlapAttack = ((BaseState)this).InitMeleeOverlap(damageCoefficient, hitEffectPrefab, ((EntityState)this).GetModelTransform(), hitBoxGroupName);
		overlapAttack.pushAwayForce = 1f;
		hasAnimParameter = !Utility.IsNullOrWhiteSpace(animParameter);
		if (hasAnimParameter && !Utility.IsNullOrWhiteSpace(animationStateName))
		{
			((EntityState)this).PlayCrossfade(layerName, animationStateName, animParameter, attackDuration, 0.1f);
		}
	}

	public virtual Vector3 rootMotionDirection()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		return ((EntityState)this).characterDirection.forward;
	}

	public override void FixedUpdate()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).isAuthority)
		{
			bool flag = FireMeleeAttack(overlapAttack, animator, hitBoxActiveParameter, forceMagnitude, bonusForce);
			hasHit = flag;
			if (hasHit)
			{
				if (hopOnHit && !((EntityState)this).characterMotor.isGrounded && !hopped)
				{
					((BaseState)this).SmallHop(((EntityState)this).characterMotor, hopVelocity);
					hopped = true;
				}
				if (!rootMotionWhileHitting && !isInHitPause && hasAnimParameter)
				{
					hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, animParameter);
					isInHitPause = true;
				}
			}
			if (animator.GetFloat(hitBoxActiveParameter) > 0.1f && rootMotion && !isInHitPause && !hasHit)
			{
				Vector3 val = rootMotionDirection();
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(val.x, 0f, val.z);
				CharacterMotor characterMotor = ((EntityState)this).characterMotor;
				characterMotor.rootMotion += val2 * rootMotionSpeed * Time.fixedDeltaTime;
			}
			if (hitPauseTimer >= hitPauseDuration && isInHitPause)
			{
				((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
				isInHitPause = false;
				animator.speed = 1f;
			}
			if (!isInHitPause)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			else
			{
				hitPauseTimer += Time.fixedDeltaTime;
				((EntityState)this).characterMotor.velocity = Vector3.zero;
				animator.speed = 0f;
			}
			if (stopwatch >= attackDuration - earlyExitDuration)
			{
				if (((EntityState)this).inputBank.skill1.down)
				{
					SetState();
				}
				if (stopwatch >= attackDuration)
				{
					BaseSkillState val3 = StateOverride();
					if (val3 != null)
					{
						((EntityState)this).outer.SetNextState((EntityState)(object)val3);
					}
					else
					{
						((EntityState)this).outer.SetNextStateToMain();
					}
					return;
				}
			}
		}
		if (animator.GetFloat(hitBoxActiveParameter) >= 0.11f && !hasSwung)
		{
			hasSwung = true;
			AkSoundEngine.PostEvent(swingSound, ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)swingEffectPrefab) && !Utility.IsNullOrWhiteSpace(swingMuzzle))
			{
				EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, swingMuzzle, false);
			}
		}
	}

	public bool FireMeleeAttack(OverlapAttack attack, Animator animator, string mecanimHitboxActiveParameter, float forceMagnitude, Vector3 bonusForce)
	{
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0043: 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)
		bool result = false;
		if (Object.op_Implicit((Object)(object)animator) && animator.GetFloat(mecanimHitboxActiveParameter) > 0.1f)
		{
			attack.forceVector = (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection) ? ((EntityState)this).characterDirection.forward : (((EntityState)this).transform.forward * forceMagnitude + bonusForce));
			result = attack.Fire((List<HurtBox>)null);
		}
		return result;
	}

	public virtual void SetState()
	{
	}

	public virtual BaseSkillState StateOverride()
	{
		return null;
	}

	public override InterruptPriority GetMinimumInterruptPriority()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return (InterruptPriority)1;
	}
}
internal class Primary : BaseSkillState
{
	private float duration;

	private float baseDuration = 1.2f;

	private float prepTime = 0.45f;

	private bool hasFired;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		duration = baseDuration / ((BaseState)this).attackSpeedStat;
		((EntityState)this).PlayCrossfade("Body", "PrepFist", "PrepFist.playbackRate", duration * prepTime, 0.1f);
	}

	public override void FixedUpdate()
	{
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Expected O, but got Unknown
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: 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_0076: 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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: 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_009e: 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_00b5: 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_00bc: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: 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_00e4: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).fixedAge >= duration * prepTime && !hasFired)
		{
			hasFired = true;
			((EntityState)this).PlayAnimation("Body", "FireFist");
			if (((EntityState)this).isAuthority)
			{
				new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					attackerFiltering = (AttackerFiltering)2,
					position = ((EntityState)this).transform.position,
					baseDamage = ((BaseState)this).damageStat * 4f,
					baseForce = 480f,
					crit = ((BaseState)this).RollCrit(),
					falloffModel = (FalloffModel)0,
					radius = 8f,
					teamIndex = ((EntityState)this).teamComponent.teamIndex
				}.Fire();
				Ray aimRay = ((BaseState)this).GetAimRay();
				ProjectileManager.instance.FireProjectile(Prefabs.boulderProjectile, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat * 2f, 240f, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f);
			}
			EffectManager.SpawnEffect(Prefabs.Load<GameObject>("RoR2/Base/Parent/ParentSlamEffect.prefab"), new EffectData
			{
				origin = ((EntityState)this).transform.position,
				scale = 8f
			}, false);
		}
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	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;
	}
}
internal class PrimaryLaser : BaseSkillState
{
	public override void OnExit()
	{
		((EntityState)this).skillLocator.primary.UnsetSkillOverride((object)((EntityState)this).gameObject, Secondary.primaryOverride, (SkillOverridePriority)4);
		((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)1;
	}
}
internal class SecondaryCharge : BaseSkillState
{
	private float duration;

	private float baseDuration = 1f;

	private GameObject chargeEffect;

	public override void OnEnter()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		((BaseState)this).OnEnter();
		duration = baseDuration / ((BaseState)this).attackSpeedStat;
		Util.PlayAttackSpeedSound(ChargeMegaLaser.chargeAttackSoundString, ((EntityState)this).gameObject, 2.1f / duration);
		Transform val = ((BaseState)this).FindModelChild("MuzzleLaser");
		chargeEffect = Object.Instantiate<GameObject>(Prefabs.rayChargeEffect, val.position, val.rotation);
		chargeEffect.transform.parent = val;
		ScaleParticleSystemDuration component = chargeEffect.GetComponent<ScaleParticleSystemDuration>();
		if (Object.op_Implicit((Object)(object)component))
		{
			component.newDuration = duration;
		}
	}

	public override void FixedUpdate()
	{
		//IL_0019: 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_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: 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_002d: 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_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: 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)
		((EntityState)this).FixedUpdate();
		if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
		{
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector2 val = Util.Vector3XZToVector2XY(((Ray)(ref aimRay)).direction);
			if (val != Vector2.zero)
			{
				((Vector2)(ref val)).Normalize();
				Vector3 val2 = new Vector3(val.x, 0f, val.y);
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				((EntityState)this).characterDirection.moveVector = normalized;
			}
		}
		if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
		{
			((EntityState)this).outer.SetNextState((EntityState)(object)new Secondary());
		}
	}

	public override void OnExit()
	{
		if (Object.op_Implicit((Object)(object)chargeEffect))
		{
			EntityState.Destroy((Object)(object)chargeEffect);
		}
		((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)4;
	}
}
internal class Secondary : BaseSkillState
{
	public static SkillDef primaryOverride;

	private float duration = 5f;

	private float fireFrequency;

	private float baseFireFrequency = 0.1f;

	private float damageCoefficient = 7f;

	private float stopwatch;

	private Transform laserMuzzle;

	private GameObject chargeEffect;

	private GameObject laserEffect;

	private Transform laserEffectEnd;

	private uint ID;

	public override void OnEnter()
	{
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: 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)
		((BaseState)this).OnEnter();
		fireFrequency = baseFireFrequency / ((BaseState)this).attackSpeedStat;
		((EntityState)this).PlayCrossfade("Gesture, Additive", "FireLaserLoop", 0.25f);
		Transform val = (laserMuzzle = ((BaseState)this).FindModelChild("MuzzleLaser"));
		if (Object.op_Implicit((Object)(object)val))
		{
			chargeEffect = Object.Instantiate<GameObject>(Prefabs.rayChargeEffect, val.position, val.rotation, val);
			ScaleParticleSystemDuration component = chargeEffect.GetComponent<ScaleParticleSystemDuration>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.newDuration = 0.5f;
			}
			laserEffect = Object.Instantiate<GameObject>(Prefabs.rayEffect, laserMuzzle.position, laserMuzzle.rotation, laserMuzzle);
			laserEffectEnd = laserEffect.GetComponent<ChildLocator>().FindChild("LaserEnd");
			laserEffectEnd.localPosition = Vector3.zero;
		}
		ID = AkSoundEngine.PostEvent(FireMegaLaser.playLoopSoundString, ((EntityState)this).gameObject);
		AkSoundEngine.PostEvent(FireMegaLaser.playAttackSoundString, ((EntityState)this).gameObject);
	}

	public override void Update()
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: 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_002e: 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_0037: 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_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: 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_00b9: 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_007b: Unknown result type (might be due to invalid IL or missing references)
		((EntityState)this).Update();
		Ray aimRay = ((BaseState)this).GetAimRay();
		float num = 18f;
		float num2 = 0f;
		Ray val = CameraRigController.ModifyAimRayIfApplicable(aimRay, ((EntityState)this).gameObject, ref num2);
		float num3 = num + num2;
		LayerIndex val2 = LayerIndex.world;
		int num4 = LayerMask.op_Implicit(((LayerIndex)(ref val2)).mask);
		val2 = LayerIndex.entityPrecise;
		RaycastHit val3 = default(RaycastHit);
		if (Physics.Raycast(val, ref val3, num3, num4 | LayerMask.op_Implicit(((LayerIndex)(ref val2)).mask)))
		{
			if (Object.op_Implicit((Object)(object)laserEffectEnd))
			{
				laserEffectEnd.position = ((RaycastHit)(ref val3)).point;
			}
		}
		else if (Object.op_Implicit((Object)(object)laserEffectEnd))
		{
			laserEffectEnd.position = laserMuzzle.position + ((Ray)(ref aimRay)).direction * 1000f;
		}
	}

	private void Fire()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: 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_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: 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_00df: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: 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_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		float num = 0.8f;
		((BaseState)this).AddRecoil(-1f * num, -1.5f * num, -0.25f * num, 0.25f * num);
		Ray aimRay = ((BaseState)this).GetAimRay();
		if (((EntityState)this).isAuthority)
		{
			BulletAttack val = new BulletAttack
			{
				maxDistance = 1000f
			};
			LayerIndex entityPrecise = LayerIndex.entityPrecise;
			val.stopperMask = ((LayerIndex)(ref entityPrecise)).mask;
			val.owner = ((EntityState)this).gameObject;
			val.weapon = ((EntityState)this).gameObject;
			val.origin = ((Ray)(ref aimRay)).origin;
			val.aimVector = ((Ray)(ref aimRay)).direction;
			val.minSpread = 0f;
			val.maxSpread = 0.4f;
			val.bulletCount = 1u;
			val.damage = ((BaseState)this).damageStat * damageCoefficient * fireFrequency;
			val.force = 155f;
			val.tracerEffectPrefab = null;
			val.muzzleName = "MuzzleLaser";
			val.hitEffectPrefab = Prefabs.Load<GameObject>("RoR2/Base/Golem/MuzzleflashGolem.prefab");
			val.isCrit = ((BaseState)this).RollCrit();
			val.radius = 0.2f;
			val.procCoefficient = fireFrequency;
			val.smartCollision = true;
			val.damageType = (DamageType)0;
			val.Fire();
		}
	}

	public override void FixedUpdate()
	{
		//IL_0019: 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_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: 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_002d: 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_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: 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)
		((EntityState)this).FixedUpdate();
		if (Object.op_Implicit((Object)(object)((EntityState)this).characterDirection))
		{
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector2 val = Util.Vector3XZToVector2XY(((Ray)(ref aimRay)).direction);
			if (val != Vector2.zero)
			{
				((Vector2)(ref val)).Normalize();
				Vector3 val2 = new Vector3(val.x, 0f, val.y);
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				((EntityState)this).characterDirection.moveVector = normalized;
			}
		}
		((EntityState)this).characterBody.isSprinting = false;
		stopwatch += Time.fixedDeltaTime;
		if (stopwatch >= fireFrequency)
		{
			stopwatch = 0f;
			Fire();
		}
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	public override void OnExit()
	{
		((EntityState)this).PlayCrossfade("Gesture, Additive", "FireLaserEnd", 0.25f);
		AkSoundEngine.StopPlayingID(ID);
		AkSoundEngine.PostEvent(FireMegaLaser.stopLoopSoundString, ((EntityState)this).gameObject);
		if (Object.op_Implicit((Object)(object)chargeEffect))
		{
			EntityState.Destroy((Object)(object)chargeEffect);
		}
		if (Object.op_Implicit((Object)(object)laserEffect))
		{
			EntityState.Destroy((Object)(object)laserEffect);
		}
		((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)1;
	}
}
internal class Special : BaseSkillState
{
	private int summonCount = 2;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		for (int i = 0; i < summonCount; i++)
		{
			Summon();
		}
	}

	private void Summon()
	{
		//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_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected O, but got Unknown
		if (NetworkServer.active)
		{
			MasterSummon val = new MasterSummon
			{
				masterPrefab = Prefabs.Load<GameObject>("RoR2/Base/Golem/GolemMaster.prefab"),
				position = Utils.FindNearestNodePosition(((EntityState)this).transform.position, (GraphType)0),
				rotation = Util.QuaternionSafeLookRotation(((EntityState)this).characterDirection.forward),
				summonerBodyObject = ((EntityState)this).gameObject,
				ignoreTeamMemberLimit = true
			};
			val.inventoryToCopy = ((EntityState)this).characterBody.inventory;
			CharacterMaster val2 = val.Perform();
			val2.inventory.GiveItem(Items.BoostDamage, 10);
			val2.inventory.GiveItem(Items.BoostHp, 10);
			val2.inventory.GiveItem(Items.HealthDecay, 30);
		}
	}

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

	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)1;
	}
}
internal class Utility : BaseSkillState
{
	private float duration = 11f;

	private float castTime;

	private GameObject chargeEffect;

	private bool end;

	public override void OnEnter()
	{
		((BaseState)this).OnEnter();
		castTime = 1f / ((BaseState)this).attackSpeedStat;
		AkSoundEngine.PostEvent(RechargeRocks.attackSoundString, ((EntityState)this).gameObject);
		((EntityState)this).PlayCrossfade("Body", "RechargeRocks", "RechargeRocks.playbackRate", castTime, 0.2f);
		if (NetworkServer.active)
		{
			GameObject val = Object.Instantiate<GameObject>(Prefabs.rockLaser);
			TitanRockController component = val.GetComponent<TitanRockController>();
			component.SetOwner(((EntityState)this).gameObject);
			component.fireInterval /= ((BaseState)this).attackSpeedStat;
			component.startDelay = castTime;
			NetworkServer.Spawn(val);
		}
		if (NetworkServer.active)
		{
			((EntityState)this).characterBody.AddTimedBuff(Prefabs.armor, duration);
		}
	}

	public override void FixedUpdate()
	{
		((EntityState)this).FixedUpdate();
		if (((EntityState)this).fixedAge >= castTime && !end)
		{
			end = true;
			if (((EntityState)this).GetModelAnimator().GetBool("isMoving"))
			{
				((EntityState)this).PlayAnimation("Body", "Run");
			}
			else
			{
				((EntityState)this).PlayAnimation("Body", "Idle");
			}
		}
		if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
		{
			((EntityState)this).outer.SetNextStateToMain();
		}
	}

	public override void OnExit()
	{
		if (Object.op_Implicit((Object)(object)chargeEffect))
		{
			EntityState.Destroy((Object)(object)chargeEffect);
		}
		((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)1;
	}
}
internal class Sounds
{
	public static readonly uint Sound1;

	public static readonly uint Sound2;

	public static readonly uint Sound3;

	public static readonly uint Sound4;
}
internal static class Extensions
{
	public static GameObject NewSyringe(this GameObject g, params Material[] m)
	{
		((Renderer)g.GetComponentsInChildren<MeshRenderer>(false)[0]).material = m[0];
		((Renderer)g.GetComponent<TrailRenderer>()).material = m[1];
		((Renderer)g.GetComponent<ParticleSystemRenderer>()).material = m[2];
		return g;
	}

	public static Material SwapTexture(this Material m, Texture2D t)
	{
		m.mainTexture = (Texture)(object)t;
		return m;
	}

	public static GameObject SwapMaterials(this GameObject g, Material[] m)
	{
		Renderer[] componentsInChildren = g.GetComponentsInChildren<Renderer>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			if (Object.op_Implicit((Object)(object)m[i]))
			{
				componentsInChildren[i].material = m[i];
			}
		}
		return g;
	}

	public static float Mult(this float f, float mult = 100f)
	{
		return f * mult;
	}

	public static Color ToRGB255(this Color c, string title, string body)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: 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_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		return new Color(c.r / 255f, c.g / 255f, c.b / 255f);
	}

	public static void SetStrings(this TooltipProvider t, string title, string body)
	{
		t.overrideTitleText = title;
		t.overrideBodyText = body;
	}
}
internal class Utils
{
	public static bool HasDamageType(DamageInfo damageInfo, DamageType damageType)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Invalid comparison between Unknown and I4
		return (damageInfo.damageType & damageType) > 0;
	}

	public static Vector3 FindNearestNodePosition(Vector3 targetPosition, GraphType nodeGraphType)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: 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_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected O, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Expected O, but got Unknown
		//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_0084: 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_0089: Unknown result type (might be due to invalid IL or missing references)
		SpawnCard val = ScriptableObject.CreateInstance<SpawnCard>();
		val.hullSize = (HullClassification)1;
		val.nodeGraphType = nodeGraphType;
		val.prefab = Prefabs.Load<GameObject>("RoR2/Base/Common/DirectorSpawnProbeHelperPrefab.prefab");
		Vector3 result = targetPosition;
		GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule
		{
			placementMode = (PlacementMode)3,
			position = targetPosition
		}, RoR2Application.rng));
		if (Object.op_Implicit((Object)(object)val2))
		{
			result = val2.transform.position;
		}
		if (Object.op_Implicit((Object)(object)val2))
		{
			Object.Destroy((Object)(object)val2);
		}
		Object.Destroy((Object)(object)val);
		return result;
	}

	public static SkillDef NewSkillDef<T>(Type activationState, string activationStateMachineName, int baseMaxStock, float baseRechargeInterval, bool beginSkillCooldownOnSkillEnd, bool canceledFromSprinting, bool fullRestockOnAssign, InterruptPriority interruptPriority, bool isCombatSkill, bool mustKeyPress, bool cancelSprintingOnActivation, int rechargeStock, int requiredStock, int stockToConsume, Sprite icon, string skillDescriptionToken, string skillName, params string[] keywordTokens) where T : SkillDef
	{
		//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_0069: 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)
		T val = ScriptableObject.CreateInstance<T>();
		((SkillDef)val).activationState = new SerializableEntityStateType(activationState);
		((SkillDef)val).activationStateMachineName = activationStateMachineName;
		((SkillDef)val).baseMaxStock = baseMaxStock;
		((SkillDef)val).baseRechargeInterval = baseRechargeInterval;
		((SkillDef)val).beginSkillCooldownOnSkillEnd = beginSkillCooldownOnSkillEnd;
		((SkillDef)val).canceledFromSprinting = canceledFromSprinting;
		((SkillDef)val).fullRestockOnAssign = fullRestockOnAssign;
		((SkillDef)val).interruptPriority = interruptPriority;
		((SkillDef)val).isCombatSkill = isCombatSkill;
		((SkillDef)val).mustKeyPress = mustKeyPress;
		((SkillDef)val).cancelSprintingOnActivation = cancelSprintingOnActivation;
		((SkillDef)val).rechargeStock = rechargeStock;
		((SkillDef)val).requiredStock = requiredStock;
		((SkillDef)val).stockToConsume = stockToConsume;
		((SkillDef)val).icon = icon;
		((SkillDef)val).skillDescriptionToken = skillDescriptionToken;
		((SkillDef)val).skillName = skillName;
		((SkillDef)val).skillNameToken = ((SkillDef)val).skillName;
		((SkillDef)val).keywordTokens = keywordTokens;
		ContentAddition.AddSkillDef((SkillDef)(object)val);
		return (SkillDef)(object)val;
	}

	public static Color HexTo10(string hexColor)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: 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)
		char[] array = hexColor.ToCharArray();
		return new Color((float)(array[0] + array[1]), (float)(array[2] + array[3]), (float)(array[4] + array[5]), 255f) / 255f;
	}

	public static EntityStateMachine NewStateMachine<T>(GameObject obj, string customName) where T : EntityState
	{
		//IL_0021: 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_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		SerializableEntityStateType val = default(SerializableEntityStateType);
		((SerializableEntityStateType)(ref val))..ctor(typeof(T));
		EntityStateMachine val2 = obj.AddComponent<EntityStateMachine>();
		val2.customName = customName;
		val2.initialStateType = val;
		val2.mainStateType = val;
		return val2;
	}

	public static GenericSkill NewGenericSkill(GameObject obj, SkillDef skill)
	{
		//IL_0031: 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)
		GenericSkill val = obj.AddComponent<GenericSkill>();
		SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
		val2.variants = (Variant[])(object)new Variant[1];
		val._skillFamily = val2;
		SkillFamily skillFamily = val.skillFamily;
		Variant[] variants = skillFamily.variants;
		Variant val3 = new Variant
		{
			skillDef = skill
		};
		((Variant)(ref val3)).viewableNode = new Node(skill.skillNameToken, false, (Node)null);
		variants[0] = val3;
		ContentAddition.AddSkillFamily(skillFamily);
		return val;
	}

	public static void AddAlt(SkillFamily skillFamily, SkillDef SkillDef)
	{
		//IL_0029: 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_004b: Expected O, but got Unknown
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		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
		};
		((Variant)(ref val)).viewableNode = new Node(SkillDef.skillNameToken, false, (Node)null);
		variants[num] = val;
	}

	public static BuffDef NewBuffDef(string name, bool stack, bool hidden, Sprite sprite, Color color)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
		((Object)val).name = name;
		val.canStack = stack;
		val.isHidden = hidden;
		val.iconSprite = sprite;
		val.buffColor = color;
		ContentAddition.AddBuffDef(val);
		return val;
	}

	public static ObjectScaleCurve AddScaleComponent(GameObject target, float timeMax)
	{
		ObjectScaleCurve val = target.AddComponent<ObjectScaleCurve>();
		val.useOverallCurveOnly = true;
		val.timeMax = timeMax;
		val.overallCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
		return val;
	}

	public static RotateAroundAxis AddRotationComponent(GameObject target, float speed, RotationAxis axis)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		RotateAroundAxis val = target.AddComponent<RotateAroundAxis>();
		val.speed = (Speed)2;
		val.fastRotationSpeed = speed;
		val.rotateAroundAxis = axis;
		return val;
	}

	public static GameObject NewDisplayModel(GameObject model, string name)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		GameObject val = PrefabAPI.InstantiateClone(model, name, false);
		CharacterModel componentInChildren = val.GetComponentInChildren<CharacterModel>();
		((Behaviour)componentInChildren).enabled = false;
		((Component)componentInChildren).gameObject.AddComponent<DisplayBehaviour>();
		SkinnedMeshRenderer[] componentsInChildren = val.GetComponentsInChildren<SkinnedMeshRenderer>(true);
		foreach (SkinnedMeshRenderer val2 in componentsInChildren)
		{
			((Renderer)val2).material = new Material(((Renderer)val2).material);
			((Renderer)val2).material.DisableKeyword("DITHER");
		}
		return val;
	}

	public static AnimateShaderAlpha AddShaderAlphaComponent(GameObject target, float timeMax, AnimationCurve curve, bool destroyOnEnd = true, bool disableOnEnd = false)
	{
		AnimateShaderAlpha val = target.AddComponent<AnimateShaderAlpha>();
		val.timeMax = timeMax;
		val.alphaCurve = curve;
		val.destroyOnEnd = destroyOnEnd;
		val.disableOnEnd = disableOnEnd;
		return val;
	}

	internal static Sprite CreateSprite(Texture2D tex)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f), 128f);
	}

	internal static SkinDefInfo CreateNewSkinDefInfo(SkinnedMeshRenderer[] childList, GameObject rootObject, string skinName, string objectToEnable, RendererInfo[] rendererInfos, UnlockableDef unlockableDef = null)
	{
		//IL_0003: 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_006c: 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_0071: 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_00db: 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)
		SkinDefInfo result = default(SkinDefInfo);
		result.BaseSkins = Array.Empty<SkinDef>();
		result.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0];
		result.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0];
		List<GameObjectActivation> list = new List<GameObjectActivation>();
		foreach (SkinnedMeshRenderer val in childList)
		{
			GameObjectActivation val2 = default(GameObjectActivation);
			val2.gameObject = ((Component)val).gameObject;
			val2.shouldActivate = ((Object)val).name == objectToEnable;
			GameObjectActivation item = val2;
			list.Add(item);
		}
		result.GameObjectActivations = list.ToArray();
		result.Icon = Assets.MainAssetBundle.LoadAsset<Sprite>(objectToEnable);
		result.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0];
		result.Name = skinName;
		result.NameToken = skinName;
		result.RendererInfos = rendererInfos;
		result.RootObject = rootObject;
		result.UnlockableDef = unlockableDef;
		return result;
	}

	internal static T CopyComponent<T>(T original, GameObject destination) where T : Component
	{
		Type type = ((object)original).GetType();
		Component val = destination.AddComponent(type);
		FieldInfo[] fields = type.GetFields();
		FieldInfo[] array = fields;
		foreach (FieldInfo fieldInfo in array)
		{
			fieldInfo.SetValue(val, fieldInfo.GetValue(original));
		}
		return (T)(object)((val is T) ? val : null);
	}

	public static Sprite CreateSpriteFromTexture(Texture2D texture)
	{
		//IL_0025: 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)
		if (Object.op_Implicit((Object)(object)texture))
		{
			return Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f));
		}
		return null;
	}

	public static GameObject FindInActiveObjectByName(string name)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Invalid comparison between Unknown and I4
		Transform[] array = Resources.FindObjectsOfTypeAll<Transform>();
		for (int i = 0; i < array.Length; i++)
		{
			if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
			{
				return ((Component)array[i]).gameObject;
			}
		}
		return null;
	}

	public static void CreateHitboxes(string name, Transform parent, Vector3[] sizes, Vector3[] positions)
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//IL_004f: 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_0073: Unknown result type (might be due to invalid IL or missing references)
		HitBoxGroup val = ((Component)parent).gameObject.AddComponent<HitBoxGroup>();
		val.groupName = name;
		List<HitBox> list = new List<HitBox>();
		for (int i = 0; i < sizes.Length; i++)
		{
			GameObject val2 = new GameObject(name + (i + 1));
			val2.transform.SetParent(parent);
			val2.transform.localPosition = positions[i];
			val2.transform.localRotation = Quaternion.identity;
			val2.transform.localScale = sizes[i];
			HitBox item = val2.AddComponent<HitBox>();
			val2.layer = LayerIndex.projectile.intVal;
			list.Add(item);
		}
		val.hitBoxes = list.ToArray();
	}

	public static GameObject CreateHitbox(string name, Transform parent, Vector3 scale, Vector3 localPosition)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(name);
		val.transform.SetParent(parent);
		val.transform.localPosition = localPosition;
		val.transform.localRotation = Quaternion.identity;
		val.transform.localScale = scale;
		HitBoxGroup val2 = ((Component)parent).gameObject.AddComponent<HitBoxGroup>();
		HitBox val3 = val.AddComponent<HitBox>();
		val.layer = LayerIndex.projectile.intVal;
		val2.hitBoxes = (HitBox[])(object)new HitBox[1] { val3 };
		val2.groupName = name;
		return val;
	}

	internal static EffectComponent RegisterEffect(GameObject effect, float duration, string soundName = "", bool applyScale = false, bool parentToReferencedTransform = true, bool positionAtReferencedTransform = true)
	{
		//IL_00a6: 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)
		EffectComponent val = effect.GetComponent<EffectComponent>();
		if (!Object.op_Implicit((Object)(object)val))
		{
			val = effect.AddComponent<EffectComponent>();
		}
		if (duration != -1f)
		{
			DestroyOnTimer component = effect.GetComponent<DestroyOnTimer>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				effect.AddComponent<DestroyOnTimer>().duration = duration;
			}
			else
			{
				component.duration = duration;
			}
		}
		if (!Object.op_Implicit((Object)(object)effect.GetComponent<NetworkIdentity>()))
		{
			effect.AddComponent<NetworkIdentity>();
		}
		if (!Object.op_Implicit((Object)(object)effect.GetComponent<VFXAttributes>()))
		{
			effect.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
		}
		val.applyScale = applyScale;
		val.effectIndex = (EffectIndex)(-1);
		val.parentToReferencedTransform = parentToReferencedTransform;
		val.positionAtReferencedTransform = positionAtReferencedTransform;
		val.soundName = soundName;
		ContentAddition.AddEffect(effect);
		return val;
	}

	public static Material InstantiateMaterial(Texture tex)
	{
		//IL_0022: 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)
		Material val = Object.Instantiate<Material>(Prefabs.Load<Material>("RoR2/Base/Commando/matCommandoDualies.mat"));
		if (Object.op_Implicit((Object)(object)val))
		{
			val.SetColor("_Color", Color.white);
			val.SetTexture("_MainTex", tex);
			val.SetColor("_EmColor", Color.black);
			val.SetFloat("_EmPower", 0f);
			val.SetTexture("_EmTex", (Texture)null);
			val.SetFloat("_NormalStrength", 1f);
			val.SetTexture("_NormalTex", (Texture)null);
			return val;
		}
		return val;
	}

	public static Material InstantiateMaterial(Color color, Texture tex, Color emColor, float emPower, Texture emTex, float normStr, Texture normTex)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		Material val = Object.Instantiate<Material>(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial);
		if (Object.op_Implicit((Object)(object)val))
		{
			val.SetColor("_Color", color);
			val.SetTexture("_MainTex", tex);
			val.SetColor("_EmColor", emColor);
			val.SetFloat("_EmPower", emPower);
			val.SetTexture("_EmTex", emTex);
			val.SetFloat("_NormalStrength", 1f);
			val.SetTexture("_NormalTex", normTex);
			return val;
		}
		return val;
	}

	public static Material FindMaterial(string name)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Invalid comparison between Unknown and I4
		Material[] array = Resources.FindObjectsOfTypeAll<Material>();
		for (int i = 0; i < array.Length; i++)
		{
			if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
			{
				return array[i];
			}
		}
		return null;
	}
}