Decompiled source of PenisSeeker v1.3.0

PenisSeeker.dll

Decompiled 3 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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using Microsoft.CodeAnalysis;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPathsBetter;
using SkillsPlusPlus;
using SkillsPlusPlus.Modifiers;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PenisSeeker")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b852c602ab46800e0ee0e360493f34df8a45b286")]
[assembly: AssemblyProduct("PenisSeeker")]
[assembly: AssemblyTitle("PenisSeeker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
[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);
		}
	}
	internal static class SPPSupport
	{
		internal static void init()
		{
			SkillModifierManager.LoadSkillModifiers();
		}
	}
	public class PENISBLAST : BaseState, IStepSetter
	{
		private enum Gauntlet
		{
			Explode
		}

		public GameObject projectileprefab = PenisSeekerPlugin.seekerProjectilePrefab;

		private GameObject muzzleflashEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC2_Seeker.SpiritPunchMuzzleFlashVFX_prefab).WaitForCompletion();

		private Transform muzzleTransform;

		private Animator animator;

		private ChildLocator childLocator;

		private Gauntlet gauntlet;

		private float dmgBuffIncrease = 0.5f;

		public float comboDamageCoefficient = 1f;

		private float baseDuration = 1f;

		private float paddingBetweenAttacks = 0.3f;

		private string attackSoundString = "Play_seeker_skill1_fire";

		private string attackSoundStringAlt = "Play_seeker_skill1_fire_orb";

		private float attackSoundPitch;

		private float bloom;

		private float recoilAmplitude;

		private float duration;

		private bool hasFiredGauntlet;

		private string muzzleString;

		private float extraDmgFromBuff;

		private string animationStateName;

		public float force = 3075f;

		private float DamageCoefficient { get; set; }

		private 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);
			}
			if (!animator.GetBool("isMoving") && animator.GetBool("isGrounded"))
			{
				((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);
		}

		private void FireGauntlet()
		{
			//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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: 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)
			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 = PenisSeekerPlugin.seekerProjectilePrefab;
					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 = PenisSeekerPlugin.seekerProjectilePrefab;
					DamageCoefficient = comboDamageCoefficient;
					FireGauntlet();
					PENISBLAST.onSpiritOrbFired?.Invoke(obj: true);
					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()
		{
			return (InterruptPriority)1;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("toastyteamtoastyteamPenisSeeker", "PenisSeeker", "1.2.2")]
	public class PenisSeekerPlugin : BaseUnityPlugin
	{
		private const string PluginGUID = "toastyteamtoastyteamPenisSeeker";

		private const string PluginAuthor = "toastyteam";

		private const string PluginName = "PenisSeeker";

		private const string PluginVersion = "1.2.2";

		public static GameObject seekerProjectilePrefab;

		public static bool SPPInstalled => Chainloader.PluginInfos.ContainsKey("com.cwmlolzlz.skills");

		public static bool UHRInstalled => Chainloader.PluginInfos.ContainsKey("iDeathHD.UnityHotReload");

		public void Awake()
		{
			//IL_003a: 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_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_009e: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Expected O, but got Unknown
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: 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 obj = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC2_Seeker.SeekerBody_prefab).WaitForCompletion();
			SkillDef val2 = ScriptableObject.CreateInstance<SkillDef>();
			val2.activationState = new SerializableEntityStateType(typeof(PENISBLAST));
			val2.activationStateMachineName = "Weapon";
			val2.baseMaxStock = 3;
			val2.baseRechargeInterval = 3f;
			val2.beginSkillCooldownOnSkillEnd = true;
			val2.canceledFromSprinting = false;
			val2.cancelSprintingOnActivation = true;
			val2.fullRestockOnAssign = true;
			val2.interruptPriority = (InterruptPriority)0;
			val2.isCombatSkill = true;
			val2.mustKeyPress = false;
			val2.rechargeStock = 3;
			val2.requiredStock = 1;
			val2.stockToConsume = 1;
			((Object)val2).name = "PENISBLAST";
			val2.icon = val.LoadAsset<Sprite>("appendageblast");
			val2.skillDescriptionToken = "PENISEEEKER_SEEKER_PRIMARY_ALT_DESC";
			val2.skillNameToken = "PENIS_BLAST_NAME";
			ContentAddition.AddSkillDef(val2);
			bool flag = default(bool);
			ContentAddition.AddEntityState(typeof(PENISBLAST), ref flag);
			SkillFamily skillFamily = obj.GetComponent<SkillLocator>().primary.skillFamily;
			seekerProjectilePrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC2_Seeker.SpiritPunchFinisherProjectile_prefab).WaitForCompletion(), "PenisSeekerProjectile");
			ProjectileTargetComponent targetComponent = seekerProjectilePrefab.AddComponent<ProjectileTargetComponent>();
			ProjectileSimple component = seekerProjectilePrefab.GetComponent<ProjectileSimple>();
			component.desiredForwardSpeed = 15f;
			component.enableVelocityOverLifetime = true;
			component.oscillateMagnitude = 1000f;
			ProjectileDirectionalTargetFinder obj2 = seekerProjectilePrefab.AddComponent<ProjectileDirectionalTargetFinder>();
			obj2.lookRange = 35f;
			obj2.lookCone = 15f;
			obj2.targetSearchInterval = 0.1f;
			obj2.onlySearchIfNoTarget = true;
			obj2.allowTargetLoss = true;
			obj2.testLoS = true;
			obj2.ignoreAir = false;
			obj2.flierAltitudeTolerance = float.PositiveInfinity;
			obj2.targetComponent = targetComponent;
			ProjectileSteerTowardTarget obj3 = seekerProjectilePrefab.AddComponent<ProjectileSteerTowardTarget>();
			obj3.targetComponent = targetComponent;
			obj3.rotationSpeed = 135f;
			obj3.yAxisOnly = false;
			seekerProjectilePrefab.AddComponent<PenisSeekerModifier>();
			PrefabAPI.RegisterNetworkPrefab(seekerProjectilePrefab);
			ContentAddition.AddProjectile(seekerProjectilePrefab);
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = variants.Length - 1;
			Variant val3 = new Variant
			{
				skillDef = val2
			};
			((Variant)(ref val3)).viewableNode = new Node(val2.skillNameToken, false, (Node)null);
			variants[num] = val3;
			if (SPPInstalled)
			{
				SPPSupport.init();
			}
			else
			{
				Log.Debug("sigh ,.,,. no skills plus plus ,..,.,,.,.,.,. its okay .,.,.,.,, i get it ,.,.,,.,.,., its fine .,.,.,.,");
			}
		}
	}
	public class PenisSeekerModifier : MonoBehaviour
	{
		public void Start()
		{
			ProjectileController component = ((Component)this).gameObject.GetComponent<ProjectileController>();
			if ((Object)(object)component == (Object)null)
			{
				Log.Debug("Help me twin. Help me.");
				return;
			}
			if ((Object)(object)component.owner == (Object)null || (Object)(object)component.owner.GetComponent<CharacterBody>() == (Object)null)
			{
				Log.Debug("Seekin' mah penits.");
				return;
			}
			ProjectileDirectionalTargetFinder component2 = ((Component)this).gameObject.GetComponent<ProjectileDirectionalTargetFinder>();
			ProjectileSteerTowardTarget component3 = ((Component)this).gameObject.GetComponent<ProjectileSteerTowardTarget>();
			ProjectileSimple component4 = ((Component)this).gameObject.GetComponent<ProjectileSimple>();
			int buffCount = component.owner.GetComponent<CharacterBody>().GetBuffCount(Buffs.ChakraBuff);
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.lookRange = 20 + 3 * buffCount;
				component2.lookCone = 7 + 2 * buffCount;
			}
			if (Object.op_Implicit((Object)(object)component3))
			{
				component3.rotationSpeed = 20f * (float)buffCount;
			}
			if (Object.op_Implicit((Object)(object)component4))
			{
				component4.velocityOverLifetime = AnimationCurve.Linear(1f, 1f, 2f, (float)(buffCount * 15));
			}
		}
	}
	public class PenisSeekerUpgrade
	{
		[SkillLevelModifier("PENISBLAST", new Type[] { typeof(PENISBLAST) })]
		private class PenisBlastModifier : SimpleSkillModifier<PENISBLAST>
		{
			public static ConfigEntry<float> forceScaling;

			public static ConfigEntry<float> radiusScaling;

			public override void OnSkillEnter(PENISBLAST skillState, int level)
			{
				skillState.force = BaseSkillModifier.AdditiveScaling(3075f, 3075f * forceScaling.Value, level);
				ProjectileExplosion val = default(ProjectileExplosion);
				if (skillState.projectileprefab.TryGetComponent<ProjectileExplosion>(ref val))
				{
					Log.Debug(val.blastRadius);
					val.blastRadius = BaseSkillModifier.AdditiveScaling(7f, radiusScaling.Value, level);
				}
				base.OnSkillEnter(skillState, level);
			}

			public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
			{
				base.OnSkillLeveledUp(level, characterBody, skillDef);
			}

			public override void OnSkillExit(PENISBLAST skillState, int level)
			{
				base.OnSkillExit(skillState, level);
			}

			public override void SetupConfig(ConfigFile config)
			{
				//IL_0045: 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_0055: 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_006c: Expected O, but got Unknown
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Expected O, but got Unknown
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Expected O, but got Unknown
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: Expected O, but got Unknown
				((BaseSkillModifier)this).SetupConfig(config);
				forceScaling = config.Bind<float>("Skills++ Config", "force scaling", 0.3f, "how much force in percent to add per level !!");
				radiusScaling = config.Bind<float>("Skills++ Config", "blast radius scaling", 2f, "how much to increase blast radius by each level (skill is 7m and adds 2m by default !!");
				StepSliderConfig val = new StepSliderConfig
				{
					min = 0f,
					max = 2f,
					FormatString = "{0}%"
				};
				ModSettingsManager.AddOption((BaseOption)new StepSliderOption(forceScaling, val));
				StepSliderConfig val2 = new StepSliderConfig
				{
					min = 0f,
					max = 15f,
					FormatString = "{0:0}"
				};
				ModSettingsManager.AddOption((BaseOption)new StepSliderOption(radiusScaling, val2));
			}
		}
	}
}