using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using Microsoft.CodeAnalysis;
using PEAKLib.UI;
using PEAKLib.UI.Elements;
using Photon.Pun;
using Photon.Realtime;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[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("PEAKInvitation")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("PEAKInvitation")]
[assembly: AssemblyTitle("PEAKInvitation")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace PEAKInvitation
{
internal static class NetworkEvents
{
internal const byte RequestKickToken = 19;
internal const byte RespondKickToken = 20;
internal const byte FinalKick = 21;
internal const byte InvalidCodeKick = 22;
}
[BepInPlugin("PEAKInvitation", "PEAK Invitation", "1.1.0")]
public class PEAKInvitation : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Func<bool> <>9__13_0;
public static UnityAction <>9__16_1;
public static UnityAction <>9__16_2;
public static Func<bool> <>9__19_0;
internal bool <AddPlayerComponents>b__13_0()
{
return (Object)(object)Player.localPlayer != (Object)null;
}
internal void <CreateInvitationPage>b__16_1()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
CSteamID val = default(CSteamID);
if (GameHandler.GetService<SteamLobbyHandler>().InSteamLobby(ref val))
{
string arg = "3527290";
string text2 = (GUIUtility.systemCopyBuffer = $"steam://joinlobby/{arg}/{val.m_SteamID}/{SteamUser.GetSteamID().m_SteamID}");
Log.LogInfo((object)("Copied lobby link to clipboard: " + text2));
}
else
{
Log.LogWarning((object)"Could not copy lobby link: Not currently in a Steam lobby.");
}
}
internal void <CreateInvitationPage>b__16_2()
{
if ((Object)(object)invitationPage != (Object)null)
{
((MenuWindow)invitationPage).Hide();
}
}
internal bool <CreateJoinButtonWhenMenuReady>b__19_0()
{
return (Object)(object)GameObject.Find("MainMenu/Canvas/MainPage/Menu/Buttons") != (Object)null;
}
}
[CompilerGenerated]
private sealed class <AddPlayerComponents>d__13 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public PEAKInvitation <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <AddPlayerComponents>d__13(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
Log.LogInfo((object)"AddPlayerComponents coroutine started.");
<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)Player.localPlayer != (Object)null));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Log.LogInfo((object)"Player.localPlayer found. Proceeding to add components.");
if (!PhotonNetwork.IsMasterClient && (Object)(object)((Component)Player.localPlayer).gameObject.GetComponent<InviteCodeVerifier>() == (Object)null)
{
if (!InviteCodeVerifier.IsLocallyVerifiedByRoomProperty())
{
Log.LogInfo((object)"Client is not MasterClient and not already verified. Adding InviteCodeVerifier...");
((Component)Player.localPlayer).gameObject.AddComponent<InviteCodeVerifier>();
}
else
{
Log.LogInfo((object)"Client already verified previously (room property present). Skipping InviteCodeVerifier.");
}
}
else if (PhotonNetwork.IsMasterClient)
{
Log.LogInfo((object)"Client is the MasterClient. Skipping InviteCodeVerifier.");
}
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <CreateJoinButtonWhenMenuReady>d__19 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public PEAKInvitation <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CreateJoinButtonWhenMenuReady>d__19(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Expected O, but got Unknown
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (<>4__this.isDisabled)
{
return false;
}
if ((Object)(object)GameObject.Find("Button_JoinWithCode") != (Object)null)
{
return false;
}
<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)GameObject.Find("MainMenu/Canvas/MainPage/Menu/Buttons") != (Object)null));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(2.5f);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>4__this.CreateJoinWithCodeButton();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <ModifyJoinWithCodeButton>d__21 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GameObject buttonObject;
public PEAKInvitation <>4__this;
private RectTransform <buttonRect>5__1;
private TextMeshProUGUI <buttonText>5__2;
private Button <buttonComponent>5__3;
private GameObject <lobbyBrowserButton>5__4;
private RectTransform <referenceRect>5__5;
private TextMeshProUGUI <referenceText>5__6;
private GameObject <nextLevelUI>5__7;
private RectTransform <nextLevelRect>5__8;
private float <verticalOffset>5__9;
private Vector2 <fineTuneOffset>5__10;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ModifyJoinWithCodeButton>d__21(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<buttonRect>5__1 = null;
<buttonText>5__2 = null;
<buttonComponent>5__3 = null;
<lobbyBrowserButton>5__4 = null;
<referenceRect>5__5 = null;
<referenceText>5__6 = null;
<nextLevelUI>5__7 = null;
<nextLevelRect>5__8 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Unknown result type (might be due to invalid IL or missing references)
//IL_0394: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
case 1:
{
<>1__state = -1;
((Object)buttonObject).name = "Button_JoinWithCode";
<buttonRect>5__1 = buttonObject.GetComponent<RectTransform>();
<buttonText>5__2 = buttonObject.GetComponentInChildren<TextMeshProUGUI>();
<buttonComponent>5__3 = buttonObject.GetComponentInChildren<Button>();
<lobbyBrowserButton>5__4 = GameObject.Find("Button_LobbyBrowser");
Rect rect;
if ((Object)(object)<lobbyBrowserButton>5__4 != (Object)null)
{
<referenceRect>5__5 = <lobbyBrowserButton>5__4.GetComponent<RectTransform>();
<buttonRect>5__1.anchorMin = <referenceRect>5__5.anchorMin;
<buttonRect>5__1.anchorMax = <referenceRect>5__5.anchorMax;
<buttonRect>5__1.pivot = <referenceRect>5__5.pivot;
RectTransform obj = <buttonRect>5__1;
Vector2 anchoredPosition = <referenceRect>5__5.anchoredPosition;
rect = <referenceRect>5__5.rect;
obj.anchoredPosition = anchoredPosition - new Vector2(0f, ((Rect)(ref rect)).height + 95f);
buttonObject.transform.localScale = <lobbyBrowserButton>5__4.transform.localScale;
<referenceText>5__6 = <lobbyBrowserButton>5__4.GetComponentInChildren<TextMeshProUGUI>();
if ((Object)(object)<buttonText>5__2 != (Object)null && (Object)(object)<referenceText>5__6 != (Object)null)
{
((TMP_Text)<buttonText>5__2).transform.localScale = ((TMP_Text)<referenceText>5__6).transform.localScale;
}
<referenceRect>5__5 = null;
<referenceText>5__6 = null;
}
else
{
<nextLevelUI>5__7 = GameObject.Find("MainMenu/Canvas/MainPage/NextLevelUI");
if ((Object)(object)<nextLevelUI>5__7 == (Object)null)
{
Log.LogFatal((object)"Could not find NextLevelUI to position the button.");
return false;
}
<nextLevelRect>5__8 = <nextLevelUI>5__7.GetComponent<RectTransform>();
<buttonRect>5__1.anchorMin = <nextLevelRect>5__8.anchorMin;
<buttonRect>5__1.anchorMax = <nextLevelRect>5__8.anchorMax;
<buttonRect>5__1.pivot = new Vector2(0.5f, 0.5f);
rect = <nextLevelRect>5__8.rect;
<verticalOffset>5__9 = ((Rect)(ref rect)).height + 20f;
<fineTuneOffset>5__10 = new Vector2(-180f, -30f);
<buttonRect>5__1.anchoredPosition = <nextLevelRect>5__8.anchoredPosition - new Vector2(0f, <verticalOffset>5__9) + <fineTuneOffset>5__10;
buttonObject.transform.localScale = new Vector3(-1f, 1.3f, 1f);
if ((Object)(object)<buttonText>5__2 != (Object)null)
{
((TMP_Text)<buttonText>5__2).transform.localScale = new Vector3(-0.9f, 0.7f, 0.9f);
}
<nextLevelUI>5__7 = null;
<nextLevelRect>5__8 = null;
}
if ((Object)(object)<buttonText>5__2 != (Object)null)
{
((TMP_Text)<buttonText>5__2).text = "JOIN WITH CODE";
}
if ((Object)(object)<buttonComponent>5__3 != (Object)null)
{
((UnityEventBase)<buttonComponent>5__3.onClick).RemoveAllListeners();
((UnityEvent)<buttonComponent>5__3.onClick).AddListener((UnityAction)delegate
{
<>4__this.JoinLobbyFromClipboard();
});
}
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <PositionInviteButton>d__18 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public PeakMenuButton inviteButton;
public Transform backButton;
public PEAKInvitation <>4__this;
private Transform <parent>5__1;
private RectTransform <inviteButtonRect>5__2;
private GameObject <lobbySettingsButton>5__3;
private float <newYPosition>5__4;
private float <referenceXPosition>5__5;
private float <lobbySettingsY>5__6;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <PositionInviteButton>d__18(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<parent>5__1 = null;
<inviteButtonRect>5__2 = null;
<lobbySettingsButton>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<parent>5__1 = backButton.parent;
<inviteButtonRect>5__2 = ((Component)inviteButton).GetComponent<RectTransform>();
<lobbySettingsButton>5__3 = GameObject.Find("Button_LobbySettings");
<referenceXPosition>5__5 = 171f;
if ((Object)(object)<lobbySettingsButton>5__3 != (Object)null)
{
<lobbySettingsY>5__6 = -320f;
<newYPosition>5__4 = <lobbySettingsY>5__6 - 50f - 5f;
}
else
{
<newYPosition>5__4 = -300f;
}
<inviteButtonRect>5__2.anchoredPosition = new Vector2(<referenceXPosition>5__5, <newYPosition>5__4);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
internal static ManualLogSource Log;
public static string? usedInviteCode;
private static PeakCustomPage? invitationPage;
private static PeakTextInput? inviteCodeInput;
private bool isDisabled = false;
public static PEAKInvitation Instance { get; private set; }
private void Awake()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
Instance = this;
Log = Logger.CreateLogSource("PEAKInvitation");
GameObject val = new GameObject("PEAKInvitationNetworkManager");
val.AddComponent<KickReceiver>();
Object.DontDestroyOnLoad((Object)(object)val);
MenuAPI.AddToPauseMenu((BuilderDelegate)delegate(Transform parent)
{
CreateInviteButtonInPauseMenu(parent);
});
SceneManager.sceneLoaded += OnSceneLoaded;
Log.LogInfo((object)"PEAK Invitation Initialized!");
}
private void Start()
{
List<string> list = CheckForCheatingPlugins();
if (list.Count > 0)
{
string text = string.Join(", ", list);
Log.LogFatal((object)("!@!@! Disabling mod due to detected cheating plugin(s) !@!@! Please remove the following to use PEAKInvitation: " + text));
isDisabled = true;
}
}
private void OnDestroy()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (!isDisabled)
{
Log.LogInfo((object)("OnSceneLoaded triggered for scene: " + ((Scene)(ref scene)).name));
if (((Scene)(ref scene)).name == "Title")
{
((MonoBehaviour)this).StartCoroutine(CreateJoinButtonWhenMenuReady());
}
if (((Scene)(ref scene)).name == "Airport" || ((Scene)(ref scene)).name.StartsWith("Level_"))
{
Log.LogInfo((object)("Gameplay scene '" + ((Scene)(ref scene)).name + "' loaded. Starting AddPlayerComponents coroutine..."));
((MonoBehaviour)this).StartCoroutine(AddPlayerComponents());
}
}
}
[IteratorStateMachine(typeof(<AddPlayerComponents>d__13))]
private IEnumerator AddPlayerComponents()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <AddPlayerComponents>d__13(0)
{
<>4__this = this
};
}
private List<string> CheckForCheatingPlugins()
{
List<string> list = new List<string>();
List<string> list2 = new List<string>
{
"tony4twentys.So_Fly", "FlyMod", "com.lamia.flymod", "com.keklick1337.peak.advancedconsole", "com.quackandcheese.ItemSpawner", "PEAKGaming", "synq.peak.atlas", "com.github.enderspearl184.peakpseudonym", "Everything", "Cherry.Cherry",
"com.onigremlin.peakaio", "com.you.InjectZorroConsole"
};
foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
{
if (list2.Contains(pluginInfo.Value.Metadata.GUID) || list2.Contains(pluginInfo.Value.Metadata.Name))
{
list.Add(pluginInfo.Value.Metadata.Name + " (GUID: " + pluginInfo.Value.Metadata.GUID + ")");
}
}
return list;
}
private void OpenInvitationPage()
{
if (!isDisabled)
{
if ((Object)(object)invitationPage != (Object)null)
{
((MenuWindow)invitationPage).Show();
UIInputHandler.SetSelectedObject((GameObject)null);
}
else
{
Log.LogError((object)"Invitation page was not created before trying to open it!");
}
}
}
private void CreateInvitationPage()
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Expected O, but got Unknown
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Expected O, but got Unknown
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_0338: Unknown result type (might be due to invalid IL or missing references)
//IL_034c: Unknown result type (might be due to invalid IL or missing references)
//IL_037a: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Expected O, but got Unknown
if ((Object)(object)invitationPage != (Object)null)
{
return;
}
invitationPage = MenuAPI.CreatePageWithBackground("Invitation Page");
((Component)invitationPage).gameObject.AddComponent<InvitationPageManager>();
Canvas component = ((Component)invitationPage).GetComponent<Canvas>();
if ((Object)(object)component != (Object)null)
{
component.overrideSorting = true;
component.sortingOrder = 999;
}
ElementExtensions.SetPosition<PeakText>(ElementExtensions.SetPivot<PeakText>(ElementExtensions.SetAnchorMinMax<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText("PEAK INVITATION").SetFontSize(48f), ((Component)invitationPage).transform), new Vector2(0.5f, 1f)), new Vector2(0.5f, 1f)), new Vector2(0f, -50f));
inviteCodeInput = ElementExtensions.SetSize<PeakTextInput>(ElementExtensions.SetPosition<PeakTextInput>(ElementExtensions.SetPivot<PeakTextInput>(ElementExtensions.SetAnchorMinMax<PeakTextInput>(ElementExtensions.ParentTo<PeakTextInput>(MenuAPI.CreateTextInput("InviteCodeInput"), ((Component)invitationPage).transform), new Vector2(0.5f, 1f)), new Vector2(0.5f, 1f)), new Vector2(0f, -140f)), new Vector2(400f, 60f)).SetPlaceholder("Click 'Generate' to create a code...");
if ((Object)(object)inviteCodeInput != (Object)null)
{
inviteCodeInput.InputField.readOnly = true;
}
ElementExtensions.SetSize<PeakMenuButton>(ElementExtensions.SetPosition<PeakMenuButton>(ElementExtensions.SetPivot<PeakMenuButton>(ElementExtensions.SetAnchorMinMax<PeakMenuButton>(ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton("Generate & Copy Invite Code"), ((Component)invitationPage).transform), new Vector2(0.5f, 1f)), new Vector2(0.5f, 1f)), new Vector2(0f, -200f)), new Vector2(400f, 80f)).OnClick((UnityAction)delegate
{
GenerateAndCopyInviteCode(inviteCodeInput);
});
PeakMenuButton obj = ElementExtensions.SetSize<PeakMenuButton>(ElementExtensions.SetPosition<PeakMenuButton>(ElementExtensions.SetPivot<PeakMenuButton>(ElementExtensions.SetAnchorMinMax<PeakMenuButton>(ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton("Copy Steam Lobby Link"), ((Component)invitationPage).transform), new Vector2(0.5f, 1f)), new Vector2(0.5f, 1f)), new Vector2(0f, -270f)), new Vector2(400f, 80f));
object obj2 = <>c.<>9__16_1;
if (obj2 == null)
{
UnityAction val = delegate
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
CSteamID val4 = default(CSteamID);
if (GameHandler.GetService<SteamLobbyHandler>().InSteamLobby(ref val4))
{
string arg = "3527290";
string text2 = (GUIUtility.systemCopyBuffer = $"steam://joinlobby/{arg}/{val4.m_SteamID}/{SteamUser.GetSteamID().m_SteamID}");
Log.LogInfo((object)("Copied lobby link to clipboard: " + text2));
}
else
{
Log.LogWarning((object)"Could not copy lobby link: Not currently in a Steam lobby.");
}
};
<>c.<>9__16_1 = val;
obj2 = (object)val;
}
obj.OnClick((UnityAction)obj2);
PeakMenuButton obj3 = ElementExtensions.SetSize<PeakMenuButton>(ElementExtensions.SetPosition<PeakMenuButton>(ElementExtensions.SetPivot<PeakMenuButton>(ElementExtensions.SetAnchorMinMax<PeakMenuButton>(ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton("Close"), ((Component)invitationPage).transform), new Vector2(0.5f, 0f)), new Vector2(0.5f, 0f)), new Vector2(0f, 75f)), new Vector2(250f, 70f));
object obj4 = <>c.<>9__16_2;
if (obj4 == null)
{
UnityAction val2 = delegate
{
if ((Object)(object)invitationPage != (Object)null)
{
((MenuWindow)invitationPage).Hide();
}
};
<>c.<>9__16_2 = val2;
obj4 = (object)val2;
}
obj3.OnClick((UnityAction)obj4);
ElementExtensions.SetPosition<PeakText>(ElementExtensions.SetPivot<PeakText>(ElementExtensions.SetAnchorMinMax<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText("Players in Lobby").SetFontSize(36f), ((Component)invitationPage).transform), new Vector2(0.5f, 0.5f)), new Vector2(0.5f, 0.5f)), new Vector2(0f, 150f));
PeakScrollableContent val3 = ElementExtensions.SetSize<PeakScrollableContent>(ElementExtensions.SetPosition<PeakScrollableContent>(ElementExtensions.SetPivot<PeakScrollableContent>(ElementExtensions.SetAnchorMinMax<PeakScrollableContent>(ElementExtensions.ParentTo<PeakScrollableContent>(MenuAPI.CreateScrollableContent("PlayerScrollView"), ((Component)invitationPage).transform), new Vector2(0.5f, 0.5f)), new Vector2(0.5f, 0.5f)), new Vector2(0f, -75f)), new Vector2(400f, 350f));
((Object)val3.Content).name = "PlayerListContent";
VerticalLayoutGroup component2 = ((Component)val3.Content).GetComponent<VerticalLayoutGroup>();
if (component2 != null)
{
Object.Destroy((Object)(object)component2);
}
ContentSizeFitter component3 = ((Component)val3.Content).GetComponent<ContentSizeFitter>();
if (component3 != null)
{
Object.Destroy((Object)(object)component3);
}
}
private void CreateInviteButtonInPauseMenu(Transform backButton)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
if (isDisabled)
{
return;
}
try
{
if ((Object)(object)invitationPage == (Object)null)
{
CreateInvitationPage();
}
Transform parent = backButton.parent;
PeakMenuButton val = ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreatePauseMenuButton("INVITATION"), parent).OnClick((UnityAction)delegate
{
OpenInvitationPage();
});
((Object)((Component)val).gameObject).name = "Button_InviteFriends";
((MonoBehaviour)this).StartCoroutine(PositionInviteButton(val, backButton));
}
catch (Exception ex)
{
Log.LogFatal((object)("Failed to create invite button in pause menu: " + ex.Message));
}
}
[IteratorStateMachine(typeof(<PositionInviteButton>d__18))]
private IEnumerator PositionInviteButton(PeakMenuButton inviteButton, Transform backButton)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <PositionInviteButton>d__18(0)
{
<>4__this = this,
inviteButton = inviteButton,
backButton = backButton
};
}
[IteratorStateMachine(typeof(<CreateJoinButtonWhenMenuReady>d__19))]
private IEnumerator CreateJoinButtonWhenMenuReady()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CreateJoinButtonWhenMenuReady>d__19(0)
{
<>4__this = this
};
}
private void CreateJoinWithCodeButton()
{
try
{
GameObject val = GameObject.Find("MainMenu/Canvas/MainPage/Menu/Buttons/Button_PlaySolo");
GameObject val2 = GameObject.Find("MainMenu/Canvas/MainPage");
if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
{
Log.LogFatal((object)"Could not find the original button or parent for the Join button.");
return;
}
GameObject val3 = Object.Instantiate<GameObject>(val, val2.transform);
val3.SetActive(true);
Animator component = val3.GetComponent<Animator>();
if ((Object)(object)component != (Object)null)
{
component.Play("Normal");
}
((MonoBehaviour)this).StartCoroutine(ModifyJoinWithCodeButton(val3));
}
catch (Exception ex)
{
Log.LogFatal((object)("Failed to build Join with Code button: " + ex.Message));
}
}
[IteratorStateMachine(typeof(<ModifyJoinWithCodeButton>d__21))]
private IEnumerator ModifyJoinWithCodeButton(GameObject buttonObject)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ModifyJoinWithCodeButton>d__21(0)
{
<>4__this = this,
buttonObject = buttonObject
};
}
private void GenerateAndCopyInviteCode(PeakTextInput inviteCodeInput)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Expected O, but got Unknown
//IL_0103: Expected O, but got Unknown
if (isDisabled)
{
return;
}
Log.LogInfo((object)"'Generate & Copy' button clicked.");
CSteamID val = default(CSteamID);
if (GameHandler.GetService<SteamLobbyHandler>().InSteamLobby(ref val))
{
byte[] bytes = BitConverter.GetBytes(val.m_SteamID);
byte[] array = new byte[4];
new Random().NextBytes(array);
byte[] array2 = new byte[12];
Buffer.BlockCopy(array, 0, array2, 0, 2);
Buffer.BlockCopy(bytes, 0, array2, 2, 8);
Buffer.BlockCopy(array, 2, array2, 10, 2);
string text2 = (GUIUtility.systemCopyBuffer = Convert.ToBase64String(array2));
if ((Object)(object)inviteCodeInput != (Object)null)
{
inviteCodeInput.InputField.text = text2;
}
Log.LogInfo((object)("Generated and copied invite code: " + text2));
if (PhotonNetwork.IsMasterClient && PhotonNetwork.InRoom)
{
Log.LogInfo((object)"Host is in a room. Attempting to set custom room property...");
Hashtable val2 = new Hashtable();
((Dictionary<object, object>)val2).Add((object)"invite_code", (object)text2);
Hashtable val3 = val2;
PhotonNetwork.CurrentRoom.SetCustomProperties(val3, (Hashtable)null, (WebFlags)null);
Log.LogInfo((object)("'invite_code' property set to: " + text2));
}
else
{
Log.LogWarning((object)"Host is NOT in a room or is not the MasterClient. 'invite_code' property was NOT set.");
}
}
else
{
if ((Object)(object)inviteCodeInput != (Object)null)
{
inviteCodeInput.InputField.text = "";
inviteCodeInput.SetPlaceholder("Error: Must be in a lobby to generate a code.");
}
Log.LogWarning((object)"Could not generate invite code: Not in a Steam lobby.");
}
}
private void JoinLobbyFromClipboard()
{
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
if (isDisabled)
{
return;
}
string systemCopyBuffer = GUIUtility.systemCopyBuffer;
if (string.IsNullOrWhiteSpace(systemCopyBuffer))
{
Log.LogWarning((object)"Clipboard is empty, cannot join.");
return;
}
systemCopyBuffer = systemCopyBuffer.Trim();
ulong result = 0uL;
bool flag = false;
if (systemCopyBuffer.StartsWith("steam://joinlobby/"))
{
string[] array = systemCopyBuffer.Split('/');
if (array.Length >= 5 && ulong.TryParse(array[4], out result))
{
Log.LogInfo((object)$"Parsed Steam lobby link from clipboard. Lobby ID: {result}");
}
}
else
{
try
{
byte[] array2 = Convert.FromBase64String(systemCopyBuffer);
if (array2.Length == 12)
{
byte[] array3 = new byte[8];
Buffer.BlockCopy(array2, 2, array3, 0, 8);
result = BitConverter.ToUInt64(array3, 0);
flag = true;
Log.LogInfo((object)$"Parsed PEAK invite code from clipboard. Lobby ID: {result}");
}
}
catch (FormatException)
{
}
if (result == 0L && ulong.TryParse(systemCopyBuffer, out result))
{
Log.LogInfo((object)$"Parsed raw lobby ID from clipboard: {result}");
}
}
if (result != 0)
{
if (flag)
{
usedInviteCode = systemCopyBuffer;
Log.LogInfo((object)("Set usedInviteCode to: " + usedInviteCode + " for host verification."));
}
else
{
usedInviteCode = null;
}
Log.LogInfo((object)$"Attempting to join lobby from parsed ID: {result}");
CSteamID val = default(CSteamID);
((CSteamID)(ref val))..ctor(result);
GameHandler.GetService<SteamLobbyHandler>().TryJoinLobby(val);
}
else
{
Log.LogError((object)("Failed to join: Clipboard content '" + systemCopyBuffer + "' is not a valid invite code, Steam link, or lobby ID."));
}
}
}
public class InvitationPageManager : MonoBehaviour
{
private bool useSimulatedPlayers = false;
private Transform? playerListContent;
private int playerCount = -1;
private PeakCustomPage? _page;
private void Awake()
{
_page = ((Component)this).GetComponent<PeakCustomPage>();
}
private void OnEnable()
{
Transform val = ((Component)this).transform.Find("PlayerScrollView");
if ((Object)(object)val != (Object)null)
{
PeakScrollableContent component = ((Component)val).GetComponent<PeakScrollableContent>();
playerListContent = (Transform?)(object)((component != null) ? component.Content : null);
}
UpdatePlayerList();
}
private void Update()
{
if (!useSimulatedPlayers && ((Component)this).gameObject.activeInHierarchy && PhotonNetwork.InRoom && PhotonNetwork.PlayerList.Length != playerCount)
{
UpdatePlayerList();
}
if ((Object)(object)_page != (Object)null && Input.GetKeyDown((KeyCode)27))
{
((MenuWindow)_page).Hide();
}
}
private void ClearPlayerList()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
if ((Object)(object)playerListContent == (Object)null)
{
return;
}
foreach (Transform item in playerListContent)
{
Transform val = item;
Object.Destroy((Object)(object)((Component)val).gameObject);
}
}
private void UpdatePlayerList()
{
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)playerListContent == (Object)null)
{
return;
}
ClearPlayerList();
bool flag = PhotonNetwork.IsMasterClient && PhotonNetwork.InRoom;
((Component)playerListContent.parent.parent).gameObject.SetActive(flag);
List<Player> list = new List<Player>();
int num = 0;
if (!flag)
{
return;
}
if (useSimulatedPlayers)
{
for (int i = 0; i < 12; i++)
{
CreatePlayerEntry(null, i, 45f, 5f, $"SimulatedPlayer{i + 1}");
num++;
}
}
else
{
playerCount = PhotonNetwork.PlayerList.Length;
Player[] playerList = PhotonNetwork.PlayerList;
foreach (Player val in playerList)
{
if (!val.IsLocal)
{
list.Add(val);
}
}
for (int k = 0; k < list.Count; k++)
{
CreatePlayerEntry(list[k], k, 45f, 5f);
num++;
}
}
float num2 = (float)num * 50f;
((Component)playerListContent).GetComponent<RectTransform>().sizeDelta = new Vector2(((Component)playerListContent).GetComponent<RectTransform>().sizeDelta.x, num2);
}
private void CreatePlayerEntry(Player? player, int index, float rowHeight, float spacing, string? simulatedName = null)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Expected O, but got Unknown
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
Player player2 = player;
Player obj = player2;
string text = ((obj != null) ? obj.NickName : null) ?? simulatedName ?? "Unknown";
if ((Object)(object)playerListContent == (Object)null)
{
return;
}
GameObject val = new GameObject("PlayerEntry_" + text);
RectTransform val2 = val.AddComponent<RectTransform>();
((Transform)val2).SetParent(playerListContent, false);
val2.anchorMin = new Vector2(0f, 1f);
val2.anchorMax = new Vector2(1f, 1f);
val2.pivot = new Vector2(0.5f, 1f);
val2.sizeDelta = new Vector2(0f, rowHeight);
val2.anchoredPosition = new Vector2(0f, (float)(-index) * (rowHeight + spacing));
PeakMenuButton val3 = ElementExtensions.SetSize<PeakMenuButton>(ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton("Kick"), val.transform), new Vector2(120f, 40f));
if (player2 != null)
{
val3.OnClick((UnityAction)delegate
{
KickPlayer(player2);
});
}
else
{
((Selectable)val3.Button).interactable = false;
}
RectTransform component = ((Component)val3).GetComponent<RectTransform>();
component.anchorMin = new Vector2(0f, 0.5f);
component.anchorMax = new Vector2(0f, 0.5f);
component.pivot = new Vector2(0f, 0.5f);
component.anchoredPosition = new Vector2(10f, 0f);
string text2 = text;
if (text2.Length > 18)
{
text2 = text2.Substring(0, 18).Trim() + "...";
}
PeakText val4 = ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText(text2), val.transform).SetFontSize(26f);
RectTransform component2 = ((Component)val4).GetComponent<RectTransform>();
component2.anchorMin = new Vector2(0f, 0.5f);
component2.anchorMax = new Vector2(1f, 0.5f);
component2.pivot = new Vector2(0f, 0.5f);
component2.offsetMin = new Vector2(135f, 0f);
component2.offsetMax = new Vector2(0f, 0f);
((TMP_Text)val4.TextMesh).alignment = (TextAlignmentOptions)4097;
}
private void KickPlayer(Player playerToKick)
{
if (PhotonNetwork.IsMasterClient && playerToKick != null)
{
KickReceiver.InitiateKick(playerToKick);
}
}
}
public class KickReceiver : MonoBehaviour
{
private static string _secretKickToken = "";
private static int _pendingKickActorNumber = -1;
public static void InitiateKick(Player playerToKick)
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Expected O, but got Unknown
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
if (!PhotonNetwork.IsMasterClient)
{
PEAKInvitation.Log.LogWarning((object)"A non-host client attempted to initiate a kick.");
return;
}
if (_pendingKickActorNumber != -1)
{
PEAKInvitation.Log.LogWarning((object)$"Cannot initiate a new kick for player {playerToKick.ActorNumber}. A kick for player {_pendingKickActorNumber} is already in progress.");
return;
}
PEAKInvitation.Log.LogInfo((object)$"Host is initiating kick for player {playerToKick.NickName} ({playerToKick.ActorNumber}).");
_pendingKickActorNumber = playerToKick.ActorNumber;
object[] array = new object[1] { playerToKick.ActorNumber };
RaiseEventOptions val = new RaiseEventOptions
{
Receivers = (ReceiverGroup)1
};
PhotonNetwork.RaiseEvent((byte)19, (object)array, val, SendOptions.SendReliable);
}
private void OnEnable()
{
PhotonNetwork.NetworkingClient.EventReceived += OnEventReceived;
}
private void OnDisable()
{
PhotonNetwork.NetworkingClient.EventReceived -= OnEventReceived;
}
private void OnEventReceived(EventData photonEvent)
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Expected O, but got Unknown
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Expected O, but got Unknown
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_0346: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Expected O, but got Unknown
//IL_035c: Expected O, but got Unknown
switch (photonEvent.Code)
{
case 19:
if (photonEvent.Sender == PhotonNetwork.MasterClient.ActorNumber)
{
object[] array4 = (object[])photonEvent.CustomData;
int num3 = (int)array4[0];
if (num3 == PhotonNetwork.LocalPlayer.ActorNumber)
{
PEAKInvitation.Log.LogInfo((object)"Received kick token request from host. Generating and sending token.");
_secretKickToken = Guid.NewGuid().ToString();
object[] array5 = new object[2]
{
PhotonNetwork.LocalPlayer.ActorNumber,
_secretKickToken
};
RaiseEventOptions val4 = new RaiseEventOptions();
val4.TargetActors = new int[1] { PhotonNetwork.MasterClient.ActorNumber };
RaiseEventOptions val5 = val4;
PhotonNetwork.RaiseEvent((byte)20, (object)array5, val5, SendOptions.SendReliable);
}
}
break;
case 20:
if (PhotonNetwork.IsMasterClient)
{
object[] array2 = (object[])photonEvent.CustomData;
int num2 = (int)array2[0];
string text3 = (string)array2[1];
if (num2 != _pendingKickActorNumber)
{
PEAKInvitation.Log.LogWarning((object)$"Received an unsolicited kick token from client {num2} while expecting one from {_pendingKickActorNumber}. Ignoring.");
break;
}
PEAKInvitation.Log.LogInfo((object)$"Received kick token from client {num2}. Sending final kick event.");
object[] array3 = new object[2] { num2, text3 };
RaiseEventOptions val3 = new RaiseEventOptions
{
Receivers = (ReceiverGroup)1
};
PhotonNetwork.RaiseEvent((byte)21, (object)array3, val3, SendOptions.SendReliable);
_pendingKickActorNumber = -1;
}
break;
case 21:
{
if (photonEvent.Sender != PhotonNetwork.MasterClient.ActorNumber)
{
break;
}
object[] array6 = (object[])photonEvent.CustomData;
int num4 = (int)array6[0];
string text4 = (string)array6[1];
if (num4 == PhotonNetwork.LocalPlayer.ActorNumber)
{
if (text4 == _secretKickToken && !string.IsNullOrEmpty(text4))
{
PEAKInvitation.Log.LogFatal((object)"Received valid kick event with matching token. Disconnecting...");
_secretKickToken = "";
GameHandler.GetService<SteamLobbyHandler>().LeaveLobby();
PhotonNetwork.Disconnect();
}
else
{
PEAKInvitation.Log.LogWarning((object)"Received kick event with invalid token. Ignoring.");
}
}
break;
}
case 22:
{
if (!PhotonNetwork.IsMasterClient)
{
break;
}
object[] array = (object[])photonEvent.CustomData;
if (array.Length < 2)
{
PEAKInvitation.Log.LogWarning((object)"Invalid verification request payload.");
break;
}
int num = (int)array[0];
string text = (string)array[1];
object value;
string text2 = (((Dictionary<object, object>)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"invite_code", out value) ? (value as string) : null);
if (!string.IsNullOrEmpty(text2) && text == text2)
{
PEAKInvitation.Log.LogInfo((object)$"Client {num} passed invite code verification. Marking verified.");
Hashtable val = new Hashtable();
((Dictionary<object, object>)val).Add((object)InviteCodeVerifier.VerifiedKeyFor(num), (object)true);
Hashtable val2 = val;
PhotonNetwork.CurrentRoom.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null);
}
else
{
PEAKInvitation.Log.LogWarning((object)$"Client {num} provided invalid invite code. Initiating secure kick.");
Player player = PhotonNetwork.CurrentRoom.GetPlayer(num, false);
if (player != null)
{
InitiateKick(player);
}
}
break;
}
}
}
}
public class InviteCodeVerifier : MonoBehaviour
{
private bool hasVerifiedCode = false;
private float verificationDelay = 1f;
public static string VerifiedKeyFor(int actorNumber)
{
return $"verified_{actorNumber}";
}
public static bool IsLocallyVerifiedByRoomProperty()
{
if (!PhotonNetwork.InRoom)
{
return false;
}
string key = VerifiedKeyFor(PhotonNetwork.LocalPlayer.ActorNumber);
bool flag = default(bool);
int num;
if (((Dictionary<object, object>)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)key, out object value))
{
if (value is bool)
{
flag = (bool)value;
num = 1;
}
else
{
num = 0;
}
}
else
{
num = 0;
}
if (((uint)num & (flag ? 1u : 0u)) != 0)
{
return true;
}
return false;
}
private void Awake()
{
PEAKInvitation.Log.LogInfo((object)"InviteCodeVerifier component has been added to the player.");
}
private void Update()
{
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
if (verificationDelay > 0f)
{
verificationDelay -= Time.deltaTime;
}
else if (!PhotonNetwork.InRoom)
{
hasVerifiedCode = false;
}
else
{
if (PhotonNetwork.IsMasterClient)
{
return;
}
if (IsLocallyVerifiedByRoomProperty())
{
PEAKInvitation.Log.LogInfo((object)"Already marked verified by host. Disabling InviteCodeVerifier.");
Object.Destroy((Object)(object)this);
}
else if (!hasVerifiedCode)
{
hasVerifiedCode = true;
PEAKInvitation.Log.LogInfo((object)"InviteCodeVerifier sending one-time verification request to host...");
if (!string.IsNullOrEmpty(PEAKInvitation.usedInviteCode))
{
object[] array = new object[2]
{
PhotonNetwork.LocalPlayer.ActorNumber,
PEAKInvitation.usedInviteCode
};
RaiseEventOptions val = new RaiseEventOptions();
val.TargetActors = new int[1] { PhotonNetwork.MasterClient.ActorNumber };
RaiseEventOptions val2 = val;
PhotonNetwork.RaiseEvent((byte)22, (object)array, val2, SendOptions.SendReliable);
}
else
{
PEAKInvitation.Log.LogWarning((object)"No invite code present on client when requesting verification.");
}
}
}
}
}
public class EventComponent : MonoBehaviour
{
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}