Decompiled source of EarlyAccessBulletSponge v1.0.1

EarlyAccessBulletsponge.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.Projectile;
using UnityEngine;

[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("EarlyAccessBulletsponge")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+dcb530b1fe5a7235ebe6282f82db8946ee30b64f")]
[assembly: AssemblyProduct("EarlyAccessBulletsponge")]
[assembly: AssemblyTitle("EarlyAccessBulletsponge")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
}
namespace EarlyAccessBulletsponge
{
	[BepInPlugin("com.Moffein.EarlyAccessBulletsponge", "EarlyAccessBulletsponge", "1.0.1")]
	public class EarlyAccessBulletspongePlugin : BaseUnityPlugin
	{
		public static string blacklistedBodyString = "GupBody, GeepBody, GipBody, GrandparentBody, MegaConstructBody, GreaterWispBody, BellBody, ClayBruiserBody,VoidBarnacleBody, HalcyoniteBody, ScorchlingBody, LunarGolemBody, LunarWispBody, LunarExploderBody, NullifierBody, VoidJailerBody,MoffeinArchWisp, RobYoungVagrantBody, BrotherBody, BrotherHurtBody, FalseSonBossBody, FalseSonBossBodyLunarShard, FalseSonBossBodyBrokenLunarShard,MiniVoidRaidCrabBodyBase, MiniVoidRaidCrabBodyPhase1, MiniVoidRaidCrabBodyPhase2, MiniVoidRaidCrabBodyPhase3, ArraignP1Body, ArraignP2Body, RegigigasBody,EngiTurretBody, EngiWalkerTurretBody, Drone1Body, Drone2Body, BackupDroneBody, EmergencyDroneBody, FlameDroneBody, MegaDroneBody, MissileDroneBody";

		public static float trashTierMultiplier = 1f;

		public static float impTierMultiplier = 1.4285715f;

		public static float golemTierMultiplier = 1.25f;

		public static float championTierMultiplier = 1.5f;

		public void Awake()
		{
			ReadConfig();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(RoR2Application_OnLoad));
		}

		private void ReadConfig()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			blacklistedBodyString = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Body Blacklist", blacklistedBodyString, new ConfigDescription("List of bodies unaffected by this mod, separated by commas. Anything with Drone in the name is auto-blacklisted.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			trashTierMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Trash Tier Multiplier", trashTierMultiplier, new ConfigDescription("HP multiplier for low-health enemies.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			impTierMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Imp Tier Multiplier", impTierMultiplier, new ConfigDescription("HP multiplier for Imp-tier enemies.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			golemTierMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Golem Tier Multiplier", golemTierMultiplier, new ConfigDescription("HP multiplier for Golem-tier enemies.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			championTierMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Champion Tier Multiplier", championTierMultiplier, new ConfigDescription("HP multiplier for Champion-tier enemies.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		private void RoR2Application_OnLoad()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_0061: Invalid comparison between Unknown and I4
			//IL_006d: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Invalid comparison between Unknown and I4
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = (from str in blacklistedBodyString.Split(",")
				select str.Trim()).ToList();
			HashSet<BodyIndex> hashSet = new HashSet<BodyIndex>();
			foreach (string item in list)
			{
				BodyIndex val = BodyCatalog.FindBodyIndex(item);
				if ((int)val != -1)
				{
					hashSet.Add(val);
				}
			}
			List<GameObject> list2 = new List<GameObject>();
			foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
			{
				BodyIndex val2 = BodyCatalog.FindBodyIndex(allSurvivorDef.bodyPrefab);
				if ((int)val2 != -1)
				{
					hashSet.Add(val2);
				}
			}
			foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs)
			{
				if (Object.op_Implicit((Object)(object)allBodyPrefab.GetComponent<ProjectileController>()))
				{
					continue;
				}
				CharacterBody component = allBodyPrefab.GetComponent<CharacterBody>();
				if (!Object.op_Implicit((Object)(object)component) || hashSet.Contains(component.bodyIndex) || ((Enum)component.bodyFlags).HasFlag((Enum)(object)(BodyFlags)4) || ((Object)((Component)component).gameObject).name.Contains("Drone"))
				{
					continue;
				}
				if (component.isChampion)
				{
					if (championTierMultiplier != 1f)
					{
						component.baseMaxHealth = Mathf.RoundToInt(component.baseMaxHealth * championTierMultiplier);
						component.levelMaxHealth = Mathf.RoundToInt(component.levelMaxHealth * championTierMultiplier);
					}
					continue;
				}
				if (component.baseMaxHealth < 140f && trashTierMultiplier != 1f)
				{
					component.baseMaxHealth = Mathf.RoundToInt(component.baseMaxHealth * trashTierMultiplier);
					component.levelMaxHealth = Mathf.RoundToInt(component.levelMaxHealth * trashTierMultiplier);
				}
				if (component.baseMaxHealth >= 140f && component.baseMaxHealth < 480f)
				{
					if (impTierMultiplier != 1f)
					{
						component.baseMaxHealth = Mathf.RoundToInt(component.baseMaxHealth * impTierMultiplier);
						component.levelMaxHealth = Mathf.RoundToInt(component.levelMaxHealth * impTierMultiplier);
					}
				}
				else if (component.baseMaxHealth >= 480f && golemTierMultiplier != 1f)
				{
					component.baseMaxHealth = Mathf.RoundToInt(component.baseMaxHealth * golemTierMultiplier);
					component.levelMaxHealth = Mathf.RoundToInt(component.levelMaxHealth * golemTierMultiplier);
				}
			}
		}
	}
}