using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour.HookGen;
using On;
using Photon.Pun;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Xerox.ExtendedPlayerNames")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExtendedPlayerNames")]
[assembly: AssemblyTitle("Xerox.ExtendedPlayerNames")]
[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.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;
}
}
[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 ExtendedPlayerNames
{
[ContentWarningPlugin("Xerox.ExtendedPlayerNames", "1.0.0", false)]
[BepInPlugin("Xerox.ExtendedPlayerNames", "ExtendedPlayerNames", "1.0.0")]
public class ExtendedPlayerNames : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static hook_EnterTerminal <0>__EnterTerminal;
public static hook_RunTerminal <1>__RunTerminal;
public static hook_SafetyCheckVisorText <2>__SafetyCheckVisorPatch;
public static hook_AddPlayer <3>__AddPlayer;
}
private static long lastBackspace;
public static ExtendedPlayerNames Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
HookAll();
Logger.LogInfo((object)"Xerox.ExtendedPlayerNames v1.0.0 has loaded!");
}
internal static void HookAll()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
Logger.LogDebug((object)"Hooking...");
object obj = <>O.<0>__EnterTerminal;
if (obj == null)
{
hook_EnterTerminal val = EnterTerminal;
<>O.<0>__EnterTerminal = val;
obj = (object)val;
}
PlayerCustomizer.EnterTerminal += (hook_EnterTerminal)obj;
object obj2 = <>O.<1>__RunTerminal;
if (obj2 == null)
{
hook_RunTerminal val2 = RunTerminal;
<>O.<1>__RunTerminal = val2;
obj2 = (object)val2;
}
PlayerCustomizer.RunTerminal += (hook_RunTerminal)obj2;
object obj3 = <>O.<2>__SafetyCheckVisorPatch;
if (obj3 == null)
{
hook_SafetyCheckVisorText val3 = SafetyCheckVisorPatch;
<>O.<2>__SafetyCheckVisorPatch = val3;
obj3 = (object)val3;
}
PlayerVisor.SafetyCheckVisorText += (hook_SafetyCheckVisorText)obj3;
object obj4 = <>O.<3>__AddPlayer;
if (obj4 == null)
{
hook_AddPlayer val4 = AddPlayer;
<>O.<3>__AddPlayer = val4;
obj4 = (object)val4;
}
PlayerHandler.AddPlayer += (hook_AddPlayer)obj4;
Logger.LogDebug((object)"Finished Hooking!");
}
private static void AddPlayer(orig_AddPlayer orig, PlayerHandler self, Player player)
{
orig.Invoke(self, player);
((TMP_Text)player.refs.visor.visorFaceText).enableWordWrapping = false;
}
private static string SafetyCheckVisorPatch(orig_SafetyCheckVisorText orig, PlayerVisor self, string text)
{
if (text.Length > 50)
{
text = text.Substring(0, 50);
}
for (int i = 0; i < self.bannedWords.Length; i++)
{
string pattern = self.bannedWords.GetValue(i).ToString();
if (Regex.IsMatch(text, pattern, RegexOptions.None))
{
text = Regex.Replace(text, pattern, "***", RegexOptions.None);
}
}
for (int j = 0; j < self.bannedCharacters.Count; j++)
{
char c = self.bannedCharacters[j];
if (text.Contains(c))
{
text = text.Replace(c, '*');
}
}
return text;
}
private static void EnterTerminal(orig_EnterTerminal orig, PlayerCustomizer self, PhotonView view)
{
orig.Invoke(self, view);
((TMP_Text)self.faceText).enableWordWrapping = false;
}
private static void RunTerminal(orig_RunTerminal orig, PlayerCustomizer self)
{
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown((KeyCode)13))
{
if (Input.GetKey((KeyCode)306))
{
self.view_g.RPC("RCP_SetFaceText", (RpcTarget)0, new object[1] { ((TMP_Text)self.faceText).text + "\n" });
}
else
{
self.applySound.Play(((Component)self).transform.position, false, 1f, (Transform)null);
self.view_g.RPC("RPCA_PlayerLeftTerminal", (RpcTarget)0, new object[1] { true });
}
return;
}
if (Input.GetKey((KeyCode)27))
{
self.backSound.Play(((Component)self).transform.position, false, 1f, (Transform)null);
self.view_g.RPC("RPCA_PlayerLeftTerminal", (RpcTarget)0, new object[1] { false });
return;
}
if (Input.GetKey((KeyCode)8))
{
if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - lastBackspace >= 150)
{
lastBackspace = DateTimeOffset.Now.ToUnixTimeMilliseconds();
self.backSound.Play(((Component)self).transform.position, false, 1f, (Transform)null);
if (((TMP_Text)self.faceText).text.Length != 0)
{
string text = ((TMP_Text)self.faceText).text.Substring(0, ((TMP_Text)self.faceText).text.Length - 1);
self.view_g.RPC("RCP_SetFaceText", (RpcTarget)0, new object[1] { text });
}
}
return;
}
if (Input.GetKeyDown((KeyCode)118) && (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)310)))
{
self.typeSound.Play(((Component)self).transform.position, false, 1f, (Transform)null);
self.view_g.RPC("RCP_SetFaceText", (RpcTarget)0, new object[1] { GUIUtility.systemCopyBuffer });
return;
}
if (Input.GetKeyDown((KeyCode)99) && (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)310)))
{
self.typeSound.Play(((Component)self).transform.position, false, 1f, (Transform)null);
GUIUtility.systemCopyBuffer = ((TMP_Text)self.faceText).text;
return;
}
string inputString = Input.inputString;
if (inputString.Length >= 1)
{
if (inputString.Length > 0)
{
self.typeSound.Play(((Component)self).transform.position, false, 1f, (Transform)null);
}
self.view_g.RPC("RCP_SetFaceText", (RpcTarget)0, new object[1] { ((TMP_Text)self.faceText).text + inputString[0] });
}
}
internal static void UnhookAll()
{
Logger.LogDebug((object)"Unhooking...");
HookEndpointManager.RemoveAllOwnedBy((object)Assembly.GetExecutingAssembly());
Logger.LogDebug((object)"Finished Unhooking!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Xerox.ExtendedPlayerNames";
public const string PLUGIN_NAME = "ExtendedPlayerNames";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}