Decompiled source of TitansPlus v1.0.1

TitansPlus.dll

Decompiled 2 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using EntityStates.BeetleGuardMonster;
using Grumpy;
using On.RoR2.UI.MainMenu;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI.MainMenu;
using TitansPlus.States.Sentinel;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TitansPlus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TitansPlus")]
[assembly: AssemblyTitle("TitansPlus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace TitansPlus
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.rob.TitansPlus", "TitansPlus", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string MODUID = "com.rob.TitansPlus";

		public static SkillDef groundSlam;

		public static SkillDef fireSunder;

		public static SkillFamily primaryFamily;

		public static SkillFamily secondaryFamily;

		private void Awake()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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)
			BaseMainMenuScreen.Awake += new hook_Awake(BaseMainMenuScreen_Awake);
			groundSlam = Object.Instantiate<SkillDef>(Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/BeetleGuard/BeetleGuardBodyGroundSlam.asset").WaitForCompletion());
			groundSlam.activationState = new SerializableEntityStateType(typeof(GroundSlam));
			primaryFamily = ScriptableObject.CreateInstance<SkillFamily>();
			primaryFamily.catalogIndex = 0;
			SkillFamily obj = primaryFamily;
			Variant[] array = new Variant[1];
			Variant val = new Variant
			{
				skillDef = groundSlam,
				unlockableDef = null
			};
			((Variant)(ref val)).viewableNode = null;
			array[0] = val;
			obj.variants = (Variant[])(object)array;
			ContentAddition.AddSkillDef(groundSlam);
			ContentAddition.AddSkillFamily(primaryFamily);
			fireSunder = Object.Instantiate<SkillDef>(Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/BeetleGuard/BeetleGuardBodySunder.asset").WaitForCompletion());
			fireSunder.activationState = new SerializableEntityStateType(typeof(FireSunder));
			secondaryFamily = ScriptableObject.CreateInstance<SkillFamily>();
			secondaryFamily.catalogIndex = 0;
			SkillFamily obj2 = secondaryFamily;
			Variant[] array2 = new Variant[1];
			val = new Variant
			{
				skillDef = fireSunder,
				unlockableDef = null
			};
			((Variant)(ref val)).viewableNode = null;
			array2[0] = val;
			obj2.variants = (Variant[])(object)array2;
			ContentAddition.AddSkillDef(fireSunder);
			ContentAddition.AddSkillFamily(secondaryFamily);
			bool flag = default(bool);
			ContentAddition.AddEntityState<GroundSlam>(ref flag);
			bool flag2 = default(bool);
			ContentAddition.AddEntityState<FireSunder>(ref flag2);
		}

		private static void BaseMainMenuScreen_Awake(orig_Awake orig, BaseMainMenuScreen self)
		{
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Expected O, but got Unknown
			//IL_007b: 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)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: 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_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)self))
			{
				GameObject val = BodyCatalog.FindBodyPrefab("BlueBody");
				if (Object.op_Implicit((Object)(object)val))
				{
					CharacterBody component = val.GetComponent<CharacterBody>();
					component.baseMaxHealth = 480f;
					component.levelMaxHealth = 144f;
					component.baseMoveSpeed = 6f;
					component.baseDamage = 12f;
					component.levelDamage = 2.4f;
					component.baseArmor = 0f;
					component.hullClassification = (HullClassification)1;
					SetStateOnHurt component2 = val.GetComponent<SetStateOnHurt>();
					component2.hitThreshold = 0.3f;
					component2.hurtState = new SerializableEntityStateType(typeof(HurtState));
					Object.DestroyImmediate((Object)(object)val.GetComponent<FootstepHandler>());
					val.GetComponentInChildren<FootstepHandler>().baseFootstepString = "Play_golem_step";
					val.GetComponentInChildren<FootstepHandler>().footstepDustPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/GenericLargeFootstepDust.prefab").WaitForCompletion();
					Material val2 = Object.Instantiate<Material>(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Titan/matTitan.mat").WaitForCompletion());
					val2.SetColor("_EmColor", Color.red);
					val2.SetFloat("_EmPower", 3f);
					val2.SetTexture("_EmTex", Addressables.LoadAssetAsync<Texture>((object)"RoR2/Base/PersonalShield/texShieldGeneratorEmission.png").WaitForCompletion());
					val.GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial = val2;
					GenericSkill[] components = val.GetComponents<GenericSkill>();
					foreach (GenericSkill val3 in components)
					{
						Object.Destroy((Object)(object)val3);
					}
					GenericSkill val4 = val.AddComponent<GenericSkill>();
					val4._skillFamily = primaryFamily;
					val4.skillName = "GroundSlam";
					val4.hideInCharacterSelect = false;
					val.GetComponent<SkillLocator>().primary = val4;
					val4 = val.AddComponent<GenericSkill>();
					val4._skillFamily = secondaryFamily;
					val4.skillName = "FireSunder";
					val4.hideInCharacterSelect = false;
					val.GetComponent<SkillLocator>().secondary = val4;
				}
				GameObject val5 = MasterCatalog.FindMasterPrefab("BlueMaster");
				if (Object.op_Implicit((Object)(object)val5))
				{
					AISkillDriver[] componentsInChildren = val5.GetComponentsInChildren<AISkillDriver>();
					foreach (AISkillDriver val6 in componentsInChildren)
					{
						Object.DestroyImmediate((Object)(object)val6);
					}
					val5.GetComponent<BaseAI>().fullVision = true;
					GameObject val7 = MasterCatalog.FindMasterPrefab("BeetleGuardMaster");
					AISkillDriver[] componentsInChildren2 = val7.GetComponentsInChildren<AISkillDriver>();
					foreach (AISkillDriver val8 in componentsInChildren2)
					{
						AISkillDriver val9 = val5.AddComponent<AISkillDriver>();
						val9.customName = val8.customName;
						val9.skillSlot = val8.skillSlot;
						val9.requireSkillReady = val8.requireSkillReady;
						val9.maxDistance = val8.maxDistance;
						val9.minDistance = val8.minDistance;
						val9.selectionRequiresTargetLoS = val8.selectionRequiresTargetLoS;
						val9.selectionRequiresOnGround = val8.selectionRequiresOnGround;
						val9.selectionRequiresTargetNonFlier = val8.selectionRequiresTargetNonFlier;
						val9.selectionRequiresAimTarget = val8.selectionRequiresAimTarget;
						val9.maxTimesSelected = val8.maxTimesSelected;
						val9.moveTargetType = val8.moveTargetType;
						val9.activationRequiresTargetLoS = val8.activationRequiresTargetLoS;
						val9.activationRequiresAimTargetLoS = val8.activationRequiresAimTargetLoS;
						val9.activationRequiresAimConfirmation = val8.activationRequiresAimConfirmation;
						val9.movementType = val8.movementType;
						val9.moveInputScale = val8.moveInputScale;
						val9.aimVectorDampTimeOverride = val8.aimVectorDampTimeOverride;
						val9.aimVectorMaxSpeedOverride = val8.aimVectorMaxSpeedOverride;
						val9.aimType = val8.aimType;
						val9.ignoreNodeGraph = val8.ignoreNodeGraph;
						val9.buttonPressType = val8.buttonPressType;
						val9.driverUpdateTimerOverride = 0f - val8.driverUpdateTimerOverride;
					}
				}
			}
			orig.Invoke(self);
			BaseMainMenuScreen.Awake -= new hook_Awake(BaseMainMenuScreen_Awake);
		}
	}
}
namespace TitansPlus.States.Sentinel
{
	public class FireSunder : BaseSkillState
	{
		public static float baseDuration = 1.5f;

		public static float damageCoefficient = 4f;

		public static float forceMagnitude = 16f;

		private Animator modelAnimator;

		private Transform modelTransform;

		private bool hasAttacked;

		private float duration;

		private GameObject rightHandChargeEffect;

		private ChildLocator modelChildLocator;

		private Transform handRTransform;

		private EffectManagerHelper _emh_rightHandChargeEffect;

		public override void Reset()
		{
			((BaseState)this).Reset();
			modelAnimator = null;
			modelTransform = null;
			hasAttacked = false;
			duration = 0f;
			rightHandChargeEffect = null;
			modelChildLocator = null;
			handRTransform = null;
			_emh_rightHandChargeEffect = null;
		}

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			modelAnimator = ((EntityState)this).GetModelAnimator();
			modelTransform = ((EntityState)this).GetModelTransform();
			Util.PlaySound("BlueSwing", ((EntityState)this).gameObject);
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			((EntityState)this).PlayCrossfade("Body", "Attack1", "Slash.playbackRate", duration, 0.2f);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.SetAimTimer(duration + 2f);
			}
			if (!Object.op_Implicit((Object)(object)modelTransform))
			{
				return;
			}
			AimAnimator component = ((Component)modelTransform).GetComponent<AimAnimator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				((Behaviour)component).enabled = true;
			}
			modelChildLocator = ((Component)modelTransform).GetComponent<ChildLocator>();
			if (!Object.op_Implicit((Object)(object)modelChildLocator))
			{
				return;
			}
			GameObject chargeEffectPrefab = FireSunder.chargeEffectPrefab;
			handRTransform = modelChildLocator.FindChild("HandR");
			if (Object.op_Implicit((Object)(object)handRTransform))
			{
				if (!EffectManager.ShouldUsePooledEffect(chargeEffectPrefab))
				{
					rightHandChargeEffect = Object.Instantiate<GameObject>(chargeEffectPrefab, handRTransform);
					return;
				}
				_emh_rightHandChargeEffect = EffectManager.GetAndActivatePooledEffect(chargeEffectPrefab, handRTransform, true);
				rightHandChargeEffect = ((Component)_emh_rightHandChargeEffect).gameObject;
			}
		}

		public override void OnExit()
		{
			DestroyRightHandCharge();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				AimAnimator component = ((Component)modelTransform).GetComponent<AimAnimator>();
				if (Object.op_Implicit((Object)(object)component))
				{
					((Behaviour)component).enabled = true;
				}
			}
			((EntityState)this).OnExit();
		}

		public void DestroyRightHandCharge()
		{
			if ((Object)(object)_emh_rightHandChargeEffect != (Object)null && _emh_rightHandChargeEffect.OwningPool != null)
			{
				((GenericPool<EffectManagerHelper>)(object)_emh_rightHandChargeEffect.OwningPool).ReturnObject(_emh_rightHandChargeEffect);
			}
			else
			{
				EntityState.Destroy((Object)(object)rightHandChargeEffect);
			}
			rightHandChargeEffect = null;
			_emh_rightHandChargeEffect = null;
		}

		public override void FixedUpdate()
		{
			//IL_004c: 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_005a: 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_0078: 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)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= 0.4f * duration && !hasAttacked)
			{
				if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)modelTransform))
				{
					Ray aimRay = ((BaseState)this).GetAimRay();
					((Ray)(ref aimRay)).origin = handRTransform.position;
					ProjectileManager.instance.FireProjectileWithoutDamageType(FireSunder.projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, ((BaseState)this).damageStat * damageCoefficient, forceMagnitude, Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f);
				}
				hasAttacked = true;
				DestroyRightHandCharge();
			}
			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)2;
		}
	}
	public class GroundSlam : BaseSkillState
	{
		public float baseDuration = 1.5f;

		public float damageCoefficient = 4f;

		public float forceMagnitude = 400f;

		private bool hasAttacked;

		private float duration;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			((EntityState)this).PlayCrossfade("Body", "Attack3", "Slash.playbackRate", duration, 0.2f);
			Util.PlaySound("BlueSwing", ((EntityState)this).gameObject);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= 0.4f * duration && !hasAttacked)
			{
				hasAttacked = true;
				FireAttack();
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void FireAttack()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//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_0096: 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_00b2: 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_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_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_00da: 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)
			EffectManager.SimpleMuzzleFlash(GroundSlam.slamEffectPrefab, ((EntityState)this).gameObject, "Slam3", false);
			Util.PlaySound("BlueHit", ((EntityState)this).gameObject);
			if (((EntityState)this).isAuthority)
			{
				BlastAttack val = new BlastAttack();
				val.radius = 12f;
				val.procCoefficient = 1f;
				val.position = ((BaseState)this).FindModelChild("Slam3").position;
				val.attacker = ((EntityState)this).gameObject;
				val.crit = ((BaseState)this).RollCrit();
				val.baseDamage = ((BaseState)this).damageStat * damageCoefficient;
				val.falloffModel = (FalloffModel)0;
				val.baseForce = forceMagnitude;
				val.bonusForce = Vector3.up * 500f;
				val.teamIndex = TeamComponent.GetObjectTeam(val.attacker);
				val.damageType = DamageTypeCombo.GenericPrimary;
				val.attackerFiltering = (AttackerFiltering)2;
				val.Fire();
			}
		}

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