Decompiled source of JournalHotkey v1.0.0

VoodooFishinMod.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;
using Riverboat.Players;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("VoodooFishinMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first Voodoo Fishin' mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("VoodooFishinMod")]
[assembly: AssemblyTitle("VoodooFishinMod")]
[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 VoodooFishinMod
{
	[BepInPlugin("com.wilianjhon.voodoofishinmod", "VoodooFishinMod", "1.0.0")]
	public class Plugin : BasePlugin
	{
		private const string MyGUID = "com.wilianjhon.voodoofishinmod";

		private const string MyPluginName = "VoodooFishinMod";

		private const string VersionString = "1.0.0";

		internal static ManualLogSource ModLogger;

		public override void Load()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			ModLogger = ((BasePlugin)this).Log;
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(41, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Mod] O mod '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("VoodooFishinMod");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' foi carregado com sucesso!");
			}
			log.LogInfo(val);
			new Harmony("com.wilianjhon.voodoofishinmod").PatchAll();
			((BasePlugin)this).Log.LogInfo((object)"[Mod] Patches de Hotkey aplicados!");
		}
	}
	[HarmonyPatch(typeof(LocalPlayerInput), "LateUpdate")]
	public static class LocalPlayerInputPatch
	{
		public static void Postfix(LocalPlayerInput __instance)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			if (Keyboard.current == null || !((ButtonControl)Keyboard.current.jKey).wasPressedThisFrame)
			{
				return;
			}
			Plugin.ModLogger.LogInfo((object)"[Mod] Tecla J pressionada!");
			Il2CppArrayBase<JournalController> val = Resources.FindObjectsOfTypeAll<JournalController>();
			if (val.Length > 0)
			{
				JournalController val2 = val[0];
				ManualLogSource modLogger = Plugin.ModLogger;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Mod] Usando JournalController: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((Object)val2).name);
				}
				modLogger.LogInfo(val3);
				JournalNavigator val4 = ((IEnumerable<JournalNavigator>)Resources.FindObjectsOfTypeAll<JournalNavigator>()).FirstOrDefault();
				if ((Object)(object)val4 != (Object)null && val4._journalIsOpen)
				{
					Plugin.ModLogger.LogInfo((object)"[Mod] Diário aberto. Tentando TriggerShopExit...");
					ShopExitContext val5 = new ShopExitContext();
					val5.Player = ((Component)__instance).gameObject;
					val5.PlayerTransform = ((Component)__instance).transform;
					val5.IsLocalPlayer = true;
					val2.TriggerShopExit(val5);
				}
				else
				{
					Plugin.ModLogger.LogInfo((object)"[Mod] Diário fechado. Tentando TriggerShopEnter...");
					ShopEntryContext val6 = new ShopEntryContext();
					val6.Player = ((Component)__instance).gameObject;
					val6.PlayerTransform = ((Component)__instance).transform;
					val6.IsLocalPlayer = true;
					val2.TriggerShopEnter(val6);
				}
			}
			else
			{
				Plugin.ModLogger.LogInfo((object)"[Mod] Nenhum JournalController encontrado na cena!");
			}
		}
	}
}