Decompiled source of AlwaysFresh v1.0.1

AlwaysFresh.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("AlwaysFresh")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AlwaysFresh")]
[assembly: AssemblyTitle("AlwaysFresh")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Always_Fresh;

[BepInPlugin("AlwaysFresh.adry.ultrakill", "Always Fresh", "1.0.0")]
[BepInProcess("ULTRAKILL.exe")]
public class AlwaysFresh : BaseUnityPlugin
{
	[HarmonyPatch(typeof(StyleHUD), "DecayFreshness")]
	public class PatchDecayFreshness
	{
		private static bool Prefix()
		{
			return false;
		}
	}

	[HarmonyPatch(typeof(StyleHUD), "AddPoints")]
	public class PatchAddPoints
	{
		private static void Prefix(ref int points, ref GameObject sourceWeapon, StyleHUD __instance)
		{
			points = Mathf.RoundToInt((float)points * 1f);
		}
	}

	[HarmonyPatch(typeof(StyleHUD), "UpdateFreshness")]
	public class PatchUpdateFreshness
	{
		private static void Postfix(StyleHUD __instance)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			object value = AccessTools.Field(typeof(StyleHUD), "gc").GetValue((object)__instance);
			GunControl val = (GunControl)((value is GunControl) ? value : null);
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			Enumerator<GameObject> enumerator = val.allWeapons.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					GameObject current = enumerator.Current;
					if ((Object)(object)current != (Object)null)
					{
						__instance.SetFreshness(current, 10f);
					}
				}
			}
			finally
			{
				((global::System.IDisposable)enumerator).Dispose();
			}
		}
	}

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("AlwaysFresh.adry.ultrakill");
		val.PatchAll();
	}
}