Decompiled source of MorheimMod v0.0.3

plugins/MorheimMod.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MorheimMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MorheimMod")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
namespace MorheimMod;

[BepInPlugin("com.morg.MorheimMod", "MorheimMod", "0.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class MorheimMod : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ItemData), "GetBaseBlockPower", new Type[] { typeof(int) })]
	public static class ItemDrop_GetBaseBlockPower_Patch
	{
		private static void Postfix(ref float __result)
		{
			__result += __result * blockRating.Value / 100f;
		}
	}

	public const string PluginGUID = "com.morg.MorheimMod";

	public const string PluginName = "MorheimMod";

	public const string PluginVersion = "0.0.3";

	public static ConfigEntry<float> blockRating;

	private readonly Harmony harmony = new Harmony("com.morg.MorheimMod");

	public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();

	private void Awake()
	{
		Logger.LogInfo((object)"MorheimMod has landed");
		ReadConfigValues();
		harmony.PatchAll();
	}

	private void ReadConfigValues()
	{
		//IL_0023: 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_0030: Expected O, but got Unknown
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		blockRating = ((BaseUnityPlugin)this).Config.Bind<float>("Server config", "blockRating", 0f, new ConfigDescription("Block Rate Multiplier (%) (x means x%. If positive, increase block power by x%. Otherwise, decrease block power by x%.)", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
	}

	public static float applyModifierValue(float targetValue, float value)
	{
		if (value <= -100f)
		{
			value = -100f;
		}
		if (value >= 0f)
		{
			return targetValue + targetValue / 100f * value;
		}
		return targetValue - targetValue / 100f * (value * -1f);
	}
}