Decompiled source of DamageScaling v1.0.0

DamageScaling.dll

Decompiled a year 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 GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[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("DamageScaling")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Scales damage based on config values")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1+0d82f3da57860de9d3cb828df6e4f6b063dbb443")]
[assembly: AssemblyProduct("DamageScaling")]
[assembly: AssemblyTitle("DamageScaling")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.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 DamageScaling
{
	internal class DamagePatch
	{
		[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
		[HarmonyPrefix]
		private static void DamagePlayerPrefix(ref int damageNumber, CauseOfDeath causeOfDeath, bool fallDamage)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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)
			Plugin.StaticLogger.LogInfo((object)$"DamagePlayerPrefix: {damageNumber} : {causeOfDeath} : {fallDamage}");
			CauseOfDeath key = causeOfDeath;
			if (fallDamage)
			{
				key = (CauseOfDeath)2;
			}
			damageNumber = (int)((float)damageNumber * Plugin.deathCauseScaling[key]);
		}
	}
	[BepInPlugin("DamageScaling", "DamageScaling", "1.1.1")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource StaticLogger;

		public static Dictionary<CauseOfDeath, float> deathCauseScaling = new Dictionary<CauseOfDeath, float>();

		private void Awake()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			StaticLogger = ((BaseUnityPlugin)this).Logger;
			ConfigFile();
			new Harmony("DamageScaling").PatchAll(typeof(DamagePatch));
			StaticLogger.LogInfo((object)"Plugin DamageScaling loaded");
		}

		private void ConfigFile()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			foreach (CauseOfDeath value in Enum.GetValues(typeof(CauseOfDeath)))
			{
				CauseOfDeath val = value;
				ConfigEntry<float> val2 = ((BaseUnityPlugin)this).Config.Bind<float>("Scalers", ((object)(CauseOfDeath)(ref val)).ToString(), 1f, $"Damage multiplier for {val}");
				deathCauseScaling.Add(val, val2.Value);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "DamageScaling";

		public const string PLUGIN_NAME = "DamageScaling";

		public const string PLUGIN_VERSION = "1.1.1";
	}
}