Decompiled source of YetAnotherGupFix v1.0.1

YetAnotherGupFix.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Diagnostics;
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.Gup;
using Microsoft.CodeAnalysis;
using On.EntityStates.Gup;
using RoR2;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("YetAnotherGupFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("YetAnotherGupFix")]
[assembly: AssemblyTitle("YetAnotherGupFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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 YetAnotherGupFix
{
	[BepInPlugin("HIFU.YetAnotherGupFix", "YetAnotherGupFix", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "HIFU.YetAnotherGupFix";

		public const string PluginAuthor = "HIFU";

		public const string PluginName = "YetAnotherGupFix";

		public const string PluginVersion = "1.0.0";

		public static ManualLogSource logger;

		public void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_0029: 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_003c: 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_006e: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			logger = ((BaseUnityPlugin)this).Logger;
			GameObject gup = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Gup/GupBody.prefab").WaitForCompletion();
			GameObject gup2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Gup/GeepBody.prefab").WaitForCompletion();
			GameObject gup3 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Gup/GipBody.prefab").WaitForCompletion();
			YourElf(gup);
			YourElf(gup2);
			YourElf(gup3);
			BaseSplitDeath.FixedUpdate += new hook_FixedUpdate(BaseSplitDeath_FixedUpdate);
			BaseSplitDeath.OnEnter += new hook_OnEnter(BaseSplitDeath_OnEnter);
		}

		private void BaseSplitDeath_OnEnter(orig_OnEnter orig, BaseSplitDeath self)
		{
			((MonoBehaviour)((EntityState)self).outer).StartCoroutine(Split(orig, self));
		}

		private void BaseSplitDeath_FixedUpdate(orig_FixedUpdate orig, BaseSplitDeath self)
		{
		}

		public void YourElf(GameObject gup)
		{
			Transform val = gup.transform.Find("ModelBase").GetChild(0).Find("mdlGupArmature/ROOT/mainBody.1/StandableSurfacePosition/StandableSurface");
			SphereCollider val2 = ((Component)val).gameObject.AddComponent<SphereCollider>();
			val2.radius = 1.2f;
			DisableCollisionsBetweenColliders component = ((Component)val).GetComponent<DisableCollisionsBetweenColliders>();
			component.collidersB[0] = (Collider)(object)val2;
			Object.DestroyImmediate((Object)(object)((Component)val).GetComponent<MeshCollider>());
		}

		private IEnumerator Split(orig_OnEnter orig, BaseSplitDeath self)
		{
			orig.Invoke(self);
			yield return (object)new WaitForSeconds(0.5f);
			if (!NetworkServer.active)
			{
				yield break;
			}
			((GenericCharacterDeath)self).DestroyModel();
			EffectManager.SpawnEffect(BaseSplitDeath.deathEffectPrefab, new EffectData
			{
				origin = ((EntityState)self).characterBody.corePosition,
				scale = ((EntityState)self).characterBody.radius
			}, true);
			if ((((EntityState)self).healthComponent.killingDamageType & 0x40010000) == 0)
			{
				for (int i = 0; i < self.spawnCount; i++)
				{
					new BodySplitter
					{
						body = ((EntityState)self).characterBody,
						masterSummon = 
						{
							masterPrefab = ((SpawnCard)self.characterSpawnCard).prefab
						},
						count = 1,
						splinterInitialVelocityLocal = new Vector3(0f, (i % 2 == 0) ? 20f : (-20f), (i % 2 == 0) ? 10f : (-10f)),
						minSpawnCircleRadius = ((EntityState)self).characterBody.radius * BaseSplitDeath.spawnRadiusCoefficient,
						moneyMultiplier = self.moneyMultiplier
					}.Perform();
					yield return (object)new WaitForSeconds(0.5f / (float)self.spawnCount);
				}
			}
			((GenericCharacterDeath)self).DestroyBodyAsapServer();
		}
	}
}