Decompiled source of RexAdjustments v1.0.2

RexAdjustments.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
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.Configuration;
using BepInEx.Logging;
using EntityStates.Treebot;
using Microsoft.CodeAnalysis;
using On.EntityStates.Treebot;
using R2API;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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("RexAdjustments")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RexAdjustments")]
[assembly: AssemblyTitle("RexAdjustments")]
[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 RexAdjustments
{
	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("Jeffdev.RexAdjustments", "RexAdjustments", "1.0.2")]
	public class RexAdjustments : BaseUnityPlugin
	{
		public const string PluginGUID = "Jeffdev.RexAdjustments";

		public const string PluginAuthor = "Jeffdev";

		public const string PluginName = "RexAdjustments";

		public const string PluginVersion = "1.0.2";

		public static ConfigEntry<float> injectProc;

		public static ConfigEntry<float> drillProc;

		public static ConfigEntry<float> disperseCooldown;

		public static ConfigEntry<float> harvestEndlag;

		public static ConfigEntry<int> harvestDamage;

		private readonly Dictionary<string, string> DefaultLanguage = new Dictionary<string, string>();

		public void Awake()
		{
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			injectProc = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DIRECTIVE - Inject Proc Coefficient", 1f, "Proc Coefficient for DIRECTIVE - Inject");
			drillProc = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DIRECTIVE - Drill Proc Coefficient", 1f, "Proc Coefficient for DIRECTIVE - Drill");
			disperseCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DIRECTIVE - Disperse Cooldown", 4f, "Cooldown for DIRECTIVE - Disperse");
			harvestEndlag = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DIRECTIVE - Harvest Endlag", 0.3f, "Endlag for DIRECTIVE - Harvest");
			harvestDamage = ((BaseUnityPlugin)this).Config.Bind<int>("General", "DIRECTIVE - Harvest Damage Coefficient", 600, "Damage Coefficient for DIRECTIVE - Harvest (in %)");
			Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Treebot/TreebotMortarRain.prefab").WaitForCompletion().GetComponent<ProjectileDotZone>()
				.overlapProcCoefficient = drillProc.Value;
			Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Treebot/TreebotBodySonicBoom.asset").WaitForCompletion().baseRechargeInterval = disperseCooldown.Value;
			Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Treebot/SyringeProjectile.prefab").WaitForCompletion().GetComponent<ProjectileController>()
				.procCoefficient = injectProc.Value;
			Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Treebot/SyringeProjectileHealing.prefab").WaitForCompletion().GetComponent<ProjectileController>()
				.procCoefficient = injectProc.Value;
			TreebotFireFruitSeed.OnEnter += new hook_OnEnter(TreebotFireFruitSeed_OnEnter);
			ReplaceSpecialText();
		}

		private void ReplaceSpecialText()
		{
			ReplaceString("TREEBOT_SPECIAL_ALT1_DESCRIPTION", $"Fire a bolt that deals <style=cIsDamage>{harvestDamage.Value}% damage</style> and <style=cIsDamage>injects</style> an enemy. On death, drop multiple <style=cIsHealing>healing fruits</style> that heal for <style=cIsHealing> 25% HP</style>.");
		}

		private void ReplaceString(string token, string newText)
		{
			DefaultLanguage[token] = Language.GetString(token);
			LanguageAPI.Add(token, newText);
		}

		private void TreebotFireFruitSeed_OnEnter(orig_OnEnter orig, TreebotFireFruitSeed self)
		{
			self.damageCoefficient = harvestDamage.Value / 100;
			self.baseDuration = harvestEndlag.Value;
			orig.Invoke(self);
		}
	}
}