Decompiled source of Custom Kiosk Prompts v1.1.1

CustomKioskPrompts.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using PhotonCustomPropsUtils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CustomKioskPrompts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CustomKioskPrompts")]
[assembly: AssemblyTitle("CustomKioskPrompts")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace CustomKioskPrompts
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("tony4twentys.Custom_Kiosk_Prompts", "Custom Kiosk Prompts", "1.0.0")]
	public class CustomKioskTextPlugin : BaseUnityPlugin
	{
		public static ConfigEntry<string> inviteText;

		public static ConfigEntry<string> inviteName;

		public static ConfigEntry<string> checkInText;

		public static ConfigEntry<string> checkInName;

		public static CustomKioskTextPlugin Instance;

		private PhotonScopedManager manager;

		public string[] receivedPrompts;

		private void Awake()
		{
			Instance = this;
			inviteText = ((BaseUnityPlugin)this).Config.Bind<string>("General", "InviteFriendsText", "INVITE FRIENDS", "Text shown when interacting with the Invite Friends Kiosk");
			inviteName = ((BaseUnityPlugin)this).Config.Bind<string>("General", "InviteFriendsName", "INVITE KIOSK", "Label name of the Invite Friends Kiosk");
			checkInText = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CheckInText", "board flight", "Text shown when interacting with the Check-In Kiosk");
			checkInName = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CheckInName", "GATE KIOSK", "Label name of the Check-In Kiosk");
			Harmony.CreateAndPatchAll(typeof(CustomKioskTextPlugin), (string)null);
			manager = PhotonCustomPropsUtilsPlugin.GetManager("tony4twentys.Custom_Kiosk_Prompts");
			manager.RegisterRoomProperty<string[]>("CustomKioskPrompts", (RoomEventType)0, (Action<string[]>)delegate(string[] value)
			{
				receivedPrompts = value;
				Debug.LogError((object)receivedPrompts);
			});
		}

		[HarmonyPatch(typeof(Character), "Awake")]
		[HarmonyPostfix]
		public static void CharacterAwakePatch()
		{
			if (PhotonNetwork.IsMasterClient)
			{
				string[] array = new string[4] { inviteText.Value, inviteName.Value, checkInText.Value, checkInName.Value };
				Instance.manager.SetRoomProperty("CustomKioskPrompts", (object)array);
				Instance.receivedPrompts = array;
			}
		}

		[HarmonyPatch(typeof(AirportInviteFriendsKiosk), "GetInteractionText")]
		[HarmonyPrefix]
		public static bool PatchInviteText(ref string __result)
		{
			__result = ((Instance.receivedPrompts == null) ? inviteText.Value : Instance.receivedPrompts[0]);
			return false;
		}

		[HarmonyPatch(typeof(AirportInviteFriendsKiosk), "GetName")]
		[HarmonyPrefix]
		public static bool PatchInviteName(ref string __result)
		{
			__result = ((Instance.receivedPrompts == null) ? inviteName.Value : Instance.receivedPrompts[1]);
			return false;
		}

		[HarmonyPatch(typeof(AirportCheckInKiosk), "GetInteractionText")]
		[HarmonyPrefix]
		public static bool PatchCheckInText(ref string __result)
		{
			__result = ((Instance.receivedPrompts == null) ? checkInText.Value : Instance.receivedPrompts[2]);
			return false;
		}

		[HarmonyPatch(typeof(AirportCheckInKiosk), "GetName")]
		[HarmonyPrefix]
		public static bool PatchCheckInName(ref string __result)
		{
			__result = ((Instance.receivedPrompts == null) ? checkInName.Value : Instance.receivedPrompts[3]);
			return false;
		}
	}
}