Decompiled source of FloodWarning SizeTweaksRebuild Unofficial v1.0.0

FloodWarning_SizeTweaksRebuild.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[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 FloodWarning
{
	[BepInPlugin("com.floodwarning.tweaks.sizetweaks", "Flood Warning - Size Tweaks (Rebuild)", "1.0.0")]
	public class SizeTweaksRebuild : BaseUnityPlugin
	{
		private const float EliteBuffScaleMultiplier = 1.1f;

		private const float ChampionScaleMultiplier = 1.2f;

		private const float BossScaleMultiplier = 1.2f;

		public void Awake()
		{
			CharacterBody.onBodyStartGlobal += OnBodyStartGlobal;
		}

		public void OnDestroy()
		{
			CharacterBody.onBodyStartGlobal -= OnBodyStartGlobal;
		}

		private static void OnBodyStartGlobal(CharacterBody body)
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)body == (Object)null || (Object)(object)body.modelLocator == (Object)null)
			{
				return;
			}
			Transform modelBaseTransform = body.modelLocator.modelBaseTransform;
			if (!Object.op_Implicit((Object)(object)modelBaseTransform))
			{
				return;
			}
			int num = 0;
			BuffIndex[] eliteBuffIndices = BuffCatalog.eliteBuffIndices;
			for (int i = 0; i < eliteBuffIndices.Length; i++)
			{
				if (body.HasBuff(eliteBuffIndices[i]))
				{
					num++;
				}
			}
			float num2 = Mathf.Pow(1.1f, (float)num);
			if (body.isChampion)
			{
				num2 *= 1.2f;
			}
			if (body.isBoss)
			{
				num2 *= 1.2f;
			}
			if (num2 != 1f)
			{
				modelBaseTransform.localScale *= num2;
			}
		}
	}
}