Decompiled source of MulTAlternateM2s v1.0.0

BepInEx/plugins/MultAltM2/ExamplePlugin.dll

Decompiled 21 hours ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using EntityStates;
using EntityStates.JellyfishMonster;
using EntityStates.Loader;
using Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using RoR2.Skills;
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("ExamplePlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExamplePlugin")]
[assembly: AssemblyTitle("ExamplePlugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ExamplePlugin
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

		private static string Format(object data, string file, int line)
		{
			string fileName = Path.GetFileName(file);
			return $"[{fileName}:{line}] {data}";
		}

		internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogDebug((object)Format(data, file, line));
		}

		internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogError((object)Format(data, file, line));
		}

		internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogFatal((object)Format(data, file, line));
		}

		internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogInfo((object)Format(data, file, line));
		}

		internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogMessage((object)Format(data, file, line));
		}

		internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogWarning((object)Format(data, file, line));
		}
	}
}
namespace CustomSkillsTutorial.MyEntityStates
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.MyName.IHerebyGrantPermissionToDeprecateMyModFromThunderstoreBecauseIHaveNotChangedTheName", "IHerebyGrantPermissionToDeprecateMyModFromThunderstoreBecauseIHaveNotChangedTheName", "1.0.0")]
	public class CustomSkillTutorial : BaseUnityPlugin
	{
		public static SkillDef repairSkillDef;

		public static BuffDef repairArmourBuff;

		public void Awake()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: 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_01d1: Expected O, but got Unknown
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Expected O, but got Unknown
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStats);
			repairArmourBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)repairArmourBuff).name = "RepairArmour";
			repairArmourBuff.buffColor = Color.green;
			repairArmourBuff.canStack = false;
			repairArmourBuff.isDebuff = false;
			repairArmourBuff.isHidden = false;
			ContentAddition.AddBuffDef(repairArmourBuff);
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Toolbot/ToolbotBody.prefab").WaitForCompletion();
			LanguageAPI.Add("TOOLBOT_SECONDARY_FIRE_NAME", "Overheat");
			LanguageAPI.Add("TOOLBOT_SECONDARY_FIRE_DESCRIPTION", "<style=cKeywordName>Ignite.<style> Overheat, exploding after a delay for <style=cIsDamage>1000% damage</style> in a large area around you.");
			SkillDef val2 = ScriptableObject.CreateInstance<SkillDef>();
			val2.activationState = new SerializableEntityStateType(typeof(Overheat));
			val2.activationStateMachineName = "Weapon";
			val2.baseMaxStock = 1;
			val2.baseRechargeInterval = 14f;
			val2.beginSkillCooldownOnSkillEnd = true;
			val2.canceledFromSprinting = false;
			val2.cancelSprintingOnActivation = true;
			val2.fullRestockOnAssign = true;
			val2.interruptPriority = (InterruptPriority)0;
			val2.isCombatSkill = true;
			val2.mustKeyPress = false;
			val2.rechargeStock = 1;
			val2.requiredStock = 1;
			val2.stockToConsume = 1;
			val2.skillDescriptionToken = "TOOLBOT_SECONDARY_FIRE_DESCRIPTION";
			val2.skillName = "TOOLBOT_SECONDARY_FIRE_NAME";
			val2.skillNameToken = "TOOLBOT_SECONDARY_FIRE_NAME";
			ContentAddition.AddSkillDef(val2);
			SkillLocator component = val.GetComponent<SkillLocator>();
			SkillFamily skillFamily = component.secondary.skillFamily;
			val2.icon = component.secondary.skillFamily.variants[0].skillDef.icon;
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val3 = new Variant
			{
				skillDef = val2,
				unlockableName = ""
			};
			((Variant)(ref val3)).viewableNode = new Node(val2.skillNameToken, false, (Node)null);
			variants[num] = val3;
			LanguageAPI.Add("TOOLBOT_SECONDARY_REPAIR_NAME", "Field Repair");
			LanguageAPI.Add("TOOLBOT_SECONDARY_REPAIR_DESCRIPTION", "<style=cKeywordName>Agile.<style>Consume a stack every 0.5 seconds (scales with attack speed) to Heal <style=cIsHealing>2% of max hp.</style>  Stacks Recharge over time slowly. Max 50 Stacks at base. While repairing, gain 15 armour.");
			SkillDef val4 = ScriptableObject.CreateInstance<SkillDef>();
			val4.activationState = new SerializableEntityStateType(typeof(Repair));
			val4.activationStateMachineName = "Weapon";
			val4.baseMaxStock = 50;
			val4.baseRechargeInterval = 6f;
			val4.beginSkillCooldownOnSkillEnd = false;
			val4.canceledFromSprinting = false;
			val4.cancelSprintingOnActivation = false;
			val4.fullRestockOnAssign = false;
			val4.interruptPriority = (InterruptPriority)0;
			val4.isCombatSkill = false;
			val4.mustKeyPress = false;
			val4.rechargeStock = 1;
			val4.requiredStock = 1;
			val4.stockToConsume = 1;
			val4.skillDescriptionToken = "TOOLBOT_SECONDARY_REPAIR_DESCRIPTION";
			val4.skillName = "TOOLBOT_SECONDARY_REPAIR_NAME";
			val4.skillNameToken = "TOOLBOT_SECONDARY_REPAIR_NAME";
			ContentAddition.AddSkillDef(val4);
			val4.icon = component.secondary.skillFamily.variants[0].skillDef.icon;
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants2 = skillFamily.variants;
			int num2 = skillFamily.variants.Length - 1;
			val3 = new Variant
			{
				skillDef = val4,
				unlockableName = ""
			};
			((Variant)(ref val3)).viewableNode = new Node(val4.skillNameToken, false, (Node)null);
			variants2[num2] = val3;
		}

		private void RecalculateStats(CharacterBody sender, StatHookEventArgs args)
		{
			if (sender.HasBuff(repairArmourBuff))
			{
				args.armorAdd += 15f;
			}
		}
	}
	public class Overheat : BaseSkillState
	{
		public float baseDuration = 1.5f;

		private float duration;

		private GameObject chargeInstance;

		public override void OnEnter()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_003e: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			EffectData val = new EffectData
			{
				origin = ((EntityState)this).transform.position,
				scale = 20f
			};
			EffectManager.SpawnEffect(JellyNova.chargingEffectPrefab, val, true);
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)chargeInstance))
			{
				Object.Destroy((Object)(object)chargeInstance);
			}
			((EntityState)this).OnExit();
		}

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

		private void DoExplosion()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00ae: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_013f: Expected O, but got Unknown
			BlastAttack val = new BlastAttack
			{
				attacker = ((EntityState)this).gameObject,
				inflictor = ((EntityState)this).gameObject,
				teamIndex = ((BaseState)this).GetTeam(),
				position = ((EntityState)this).transform.position,
				radius = 30f,
				baseForce = 1.5f,
				falloffModel = (FalloffModel)0,
				baseDamage = ((EntityState)this).characterBody.damage * 10f,
				damageType = DamageTypeCombo.op_Implicit((DamageType)128),
				procCoefficient = 1.5f,
				crit = Util.CheckRoll(((EntityState)this).characterBody.crit, ((EntityState)this).characterBody.master)
			};
			InflictDotInfo val2 = new InflictDotInfo
			{
				victimObject = ((EntityState)this).gameObject,
				attackerObject = ((EntityState)this).gameObject,
				totalDamage = ((EntityState)this).characterBody.damage * 2f,
				duration = 10f,
				dotIndex = (DotIndex)1,
				damageMultiplier = 1f
			};
			DotController.InflictDot(ref val2);
			val.Fire();
			EffectData val3 = new EffectData
			{
				origin = ((EntityState)this).transform.position,
				scale = 50f
			};
			EffectManager.SpawnEffect(GroundSlam.blastEffectPrefab, val3, true);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)1;
		}
	}
	public class Repair : BaseSkillState
	{
		public float baseDuration = 0.5f;

		private float duration;

		private GameObject chargeInstance;

		private bool hasFired;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			hasFired = false;
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			((EntityState)this).characterBody.AddBuff(CustomSkillTutorial.repairArmourBuff);
		}

		public override void OnExit()
		{
			((EntityState)this).characterBody.RemoveBuff(CustomSkillTutorial.repairArmourBuff);
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!(((EntityState)this).fixedAge < duration))
			{
				if (!hasFired)
				{
					hasFired = true;
					ConsumeCharge();
				}
				if (((EntityState)this).skillLocator.secondary.stock > 0 && ((EntityState)this).inputBank.skill2.down)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new Repair());
					GenericSkill secondary = ((EntityState)this).skillLocator.secondary;
					secondary.stock -= 1;
				}
				else
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		private void ConsumeCharge()
		{
			//IL_0021: 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)
			float num = ((EntityState)this).characterBody.maxHealth * 0.02f;
			((EntityState)this).characterBody.healthComponent.Heal(num, default(ProcChainMask), true);
		}

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