Decompiled source of Yoggest v1.0.0

Yoggest.dll

Decompiled 11 months ago
using System;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.stiffmeds.yoggest")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("What's better than Yogger? Yoggest (a very big boye)")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Yoggest")]
[assembly: AssemblyTitle("com.stiffmeds.yoggest")]
[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 Yoggest
{
	[BepInPlugin("com.stiffmeds.yoggest", "Yoggest", "1.0.0")]
	[BepInProcess("AcrossTheObelisk.exe")]
	public class Yoggest : BaseUnityPlugin
	{
		internal const int ModDate = 20231215;

		private readonly Harmony harmony = new Harmony("com.stiffmeds.yoggest");

		internal static ManualLogSource Yog;

		public static ConfigEntry<float> medsYoggestIncreasePerVitality { get; private set; }

		public static ConfigEntry<bool> medsYoggestEveryone { get; private set; }

		public static ConfigEntry<bool> medsYoggestEveryoneIncludingThem { get; private set; }

		private void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_003b: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_006c: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_009d: Expected O, but got Unknown
			Yog = ((BaseUnityPlugin)this).Logger;
			medsYoggestIncreasePerVitality = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Settings", "Increase per Vitality stack"), 1f, new ConfigDescription("X% increase in Yogger's model size for each Vitality stack.", (AcceptableValueBase)null, Array.Empty<object>()));
			medsYoggestEveryone = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Settings", "Not Just Yogger"), false, new ConfigDescription("Let heroes other than Yogger scale with Vitality stacks.", (AcceptableValueBase)null, Array.Empty<object>()));
			medsYoggestEveryoneIncludingThem = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Settings", "Not Just You"), false, new ConfigDescription("Let NPCs scale with Vitality stacks.", (AcceptableValueBase)null, Array.Empty<object>()));
			Yog.LogInfo((object)"com.stiffmeds.yoggest 1.0.0 is loaded!");
			harmony.PatchAll();
		}
	}
	[HarmonyPatch]
	internal class Patches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(Character), "GetMaxHP")]
		public static void GetMaxHPPostfix(ref Character __instance)
		{
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			if (__instance != null && (Object)(object)__instance.HeroData != (Object)null && (Object)(object)__instance.HeroData.HeroSubClass != (Object)null && __instance.Alive && (Object)(object)__instance.HeroItem != (Object)null && (Object)(object)__instance.HeroItem.animatedTransform != (Object)null)
			{
				string id = __instance.HeroData.HeroSubClass.Id;
				if (id == "bandit" || Yoggest.medsYoggestEveryone.Value)
				{
					float num = 1f + (float)__instance.GetAuraCharges("vitality") * 0.01f * Yoggest.medsYoggestIncreasePerVitality.Value;
					__instance.HeroItem.animatedTransform.localScale = new Vector3(num, num, __instance.HeroItem.animatedTransform.localScale.z);
					Yoggest.Yog.LogDebug((object)("Setting " + id + " size to: " + num));
				}
			}
			else if (Yoggest.medsYoggestEveryoneIncludingThem.Value && __instance != null && (Object)(object)__instance.NpcData != (Object)null && __instance.Alive && (Object)(object)__instance.NPCItem != (Object)null && (Object)(object)__instance.NPCItem.animatedTransform != (Object)null)
			{
				float num2 = 1f + (float)__instance.GetAuraCharges("vitality") * 0.01f * Yoggest.medsYoggestIncreasePerVitality.Value;
				__instance.NPCItem.animatedTransform.localScale = new Vector3(num2, num2, __instance.NPCItem.animatedTransform.localScale.z);
				Yoggest.Yog.LogDebug((object)("Setting " + __instance.NpcData.Id + " size to: " + num2));
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "com.stiffmeds.yoggest";

		public const string PLUGIN_NAME = "Yoggest";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}