Decompiled source of PenisSeeker v1.2.0

PenisSeeker.dll

Decompiled 2 weeks 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 Microsoft.CodeAnalysis;
using R2API;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[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("PenisSeeker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9c046aeb4d7c94e860e2bc1ec091ce842c1e3ba0")]
[assembly: AssemblyProduct("PenisSeeker")]
[assembly: AssemblyTitle("PenisSeeker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 PenisSeeker
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

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

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	public class PENISBLAST : BaseState, IStepSetter
	{
		public enum Gauntlet
		{
			Explode
		}

		[SerializeField]
		public GameObject projectileprefab = plugin.exampleProjectilePrefab;

		[SerializeField]
		public GameObject projectileFinisherPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Seeker/SpiritPunchFinisherProjectile.prefab").WaitForCompletion();

		[SerializeField]
		public GameObject muzzleflashEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Seeker/SpiritPunchMuzzleFlashVFX.prefab").WaitForCompletion();

		[SerializeField]
		public float procCoefficient = 1f;

		[SerializeField]
		public float damageCoefficient = 3f;

		[SerializeField]
		public float dmgBuffIncrease = 0.5f;

		[SerializeField]
		public float comboDamageCoefficient = 1f;

		[SerializeField]
		public float force = 3075f;

		public static float attackSpeedAltAnimationThreshold = 1f;

		[SerializeField]
		public float baseDuration = 1f;

		[SerializeField]
		public float paddingBetweenAttacks = 0.3f;

		[SerializeField]
		public string attackSoundString;

		[SerializeField]
		public string attackSoundStringAlt;

		[SerializeField]
		public float attackSoundPitch;

		[SerializeField]
		public bool enableVelocityOverLifetime;

		public float lifetime;

		public bool oscillate;

		public float bloom;

		private float duration;

		private bool hasFiredGauntlet;

		private string muzzleString;

		private Transform muzzleTransform;

		private Animator animator;

		private ChildLocator childLocator;

		private Gauntlet gauntlet;

		private float extraDmgFromBuff;

		public static float recoilAmplitude;

		private string animationStateName;

		[field: SerializeField]
		public float DamageCoefficient { get; set; }

		public static event Action<bool> onSpiritOrbFired;

		public void SetStep(int i)
		{
			gauntlet = (Gauntlet)i;
		}

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / base.attackSpeedStat;
			((EntityState)this).characterBody.SetAimTimer(2f);
			animator = ((EntityState)this).GetModelAnimator();
			if (Object.op_Implicit((Object)(object)animator))
			{
				childLocator = ((Component)animator).GetComponent<ChildLocator>();
				muzzleString = "MuzzleEnergyBomb";
				animationStateName = "SpiritPunchFinisher";
				extraDmgFromBuff = dmgBuffIncrease * (float)((EntityState)this).characterBody.GetBuffCount(Buffs.ChakraBuff);
			}
			bool @bool = animator.GetBool("isMoving");
			bool bool2 = animator.GetBool("isGrounded");
			if (!@bool && bool2)
			{
				((EntityState)this).PlayCrossfade("FullBody, Override", animationStateName, "FireGauntlet.playbackRate", duration, 0.025f);
				return;
			}
			((EntityState)this).PlayCrossfade("Gesture, Additive", animationStateName, "FireGauntlet.playbackRate", duration, 0.025f);
			((EntityState)this).PlayCrossfade("Gesture, Override", animationStateName, "FireGauntlet.playbackRate", duration, 0.025f);
			int buffCount = ((EntityState)this).characterBody.GetBuffCount(Buffs.ChakraBuff);
			ProjectileSimple component = plugin.exampleProjectilePrefab.GetComponent<ProjectileSimple>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.updateAfterFiring = ((EntityState)this).characterBody.GetBuffCount(Buffs.ChakraBuff) > 3;
				component.desiredForwardSpeed = 15f;
				component.enableVelocityOverLifetime = true;
				component.velocityOverLifetime = AnimationCurve.Linear(1f, 1f, 2f, (float)(buffCount * 15));
				component.oscillateMagnitude = 1000f;
			}
		}

		private void FireGauntlet()
		{
			//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_00be: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			if (!hasFiredGauntlet)
			{
				((EntityState)this).characterBody.AddSpreadBloom(bloom);
				Ray aimRay = ((BaseState)this).GetAimRay();
				TrajectoryAimAssist.ApplyTrajectoryAimAssist(ref aimRay, projectileprefab, ((EntityState)this).gameObject, 1f);
				if (Object.op_Implicit((Object)(object)childLocator))
				{
					muzzleTransform = childLocator.FindChild(muzzleString);
				}
				if (Object.op_Implicit((Object)(object)muzzleflashEffectPrefab))
				{
					EffectManager.SimpleMuzzleFlash(muzzleflashEffectPrefab, ((EntityState)this).gameObject, muzzleString, false);
				}
				if (((EntityState)this).isAuthority)
				{
					float damage = base.damageStat * (DamageCoefficient + extraDmgFromBuff);
					FireProjectileInfo val = default(FireProjectileInfo);
					val.projectilePrefab = plugin.exampleProjectilePrefab;
					val.position = muzzleTransform.position;
					val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
					val.owner = ((EntityState)this).gameObject;
					val.damage = damage;
					val.force = force;
					val.crit = Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master);
					val.damageColorIndex = (DamageColorIndex)0;
					((FireProjectileInfo)(ref val)).speedOverride = 70f + base.attackSpeedStat * 2f;
					val.damageTypeOverride = DamageTypeCombo.GenericPrimary;
					FireProjectileInfo val2 = val;
					ProjectileManager.instance.FireProjectile(val2);
				}
				((BaseState)this).AddRecoil(0.2f * recoilAmplitude, 0.1f * recoilAmplitude, -1f * recoilAmplitude, 1f * recoilAmplitude);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration - duration * 0.4f || hasFiredGauntlet)
			{
				if (gauntlet == Gauntlet.Explode && !hasFiredGauntlet)
				{
					Util.PlayAttackSpeedSound(attackSoundStringAlt, ((EntityState)this).gameObject, attackSoundPitch);
					projectileprefab = plugin.exampleProjectilePrefab;
					DamageCoefficient = comboDamageCoefficient;
					FireGauntlet();
					PENISBLAST.onSpiritOrbFired?.Invoke(obj: true);
					_ = ((EntityState)this).characterMotor.isGrounded;
					hasFiredGauntlet = true;
				}
				else if (!hasFiredGauntlet)
				{
					Util.PlayAttackSpeedSound(attackSoundString, ((EntityState)this).gameObject, attackSoundPitch);
					FireGauntlet();
					hasFiredGauntlet = true;
					PENISBLAST.onSpiritOrbFired?.Invoke(obj: false);
				}
				if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration + duration * paddingBetweenAttacks)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

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

		public override void OnDeserialize(NetworkReader reader)
		{
			((EntityState)this).OnDeserialize(reader);
			gauntlet = (Gauntlet)reader.ReadByte();
		}

		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;
		}
	}
	[BepInPlugin("toastyteamtoastyteamPenisSeeker", "PenisSeeker", "1.0.5")]
	public class plugin : BaseUnityPlugin
	{
		public const string PluginGUID = "toastyteamtoastyteamPenisSeeker";

		public const string PluginAuthor = "toastyteam";

		public const string PluginName = "PenisSeeker";

		public const string PluginVersion = "1.0.5";

		public static GameObject exampleProjectilePrefab;

		public void Awake()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Expected O, but got Unknown
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			Log.Init(((BaseUnityPlugin)this).Logger);
			Log.Debug("PENIS BLAST!!");
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "penisblast"));
			GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Seeker/SeekerBody.prefab").WaitForCompletion();
			SkillDef val3 = ScriptableObject.CreateInstance<SkillDef>();
			val3.activationState = new SerializableEntityStateType(typeof(PENISBLAST));
			val3.activationStateMachineName = "Weapon";
			val3.baseMaxStock = 3;
			val3.baseRechargeInterval = 3f;
			val3.beginSkillCooldownOnSkillEnd = true;
			val3.canceledFromSprinting = false;
			val3.cancelSprintingOnActivation = true;
			val3.fullRestockOnAssign = true;
			val3.interruptPriority = (InterruptPriority)0;
			val3.isCombatSkill = true;
			val3.mustKeyPress = false;
			val3.rechargeStock = 3;
			val3.requiredStock = 1;
			val3.stockToConsume = 1;
			val3.icon = val.LoadAsset<Sprite>("appendageblast");
			val3.skillDescriptionToken = "PENISEEEKER_SEEKER_PRIMARY_ALT_DESC";
			val3.skillNameToken = "PENIS_BLAST_NAME";
			ContentAddition.AddSkillDef(val3);
			bool flag = default(bool);
			ContentAddition.AddEntityState(typeof(PENISBLAST), ref flag);
			SkillLocator component = val2.GetComponent<SkillLocator>();
			SkillFamily skillFamily = component.primary.skillFamily;
			exampleProjectilePrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Seeker/SpiritPunchFinisherProjectile.prefab").WaitForCompletion(), "ExampleProjectile");
			ProjectileTargetComponent targetComponent = exampleProjectilePrefab.AddComponent<ProjectileTargetComponent>();
			ProjectileDirectionalTargetFinder val4 = exampleProjectilePrefab.AddComponent<ProjectileDirectionalTargetFinder>();
			val4.lookRange = 35f;
			val4.lookCone = 15f;
			val4.targetSearchInterval = 0.1f;
			val4.onlySearchIfNoTarget = true;
			val4.allowTargetLoss = true;
			val4.testLoS = true;
			val4.ignoreAir = false;
			val4.flierAltitudeTolerance = float.PositiveInfinity;
			val4.targetComponent = targetComponent;
			ProjectileSteerTowardTarget val5 = exampleProjectilePrefab.AddComponent<ProjectileSteerTowardTarget>();
			val5.targetComponent = targetComponent;
			val5.rotationSpeed = 135f;
			val5.yAxisOnly = false;
			PrefabAPI.RegisterNetworkPrefab(exampleProjectilePrefab);
			ContentAddition.AddProjectile(exampleProjectilePrefab);
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val6 = new Variant
			{
				skillDef = val3,
				unlockableName = ""
			};
			((Variant)(ref val6)).viewableNode = new Node(val3.skillNameToken, false, (Node)null);
			variants[num] = val6;
		}
	}
}