Decompiled source of BomDePeso v1.0.0

BomDePeso.dll

Decompiled a day ago
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace BomDePeso;

[BepInPlugin("yuri.BomDePeso", "Bom de Peso", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static ConfigEntry<bool> Ligado;

	public static ConfigEntry<float> ExtraMax;

	private void Awake()
	{
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		Ligado = ((BaseUnityPlugin)this).Config.Bind<bool>("Geral", "Ligado", true, "Liga o peso extra so neste jogo. O servidor nao precisa do mod.");
		ExtraMax = ((BaseUnityPlugin)this).Config.Bind<float>("Peso", "ExtraNoMaximo", 300f, "Peso extra com a habilidade Corrida em 100. Em zero, o extra e 0.");
		Harmony val = new Harmony("yuri.BomDePeso");
		val.PatchAll();
	}

	public static float Fator(Player jogador)
	{
		float num = ((Character)jogador).GetSkillLevel((SkillType)102);
		if (num < 0f)
		{
			num = 0f;
		}
		if (num > 100f)
		{
			num = 100f;
		}
		return num / 100f;
	}
}
[HarmonyPatch(typeof(Player), "GetMaxCarryWeight")]
public static class PesoPatch
{
	private static void Postfix(Player __instance, ref float __result)
	{
		if (Plugin.Ligado.Value && !((Object)(object)Player.m_localPlayer != (Object)(object)__instance))
		{
			float num = Plugin.ExtraMax.Value;
			if (num < 0f)
			{
				num = 0f;
			}
			__result += num * Plugin.Fator(__instance);
		}
	}
}