ToadallyCompany.dll

Decompiled 10 months ago
using System.Collections.Generic;
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 BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using TMPro;
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("ToadsMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ToadsMod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4ebdd4f6-a08c-43ed-b268-3d506cb4bb44")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ToadallyCompany
{
	[BepInPlugin("Toadally.ToadallyCompany", "ToadallyCompany", "1.0.0.0")]
	public class ToadallyCompanyBase : BaseUnityPlugin
	{
		public const string guid = "Toadally.ToadallyCompany";

		public const string modName = "ToadallyCompany";

		public const string version = "1.0.0.0";

		private static ManualLogSource PluginLogger;

		public static ManualLogSource GetLogger()
		{
			return PluginLogger;
		}

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			PluginLogger = ((BaseUnityPlugin)this).Logger;
			Harmony.DEBUG = true;
			Harmony val = new Harmony("Toadally.ToadallyCompany");
			val.PatchAll();
		}

		public static string ReplaceText(string text)
		{
			return text.Replace("ship", "boat").Replace("Ship", "Boat");
		}
	}
}
namespace ToadallyCompany.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class PlayerControllerBPatch
	{
		[HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")]
		[HarmonyPostfix]
		public static void SetHoverTipAndCurrentInteractTrigger(ref TextMeshProUGUI ___cursorTip)
		{
			((TMP_Text)___cursorTip).text = ToadallyCompanyBase.ReplaceText(((TMP_Text)___cursorTip).text);
		}
	}
	[HarmonyPatch(typeof(MenuManager))]
	public class MenuManagerPatch
	{
		[HarmonyPatch("SetLoadingScreen")]
		[HarmonyPrefix]
		public static void SetLoadingScreen(ref string overrideMessage)
		{
			overrideMessage = ToadallyCompanyBase.ReplaceText(overrideMessage);
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	public class TerminalPatch
	{
		[HarmonyPatch("TextPostProcess")]
		[HarmonyPostfix]
		public static string TextPostProcess(string modifiedDisplayText)
		{
			return ToadallyCompanyBase.ReplaceText(modifiedDisplayText);
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public class StartOfRoundPatch
	{
		[HarmonyPatch("StartGame")]
		[HarmonyPostfix]
		public static void StartGame(ref bool ___inShipPhase)
		{
			if (___inShipPhase)
			{
				StartMatchLever val = Object.FindObjectOfType<StartMatchLever>();
				val.triggerScript.disabledHoverTip = ToadallyCompanyBase.ReplaceText(val.triggerScript.disabledHoverTip);
			}
		}

		[HarmonyPatch("ResetPlayersLoadedValueClientRpc")]
		[HarmonyPostfix]
		public static void ResetPlayersLoadedValueClientRpc(ref bool landingShip)
		{
			if (landingShip)
			{
				StartMatchLever val = Object.FindObjectOfType<StartMatchLever>();
				val.triggerScript.disabledHoverTip = ToadallyCompanyBase.ReplaceText(val.triggerScript.disabledHoverTip);
			}
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	public class HUDManagerPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void Update(ref TextMeshProUGUI ___holdButtonToEndGameEarlyText)
		{
			if (GameNetworkManager.Instance.localPlayerController.isPlayerDead)
			{
				((TMP_Text)___holdButtonToEndGameEarlyText).text = ToadallyCompanyBase.ReplaceText(((TMP_Text)___holdButtonToEndGameEarlyText).text);
			}
		}

		[HarmonyPatch("DisplayTip")]
		[HarmonyPrefix]
		public static void DisplayTip(ref string headerText, ref string bodyText)
		{
			headerText = ToadallyCompanyBase.ReplaceText(headerText);
			bodyText = ToadallyCompanyBase.ReplaceText(bodyText);
		}

		[HarmonyPatch("AddTextToChatOnServer")]
		[HarmonyPrefix]
		public static void AddTextToChatOnServer(ref string chatMessage)
		{
			chatMessage = ToadallyCompanyBase.ReplaceText(chatMessage);
		}

		[HarmonyPatch("ReadOutDialogue")]
		[HarmonyPrefix]
		public static void ReadOutDialogue(ref DialogueSegment[] dialogueArray)
		{
			DialogueSegment[] array = dialogueArray;
			foreach (DialogueSegment val in array)
			{
				val.speakerText = ToadallyCompanyBase.ReplaceText(val.speakerText);
				val.bodyText = ToadallyCompanyBase.ReplaceText(val.bodyText);
			}
		}

		[HarmonyPatch("UpdateScanNodes")]
		[HarmonyPrefix]
		public static void UpdateScanNodes(ref Dictionary<RectTransform, ScanNodeProperties> ___scanNodes)
		{
			foreach (KeyValuePair<RectTransform, ScanNodeProperties> ___scanNode in ___scanNodes)
			{
				___scanNode.Value.headerText = ToadallyCompanyBase.ReplaceText(___scanNode.Value.headerText);
				___scanNode.Value.subText = ToadallyCompanyBase.ReplaceText(___scanNode.Value.subText);
			}
		}
	}
	[HarmonyPatch(typeof(StartMatchLever))]
	public class StartMatchLeverPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void Update(ref InteractTrigger ___triggerScript)
		{
			___triggerScript.hoverTip = ToadallyCompanyBase.ReplaceText(___triggerScript.hoverTip);
		}
	}
}