Decompiled source of MobileTurretBuff v1.1.14

MobileTurretBuff.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using On.RoR2;
using RoR2;
using RoR2.CharacterAI;
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.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MobileTurretBuff")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MobileTurretBuff")]
[assembly: AssemblyTitle("MobileTurretBuff")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MobileTurretBuff
{
	[BepInPlugin("com.Moffein.MobileTurretBuff", "MobileTurretBuff", "1.1.13")]
	public class MobileTurretBuff : BaseUnityPlugin
	{
		public void Awake()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0037: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_0071: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00ab: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00e5: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			//IL_011f: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0159: Expected O, but got Unknown
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Expected O, but got Unknown
			//IL_0193: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Expected O, but got Unknown
			//IL_01cd: Expected O, but got Unknown
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Expected O, but got Unknown
			//IL_0206: Expected O, but got Unknown
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_023b: Expected O, but got Unknown
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Expected O, but got Unknown
			//IL_0270: Expected O, but got Unknown
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Expected O, but got Unknown
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Expected O, but got Unknown
			float baseMoveSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Mobile Turret Settings", "01 - Move Speed"), 7f, new ConfigDescription("How fast Mobile Turrets move.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float baseRegen = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Mobile Turret Settings", "02 - Base Regen"), 1f, new ConfigDescription("Base health regen.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float levelRegen = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Mobile Turret Settings", "03 - Regen per Level"), 0.2f, new ConfigDescription("Health regen gain on levelup.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float baseArmor = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Mobile Turret Settings", "04 - Base Armor"), 0f, new ConfigDescription("Base amount of armor.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float levelArmor = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Mobile Turret Settings", "05 - Armor per Level"), 0f, new ConfigDescription("Armor gain on levelup.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float baseDamage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Mobile Turret Settings", "06 - Base Damage"), 16f, new ConfigDescription("Base amount of damage.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float levelDamage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Mobile Turret Settings", "07 - Damage per Level"), 3.2f, new ConfigDescription("Damage gain on levelup.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float range = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Mobile Turret Settings", "08 - Range"), 45f, new ConfigDescription("How far Mobile Turret lasers can reach.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float value = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Mobile Turret Settings", "09 - Proc Coefficient."), 0.6f, new ConfigDescription("Affects proc chance and strength.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float value2 = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Mobile Turret Settings", "10 - Fire Frequency"), 5f, new ConfigDescription("Number of shots per second.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float value3 = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Mobile Turret Settings", "11 - DPS Coefficient"), 2f, new ConfigDescription("Damage per second. Damage per shot = DPS / FireFrequency.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			BodyCatalog.Init += (hook_Init)delegate(orig_Init orig)
			{
				orig.Invoke();
				GameObject val4 = BodyCatalog.FindBodyPrefab("EngiWalkerTurretBody");
				CharacterBody component = val4.GetComponent<CharacterBody>();
				component.baseArmor = baseArmor;
				component.levelArmor = levelArmor;
				component.baseRegen = baseRegen;
				component.levelRegen = levelRegen;
				component.baseDamage = baseDamage;
				component.levelDamage = levelDamage;
				component.baseMoveSpeed = baseMoveSpeed;
			};
			MasterCatalog.Init += (hook_Init)delegate(orig_Init orig)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Expected O, but got Unknown
				orig.Invoke();
				GameObject val2 = MasterCatalog.FindMasterPrefab("EngiWalkerTurretMaster");
				Component[] components = (Component[])(object)val2.GetComponents<AISkillDriver>();
				Component[] array = components;
				Component[] array2 = array;
				for (int j = 0; j < array2.Length; j++)
				{
					AISkillDriver val3 = (AISkillDriver)array2[j];
					val3.shouldSprint = true;
					if (val3.customName == "ChaseAndFireAtEnemy")
					{
						val3.maxDistance = range;
					}
				}
			};
			EntityStateConfiguration val = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/EntityStates.EngiTurret.EngiTurretWeapon.FireBeam");
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == "maxDistance")
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = range.ToString();
				}
				else if (val.serializedFieldsCollection.serializedFields[i].fieldName == "procCoefficient")
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value.ToString();
				}
				else if (val.serializedFieldsCollection.serializedFields[i].fieldName == "fireFrequency")
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value2.ToString();
				}
				else if (val.serializedFieldsCollection.serializedFields[i].fieldName == "damageCoefficient")
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value3.ToString();
				}
			}
		}
	}
}
namespace R2API.Utils
{
	[AttributeUsage(AttributeTargets.Assembly)]
	public class ManualNetworkRegistrationAttribute : Attribute
	{
	}
}