Decompiled source of AdrenalineTweaks v0.1.1

AdrenalineTweaks.dll

Decompiled 20 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Extensions;
using Jotunn.Managers;
using Jotunn.Utils;
using Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AdrenalineTweaks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdrenalineTweaks")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.1.1")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.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 Logging
{
	internal static class Log
	{
		internal enum InfoLevel
		{
			Low,
			Medium,
			High
		}

		private static ManualLogSource logSource;

		internal static ConfigEntry<InfoLevel> Verbosity { get; set; }

		internal static InfoLevel VerbosityLevel => Verbosity.Value;

		internal static bool IsVerbosityLow => Verbosity.Value >= InfoLevel.Low;

		internal static bool IsVerbosityMedium => Verbosity.Value >= InfoLevel.Medium;

		internal static bool IsVerbosityHigh => Verbosity.Value >= InfoLevel.High;

		internal static void Init(ManualLogSource logSource)
		{
			Log.logSource = logSource;
		}

		internal static void LogDebug(object data)
		{
			logSource.LogDebug(data);
		}

		internal static void LogError(object data)
		{
			logSource.LogError(data);
		}

		internal static void LogFatal(object data)
		{
			logSource.LogFatal(data);
		}

		internal static void LogMessage(object data)
		{
			logSource.LogMessage(data);
		}

		internal static void LogWarning(object data)
		{
			logSource.LogWarning(data);
		}

		internal static void LogInfo(object data, InfoLevel level = InfoLevel.Low)
		{
			if (Verbosity == null || VerbosityLevel >= level)
			{
				logSource.LogInfo(data);
			}
		}

		internal static void LogGameObject(GameObject prefab, bool includeChildren = false)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			LogInfo("***** " + ((Object)prefab).name + " *****");
			Component[] components = prefab.GetComponents<Component>();
			for (int i = 0; i < components.Length; i++)
			{
				LogComponent(components[i]);
			}
			if (!includeChildren)
			{
				return;
			}
			LogInfo("***** " + ((Object)prefab).name + " (children) *****");
			foreach (Transform item in prefab.transform)
			{
				Transform val = item;
				if (Object.op_Implicit((Object)(object)val))
				{
					LogInfo(" - " + ((Object)val).name);
					components = ((Component)val).GetComponents<Component>();
					for (int i = 0; i < components.Length; i++)
					{
						LogComponent(components[i]);
					}
				}
			}
		}

		internal static void LogComponent(Component compo)
		{
			if (!Object.op_Implicit((Object)(object)compo))
			{
				return;
			}
			try
			{
				LogInfo("--- " + ((object)compo).GetType().Name + ": " + ((Object)compo).name + " ---");
			}
			catch (Exception ex)
			{
				LogError(ex.ToString());
				LogWarning("Could not get type name for component!");
				return;
			}
			try
			{
				foreach (PropertyInfo declaredProperty in AccessTools.GetDeclaredProperties(((object)compo).GetType()))
				{
					try
					{
						LogInfo($" - {declaredProperty.Name} = {declaredProperty.GetValue(compo)}");
					}
					catch (Exception ex2)
					{
						LogError(ex2.ToString());
						LogWarning("Could not get property: " + declaredProperty.Name + " for component!");
					}
				}
			}
			catch (Exception ex3)
			{
				LogError(ex3.ToString());
				LogWarning("Could not get properties for component!");
			}
			try
			{
				foreach (FieldInfo declaredField in AccessTools.GetDeclaredFields(((object)compo).GetType()))
				{
					try
					{
						LogInfo($" - {declaredField.Name} = {declaredField.GetValue(compo)}");
					}
					catch (Exception ex4)
					{
						LogError(ex4.ToString());
						LogWarning("Could not get field: " + declaredField.Name + " for component!");
					}
				}
			}
			catch (Exception ex5)
			{
				LogError(ex5.ToString());
				LogWarning("Could not get fields for component!");
			}
		}
	}
}
namespace AdrenalineTweaks
{
	[BepInPlugin("Searica.Valheim.AdrenalineTweaks", "AdrenalineTweaks", "0.1.1")]
	[BepInDependency("com.jotunn.jotunn", "2.30.2")]
	internal sealed class AdrenalineTweaks : BaseUnityPlugin
	{
		public const string PluginName = "AdrenalineTweaks";

		internal const string Author = "Searica";

		public const string PluginGUID = "Searica.Valheim.AdrenalineTweaks";

		public const string PluginVersion = "0.1.1";

		internal static AdrenalineTweaks Instance;

		internal static ConfigFileWatcher FileWatcher;

		private static ConfigEntry<float> AdrenalineMultiplier;

		private static ConfigEntry<float> AdrenalineDecayMultiplier;

		private static ConfigEntry<float> AdrenalineDecayDelayMultiplier;

		private static ConfigEntry<float> AdrenalineGainSkillMultiplier;

		public static float GetAdrenalineMultiplier()
		{
			return AdrenalineMultiplier.Value;
		}

		public static float GetAdrenalineDecayMultiplier()
		{
			return AdrenalineDecayMultiplier.Value;
		}

		public static float GetAdrenalineDecayDelayMultiplier()
		{
			return AdrenalineDecayDelayMultiplier.Value;
		}

		public static float GetAdrenalineGainSkillMultiplier()
		{
			return AdrenalineGainSkillMultiplier.Value;
		}

		public void Awake()
		{
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			Instance = this;
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
			AdrenalineMultiplier = ConfigFileExtensions.BindConfigInOrder<float>(((BaseUnityPlugin)this).Config, "General", "AdrenalineMultiplier", 1f, "Multiplier to gained adrenaline (example: harder 0.5, standard 1.0, easier 1.5)", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			AdrenalineDecayMultiplier = ConfigFileExtensions.BindConfigInOrder<float>(((BaseUnityPlugin)this).Config, "General", "AdrenalineDecayMultiplier", 1f, "Multiplier to lost adrenaline (example: harder 1.5, standard 1.0, easier 0.5)", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			AdrenalineDecayDelayMultiplier = ConfigFileExtensions.BindConfigInOrder<float>(((BaseUnityPlugin)this).Config, "General", "AdrenalineDecayDelayMultiplier", 1f, "Multiplier to delay before adrenaline decay starts (example: harder 0.5, standard 1.0, easier 1.5)", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			AdrenalineGainSkillMultiplier = ConfigFileExtensions.BindConfigInOrder<float>(((BaseUnityPlugin)this).Config, "General", "AdrenalineGainSkillMultiplier", 3f, "The multiplier to adrenaline gained when attacking, dodging, blocking, etc. when the associated skill level for that action is at level 100. The multiplier is linearly interpolated up to skill level 100, so if the this is set to 2 and you have block 50, you would gain 1.5 times as much adrenaline.", true, true, true, (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			Log.Init(((BaseUnityPlugin)this).Logger);
			Log.Verbosity = ConfigFileExtensions.BindConfigInOrder<Log.InfoLevel>(((BaseUnityPlugin)this).Config, "Logging", "Verbosity", Log.InfoLevel.Low, "Low will log basic information about the mod. Medium will log information that is useful for troubleshooting. High will log a lot of information, do not set it to this without good reason as it will slow down your game.", false, true, true, (AcceptableValueBase)null, (Action<ConfigEntryBase>)null, (ConfigurationManagerAttributes)null);
			((BaseUnityPlugin)this).Config.Save();
			FileWatcher = new ConfigFileWatcher(((BaseUnityPlugin)this).Config, 1000L);
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Searica.Valheim.AdrenalineTweaks");
			Game.isModded = true;
			FileWatcher.OnConfigFileReloaded += delegate
			{
				UpdatePlugin(saveConfig: false);
			};
			SynchronizationManager.OnConfigurationWindowClosed += delegate
			{
				UpdatePlugin();
			};
			SynchronizationManager.OnConfigurationSynchronized += delegate
			{
				UpdatePlugin();
			};
		}

		private void UpdatePlugin(bool saveConfig = true, bool initialUpdate = false)
		{
			if (saveConfig)
			{
				((BaseUnityPlugin)this).Config.Save();
			}
		}

		public void OnDestroy()
		{
			((BaseUnityPlugin)this).Config.Save();
		}
	}
	[HarmonyPatch]
	internal static class AdrenalinePatches
	{
		private static SkillType AdrenalineSource;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Player), "HitWhileDodging")]
		private static void HitWhileDodgingPrefix(Player __instance)
		{
			if (Object.op_Implicit((Object)(object)__instance) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && !((Character)__instance).m_nview.IsOwner())
			{
				((Character)__instance).m_nview.ClaimOwnership();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Player), "RPC_HitWhileDodging")]
		private static void RPC_HitWhileDodgingPrefix(Player __instance, long sender)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)__instance) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer))
			{
				AdrenalineSource = (SkillType)108;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "RPC_HitWhileDodging")]
		private static void RPC_HitWhileDodgingPostfix(Player __instance, long sender)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			AdrenalineSource = (SkillType)0;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		private static void PlayerBlockAttackPrefix(Humanoid __instance)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)__instance) && ((Character)__instance).IsPlayer() && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer))
			{
				AdrenalineSource = (SkillType)6;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		private static void PlayerBlockAttackPostfix(Humanoid __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			AdrenalineSource = (SkillType)0;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Player), "ActivateGuardianPower")]
		private static void PlayerActivateGuardianPowerPrefix(Player __instance)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)__instance) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer))
			{
				AdrenalineSource = (SkillType)999;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "ActivateGuardianPower")]
		private static void PlayerActivateGuardianPowerPostfix(Player __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			AdrenalineSource = (SkillType)0;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		private static void PlayerDamagePrefix(Character __instance)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)__instance) && __instance.IsPlayer() && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer))
			{
				AdrenalineSource = (SkillType)999;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		private static void PlayerDamagePostfix(Character __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			AdrenalineSource = (SkillType)0;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Player), "AddAdrenaline")]
		private static void PlayerAddAdrenalinePrefix(Player __instance, ref float v)
		{
			if (Object.op_Implicit((Object)(object)__instance) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer))
			{
				if (v > 0f)
				{
					v *= GetSkillMultiplier(__instance) * AdrenalineTweaks.GetAdrenalineMultiplier();
				}
				else
				{
					v *= AdrenalineTweaks.GetAdrenalineDecayMultiplier();
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "AddAdrenaline")]
		public static void PlayerAddAdrenalinePostfix(Player __instance, float v)
		{
			if (Object.op_Implicit((Object)(object)__instance) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && v > 0f && ((Character)__instance).GetMaxAdrenaline() > 0f)
			{
				__instance.m_adrenalineDegenTimer *= AdrenalineTweaks.GetAdrenalineDecayDelayMultiplier();
			}
		}

		private static float GetSkillMultiplier(Player player)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if ((int)AdrenalineSource == 999)
			{
				return 1f;
			}
			float skillFactor;
			if ((int)AdrenalineSource == 0 && ((Humanoid)player).m_currentAttack != null && ((Humanoid)player).m_currentAttack.m_weapon != null)
			{
				skillFactor = ((Character)player).GetSkillFactor(((Humanoid)player).m_currentAttack.m_weapon.m_shared.m_skillType);
				Log.LogInfo($"Skill: {((object)Unsafe.As<SkillType, SkillType>(ref ((Humanoid)player).m_currentAttack.m_weapon.m_shared.m_skillType)/*cast due to .constrained prefix*/).ToString()}, Factor: {skillFactor}", Log.InfoLevel.Medium);
			}
			else
			{
				skillFactor = ((Character)player).GetSkillFactor(AdrenalineSource);
				Log.LogInfo($"Skill: {((object)Unsafe.As<SkillType, SkillType>(ref AdrenalineSource)/*cast due to .constrained prefix*/).ToString()}, Factor: {skillFactor}", Log.InfoLevel.Medium);
			}
			return Mathf.Lerp(1f, AdrenalineTweaks.GetAdrenalineGainSkillMultiplier(), skillFactor);
		}
	}
}
namespace AdrenalineTweaks.Extensions
{
	internal static class EventExtensions
	{
		public static void SafeInvoke(this Action events)
		{
			if (events == null)
			{
				return;
			}
			Delegate[] invocationList = events.GetInvocationList();
			for (int i = 0; i < invocationList.Length; i++)
			{
				Action action = (Action)invocationList[i];
				try
				{
					action();
				}
				catch (Exception ex)
				{
					Log.LogWarning($"Exception thrown at event {new StackFrame(1).GetMethod().Name} in {action.Method.DeclaringType.Name}.{action.Method.Name}:\n{ex}");
				}
			}
		}

		public static void SafeInvoke<TArg1>(this Action<TArg1> events, TArg1 arg1)
		{
			if (events == null)
			{
				return;
			}
			Delegate[] invocationList = events.GetInvocationList();
			for (int i = 0; i < invocationList.Length; i++)
			{
				Action<TArg1> action = (Action<TArg1>)invocationList[i];
				try
				{
					action(arg1);
				}
				catch (Exception ex)
				{
					Log.LogWarning($"Exception thrown at event {new StackFrame(1).GetMethod().Name} in {action.Method.DeclaringType.Name}.{action.Method.Name}:\n{ex}");
				}
			}
		}

		public static void SafeInvoke<TArg1, TArg2>(this Action<TArg1, TArg2> events, TArg1 arg1, TArg2 arg2)
		{
			if (events == null)
			{
				return;
			}
			Delegate[] invocationList = events.GetInvocationList();
			for (int i = 0; i < invocationList.Length; i++)
			{
				Action<TArg1, TArg2> action = (Action<TArg1, TArg2>)invocationList[i];
				try
				{
					action(arg1, arg2);
				}
				catch (Exception ex)
				{
					Log.LogWarning($"Exception thrown at event {new StackFrame(1).GetMethod().Name} in {action.Method.DeclaringType.Name}.{action.Method.Name}:\n{ex}");
				}
			}
		}

		public static void SafeInvoke<TEventArg>(this EventHandler<TEventArg> events, object sender, TEventArg arg1)
		{
			if (events == null)
			{
				return;
			}
			Delegate[] invocationList = events.GetInvocationList();
			for (int i = 0; i < invocationList.Length; i++)
			{
				EventHandler<TEventArg> eventHandler = (EventHandler<TEventArg>)invocationList[i];
				try
				{
					eventHandler(sender, arg1);
				}
				catch (Exception ex)
				{
					Log.LogWarning($"Exception thrown at event {new StackFrame(1).GetMethod().Name} in {eventHandler.Method.DeclaringType.Name}.{eventHandler.Method.Name}:\n{ex}");
				}
			}
		}
	}
	internal static class TypeExtensions
	{
		internal static List<T> GetAllPublicConstantValues<T>(this Type type)
		{
			return (from x in type.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy)
				where x.IsLiteral && !x.IsInitOnly && x.FieldType == typeof(T)
				select (T)x.GetRawConstantValue()).ToList();
		}

		internal static List<T> GetAllPublicStaticValues<T>(this Type type)
		{
			return (from x in type.GetFields(BindingFlags.Static | BindingFlags.Public)
				where x.FieldType == typeof(T)
				select (T)x.GetValue(null)).ToList();
		}
	}
	internal static class GenericExtensions
	{
		private const BindingFlags AllBindings = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty;

		public static void CopyFields(this object target, object source)
		{
			if (target == null || source == null)
			{
				throw new Exception("Target or/and Source Objects are null");
			}
			Type type = source.GetType();
			FieldInfo[] fields = target.GetType().GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty);
			foreach (FieldInfo fieldInfo in fields)
			{
				FieldInfo field = type.GetField(fieldInfo.Name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty);
				if (!(field == null) && field.IsInitOnly && field.FieldType.IsAssignableFrom(fieldInfo.FieldType))
				{
					field.SetValue(source, fieldInfo.GetValue(target));
				}
			}
		}

		internal static T Ref<T>(this T o) where T : Object
		{
			if (!Object.op_Implicit((Object)(object)o))
			{
				return default(T);
			}
			return o;
		}
	}
	internal static class IEnumerableExtensions
	{
		internal static void Dispose(this IEnumerable<IDisposable> collection)
		{
			foreach (IDisposable item in collection)
			{
				if (item != null)
				{
					try
					{
						item.Dispose();
					}
					catch (Exception)
					{
						Log.LogWarning("Could not dispose of item");
					}
				}
			}
		}
	}
	internal static class ReflectionUtils
	{
		public const BindingFlags AllBindings = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty;

		internal static MethodInfo GetMethod(Type type, string name, Type[] types)
		{
			MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty);
			foreach (MethodInfo methodInfo in methods)
			{
				if (methodInfo.Name == name && HasMatchingParameterTypes(0, types, methodInfo.GetParameters()))
				{
					return methodInfo;
				}
			}
			return null;
		}

		internal static MethodInfo GetGenericMethod(Type type, string name, int genericParameterCount, Type[] types)
		{
			MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField | BindingFlags.GetProperty | BindingFlags.SetProperty);
			foreach (MethodInfo methodInfo in methods)
			{
				if (methodInfo.IsGenericMethod && methodInfo.ContainsGenericParameters && methodInfo.Name == name && HasMatchingParameterTypes(genericParameterCount, types, methodInfo.GetParameters()))
				{
					return methodInfo;
				}
			}
			return null;
		}

		private static bool HasMatchingParameterTypes(int genericParameterCount, Type[] types, ParameterInfo[] parameters)
		{
			if (parameters.Length < genericParameterCount || parameters.Length != types.Length)
			{
				return false;
			}
			int num = 0;
			for (int i = 0; i < parameters.Length; i++)
			{
				if (parameters[i].ParameterType.IsGenericParameter)
				{
					num++;
				}
				else if (types[i] != parameters[i].ParameterType)
				{
					return false;
				}
			}
			if (num != genericParameterCount)
			{
				return false;
			}
			return true;
		}
	}
	internal static class StringExtensions
	{
		internal static bool ContainsAny(this string str, params string[] substrings)
		{
			foreach (string value in substrings)
			{
				if (str.Contains(value))
				{
					return true;
				}
			}
			return false;
		}

		internal static bool EndsWithAny(this string str, params string[] suffixes)
		{
			foreach (string value in suffixes)
			{
				if (str.EndsWith(value))
				{
					return true;
				}
			}
			return false;
		}

		internal static bool StartsWithAny(this string str, params string[] suffixes)
		{
			foreach (string value in suffixes)
			{
				if (str.StartsWith(value))
				{
					return true;
				}
			}
			return false;
		}

		internal static string RemoveSuffix(this string s, string suffix)
		{
			if (s.EndsWith(suffix))
			{
				return s.Substring(0, s.Length - suffix.Length);
			}
			return s;
		}

		internal static string RemovePrefix(this string s, string prefix)
		{
			if (s.StartsWith(prefix))
			{
				return s.Substring(prefix.Length, s.Length - prefix.Length);
			}
			return s;
		}

		internal static string CapitalizeFirstLetter(this string s)
		{
			if (s.Length == 0)
			{
				return s;
			}
			if (s.Length == 1)
			{
				return $"{char.ToUpper(s[0])}";
			}
			return char.ToUpper(s[0]) + s.Substring(1);
		}

		internal static string EmptyIfNull(this object value)
		{
			if (value == null)
			{
				return string.Empty;
			}
			return value.ToString();
		}
	}
	internal static class TransformExtensions
	{
		public static Transform FindDeepChild(this Transform transform, string childName, bool breadthFirst = true)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			if (breadthFirst)
			{
				Queue<Transform> queue = new Queue<Transform>();
				queue.Enqueue(transform);
				while (queue.Count > 0)
				{
					Transform val = queue.Dequeue();
					if (((Object)val).name == childName)
					{
						return val;
					}
					foreach (Transform item2 in val)
					{
						Transform item = item2;
						queue.Enqueue(item);
					}
				}
				return null;
			}
			foreach (Transform item3 in transform)
			{
				Transform val2 = item3;
				if (((Object)val2).name == childName)
				{
					return val2;
				}
				Transform val3 = val2.FindDeepChild(childName);
				if ((Object)(object)val3 != (Object)null)
				{
					return val3;
				}
			}
			return null;
		}
	}
}