Decompiled source of Equalizer v1.0.2

Equalizer.dll

Decompiled a year ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Configuration;
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.Logging;
using Equalizer.Patches;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("Equalizer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Equalize character skills for Warheim PvP")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Equalizer")]
[assembly: AssemblyTitle("Equalizer")]
[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 Equalizer
{
	[BepInPlugin("Kevver.Equalizer", "Equalizer", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		public const string NAME = "Equalizer";

		public const string AUTHOR = "Kevver";

		public const string GUID = "Kevver.Equalizer";

		public const string VERSION = "1.0.1";

		private readonly Harmony harmony = new Harmony("Equalizer");

		private void Awake()
		{
			Logger.Sources.Add((ILogSource)(object)Utility.Logger);
			Logger.Sources.Add((ILogSource)(object)PlayerSpawned.Logger);
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			harmony.PatchAll(executingAssembly);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Equalizer";

		public const string PLUGIN_NAME = "Equalizer";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Equalizer.Properties
{
	[CompilerGenerated]
	[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")]
	internal sealed class Settings : ApplicationSettingsBase
	{
		private static Settings defaultInstance = (Settings)(object)SettingsBase.Synchronized((SettingsBase)(object)new Settings());

		public static Settings Default => defaultInstance;
	}
}
namespace Equalizer.Patches
{
	public static class Utility
	{
		public static ManualLogSource Logger = new ManualLogSource("Equalizer");

		public static string host = "";

		public static int port = 0;

		private static void SetSkill(string name, float value)
		{
			((Character)Player.m_localPlayer).GetSkills().CheatResetSkill(name);
			((Character)Player.m_localPlayer).GetSkills().CheatRaiseSkill(name, value, true);
		}

		public static void Equalize()
		{
			List<string> list = new List<string>();
			list.Add("Swords");
			list.Add("Spears");
			list.Add("Polearms");
			list.Add("Axes");
			list.Add("Knives");
			list.Add("Clubs");
			list.ForEach(delegate(string skill)
			{
				SetSkill(skill, 30f);
			});
			list.Clear();
			list.Add("Blocking");
			list.Add("Bows");
			list.ForEach(delegate(string skill)
			{
				SetSkill(skill, 25f);
			});
			((Character)Player.m_localPlayer).GetSkills().CheatResetSkill("Unarmed");
			((Character)Player.m_localPlayer).GetSkills().CheatRaiseSkill("Unarmed", 15f, true);
			((Character)Player.m_localPlayer).GetSkills().CheatResetSkill("Run");
			((Character)Player.m_localPlayer).GetSkills().CheatResetSkill("Jump");
			Logger.LogInfo((object)("Reset skills on " + Player.m_localPlayer.GetPlayerName()));
		}
	}
	[HarmonyPatch(typeof(Player), "OnSpawned")]
	public static class PlayerSpawned
	{
		public static ManualLogSource Logger = new ManualLogSource("Equalizer.PlayerSpawned");

		public static void Postfix()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			if ((int)ZNet.GetConnectionStatus() == 2 && ZNet.m_serverHost.Equals("192.80.128.113") && ZNet.m_serverHostPort == 23456)
			{
				Logger.LogInfo((object)"Connecting to Warheim PvP, equalizing...");
				Utility.Equalize();
			}
		}
	}
}