Decompiled source of AlwaysPremium v1.0.0

AlwaysPremium.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("HTF")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HTF")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5208ed49-769e-472d-8164-a43d8313e78b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HTF_AlwaysPremium;

[BepInPlugin("HTF.kr.AlwaysPremium", "AlwaysPremium", "1.0.0")]
public class ModBehaviour : BaseUnityPlugin
{
	[HarmonyPatch(typeof(CreatureManager))]
	public class CreatureManager_path
	{
		[HarmonyTranspiler]
		[HarmonyPatch("HookItem")]
		private static IEnumerable<CodeInstruction> HookItem_Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Ldfld && list[i].operand is FieldInfo)
				{
					FieldInfo fieldInfo = list[i].operand as FieldInfo;
					if (fieldInfo.Name == "_shinyCreatureChance")
					{
						Debug.Log((object)"find _shinyCreatureChance");
						MethodInfo methodInfo = AccessTools.Method(typeof(CreatureManager_path), "setVal", (Type[])null, (Type[])null);
						list.Insert(i + 1, new CodeInstruction(OpCodes.Call, (object)methodInfo));
						break;
					}
				}
			}
			return list;
		}

		private static int setVal(int val)
		{
			return 101;
		}
	}

	private Harmony harmony;

	private static ManualLogSource Log;

	private void Awake()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		harmony = new Harmony("HTF.kr.AlwaysPremium");
		harmony.PatchAll();
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"AlwaysPremium enble");
	}
}