Decompiled source of HotBait v0.0.2

plugins/HotBait.dll

Decompiled 3 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("HotBait")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HotBait")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c94bd8ae-c55e-46fb-80bc-155083870c90")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace HotBait;

[BepInPlugin("asbjorn.hotbait", "HotBait", "0.0.2")]
public class Mod : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ZNetScene), "Awake")]
	public class ZNetScene_Awake_Patch
	{
		public static void Postfix(ZNetScene __instance)
		{
			FixFish(__instance);
		}
	}

	private const string AuthorName = "Joe_Osborne";

	private const string ModName = "HotBait";

	private const string ModVer = "0.0.2";

	private const string ModGuid = "asbjorn.hotbait";

	private Harmony _harmony;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		_harmony = new Harmony("asbjorn.hotbait");
		_harmony.PatchAll();
	}

	public static void FixFish(ZNetScene __instance)
	{
		string text = "Fish11";
		string text2 = "FishingBaitAshlands";
		GameObject prefab = __instance.GetPrefab(text);
		if ((Object)(object)prefab != (Object)null)
		{
			Fish component = prefab.GetComponent<Fish>();
			if ((Object)(object)component != (Object)null && component.m_baits.Count == 1 && component.m_baits[0] != null && (Object)(object)component.m_baits[0].m_bait == (Object)null)
			{
				component.m_baits[0].m_bait = ObjectDB.instance.GetItemPrefab(text2).GetComponent<ItemDrop>();
				component.m_baits[0].m_chance = 1f;
			}
		}
	}
}