Decompiled source of SolusEnemiesTweaks v1.0.2

SolusEnemiesTweaks.dll

Decompiled 10 hours ago
using System;
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 HG.GeneralSerializer;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
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("SolusEnemiesTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SolusEnemiesTweaks")]
[assembly: AssemblyTitle("SolusEnemiesTweaks")]
[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 SolusEnemiesTweaks
{
	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);
		}
	}
	[BepInPlugin("CrypticAuthor.SolusEnemiesTweaks", "SolusEnemiesTweaks", "1.0.0")]
	public class SolusEnemiesTweaks : BaseUnityPlugin
	{
		public const string PluginGUID = "CrypticAuthor.SolusEnemiesTweaks";

		public const string PluginAuthor = "CrypticAuthor";

		public const string PluginName = "SolusEnemiesTweaks";

		public const string PluginVersion = "1.0.0";

		public GameObject tankerBody = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC3_Tanker.TankerBody_prefab).WaitForCompletion();

		public GameObject workerUnitBody = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC3_WorkerUnit.WorkerUnitBody_prefab).WaitForCompletion();

		public GameObject distributorBody = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC3_MinePod.MinePodBody_prefab).WaitForCompletion();

		public GameObject mineBody = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC3_SolusMine.SolusMineBody_prefab).WaitForCompletion();

		public GameObject extractorBody = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC3_ExtractorUnit.ExtractorUnitBody_prefab).WaitForCompletion();

		public GameObject invalidatorBody = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC3_DefectiveUnit.DefectiveUnitBody_prefab).WaitForCompletion();

		public GameObject transporterBody = Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC3_IronHauler.IronHaulerBody_prefab).WaitForCompletion();

		private SpawnCard tankerCredit = Addressables.LoadAssetAsync<SpawnCard>((object)RoR2_DLC3_Tanker.cscTanker_asset).WaitForCompletion();

		private SpawnCard workerCredit = Addressables.LoadAssetAsync<SpawnCard>((object)RoR2_DLC3_WorkerUnit.cscWorkerUnit_asset).WaitForCompletion();

		private SpawnCard distributorCredit = Addressables.LoadAssetAsync<SpawnCard>((object)RoR2_DLC3_MinePod.cscMinePod_asset).WaitForCompletion();

		public static bool TryModifyFieldValue<T>(EntityStateConfiguration entityStateConfiguration, string fieldName, T value)
		{
			ref SerializedField orCreateField = ref ((SerializedFieldCollection)(ref entityStateConfiguration.serializedFieldsCollection)).GetOrCreateField(fieldName);
			Type typeFromHandle = typeof(T);
			if (Object.op_Implicit(orCreateField.fieldValue.objectValue) && ((object)orCreateField.fieldValue.objectValue).GetType().IsAssignableFrom(typeFromHandle))
			{
				ref Object objectValue = ref orCreateField.fieldValue.objectValue;
				object obj = value;
				objectValue = (Object)((obj is Object) ? obj : null);
				return true;
			}
			if (orCreateField.fieldValue.stringValue != null && StringSerializer.CanSerializeType(typeFromHandle))
			{
				orCreateField.fieldValue.stringValue = StringSerializer.Serialize(typeFromHandle, (object)value);
				return true;
			}
			return false;
		}

		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			EntityStateConfiguration entityStateConfiguration = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)RoR2_DLC3_MinePod.EntityStates_MinePod_Teleport_asset).WaitForCompletion();
			EntityStateConfiguration entityStateConfiguration2 = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)RoR2_DLC3_MinePod.EntityStates_MinePod_Teleport_asset).WaitForCompletion();
			TryModifyFieldValue(entityStateConfiguration, "nodeSearchRadiusMin", 40f);
			TryModifyFieldValue(entityStateConfiguration2, "nodeSearchRadiusMax", 50f);
			tankerCredit.directorCreditCost = 25;
			CharacterBody val = default(CharacterBody);
			if (Object.op_Implicit((Object)(object)tankerBody) && tankerBody.TryGetComponent<CharacterBody>(ref val))
			{
				val.baseMoveSpeed = 8f;
				val.baseArmor = 0f;
				val.baseMaxHealth = 120f;
				val.levelMaxHealth = 38f;
			}
			workerCredit.directorCreditCost = 15;
			CharacterBody val2 = default(CharacterBody);
			if (Object.op_Implicit((Object)(object)workerUnitBody) && workerUnitBody.TryGetComponent<CharacterBody>(ref val2))
			{
				val2.baseMaxHealth = 130f;
				val2.baseMoveSpeed = 10f;
				val2.levelMaxHealth = 40f;
			}
			distributorCredit.directorCreditCost = 25;
			CharacterBody val3 = default(CharacterBody);
			if (Object.op_Implicit((Object)(object)distributorBody) && distributorBody.TryGetComponent<CharacterBody>(ref val3))
			{
				val3.baseMaxHealth = 200f;
				val3.levelMaxHealth = 60f;
			}
			CharacterBody val4 = default(CharacterBody);
			if (Object.op_Implicit((Object)(object)mineBody) && mineBody.TryGetComponent<CharacterBody>(ref val4))
			{
				val4.baseArmor = 0f;
				val4.baseDamage = 10f;
				val4.baseMoveSpeed = 13f;
				val4.levelMaxHealth = 3f;
			}
			CharacterBody val5 = default(CharacterBody);
			if (Object.op_Implicit((Object)(object)extractorBody) && extractorBody.TryGetComponent<CharacterBody>(ref val5))
			{
				val5.baseArmor = 0f;
				val5.baseMaxHealth = 200f;
				val5.levelMaxHealth = 70f;
			}
			CharacterBody val6 = default(CharacterBody);
			if (Object.op_Implicit((Object)(object)invalidatorBody) && invalidatorBody.TryGetComponent<CharacterBody>(ref val6))
			{
				val6.baseMaxHealth = 350f;
				val6.levelMaxHealth = 100f;
			}
			CharacterBody val7 = default(CharacterBody);
			if (Object.op_Implicit((Object)(object)transporterBody) && transporterBody.TryGetComponent<CharacterBody>(ref val7))
			{
				val7.baseMoveSpeed = 8f;
				val7.baseMaxHealth = 700f;
				val7.levelMaxHealth = 200f;
			}
		}
	}
}