Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of PrivateLateJoin v0.1.6
PrivateLateJoin.dll
Decompiled 11 months agousing System; 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.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PrivateLateJoin")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1+c5a6ecc8097e980ebe2771921ee0093e4c1921ac")] [assembly: AssemblyProduct("PrivateLateJoin")] [assembly: AssemblyTitle("PrivateLateJoin")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.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 PrivateLateJoin { [BepInPlugin("dev.spindles.repo.privatelatejoin", "Private Late Join", "0.1.5")] public class Entry : BaseUnityPlugin { public const string modNamespace = "dev.spindles.repo.privatelatejoin"; public const string modName = "Private Late Join"; public const string modVersion = "0.1.5"; internal static readonly ManualLogSource logger = Logger.CreateLogSource("Private Late Join"); private static readonly FieldInfo removeFilterFieldInfo = AccessTools.Field(typeof(PhotonNetwork), "removeFilter"); private static readonly FieldInfo keyByteSevenFieldInfo = AccessTools.Field(typeof(PhotonNetwork), "keyByteSeven"); private static readonly FieldInfo serverCleanOptionsFieldInfo = AccessTools.Field(typeof(PhotonNetwork), "ServerCleanOptions"); private static readonly MethodInfo raiseEventInternalMethodInfo = AccessTools.Method(typeof(PhotonNetwork), "RaiseEventInternal", (Type[])null, (Type[])null); private static void RunManager_ChangeLevelHook(Action<RunManager, bool, bool, ChangeLevelType> orig, RunManager self, bool _completedLevel, bool _levelFailed, ChangeLevelType _changeLevelType) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (_levelFailed || !PhotonNetwork.IsMasterClient) { orig(self, _completedLevel, _levelFailed, _changeLevelType); return; } object value = AccessTools.Field(typeof(RunManager), "runManagerPUN").GetValue(self); object? value2 = AccessTools.Field(typeof(RunManagerPUN), "photonView").GetValue(value); PhotonView val = (PhotonView)((value2 is PhotonView) ? value2 : null); PhotonNetwork.RemoveBufferedRPCs(val.ViewID, (string)null, (int[])null); PhotonView[] array = Object.FindObjectsOfType<PhotonView>(); foreach (PhotonView val2 in array) { Scene scene = ((Component)val2).gameObject.scene; if (((Scene)(ref scene)).buildIndex != -1) { ClearPhotonCache(val2); } } orig(self, _completedLevel, arg3: false, _changeLevelType); bool flag = SemiFunc.RunIsLobbyMenu() || SemiFunc.RunIsLobby(); if (flag) { if (typeof(SteamManager).GetRuntimeMethod("UnlockLobby", new Type[1] { typeof(bool) }) != null) { typeof(SteamManager).GetRuntimeMethod("UnlockLobby", new Type[1] { typeof(bool) }).Invoke(SteamManager.instance, new object[1] { true }); } else { typeof(SteamManager).GetRuntimeMethod("UnlockLobby", Array.Empty<Type>())?.Invoke(SteamManager.instance, Array.Empty<object>()); } } else { SteamManager.instance.LockLobby(); } PhotonNetwork.CurrentRoom.IsOpen = flag; } private static void PlayerAvatar_SpawnHook(Action<PlayerAvatar, Vector3, Quaternion> orig, PlayerAvatar self, Vector3 position, Quaternion rotation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!(bool)AccessTools.Field(typeof(PlayerAvatar), "spawned").GetValue(self)) { orig(self, position, rotation); } } private static void LevelGenerator_StartHook(Action<LevelGenerator> orig, LevelGenerator self) { if ((PhotonNetwork.IsMasterClient && SemiFunc.RunIsShop()) || SemiFunc.RunIsLobby()) { PhotonNetwork.RemoveBufferedRPCs(self.PhotonView.ViewID, (string)null, (int[])null); } orig(self); } private static void PlayerAvatar_StartHook(Action<PlayerAvatar> orig, PlayerAvatar self) { orig(self); if ((PhotonNetwork.IsMasterClient || SemiFunc.RunIsLobby()) && SemiFunc.RunIsShop()) { self.photonView.RPC("LoadingLevelAnimationCompletedRPC", (RpcTarget)3, Array.Empty<object>()); } } private static void ClearPhotonCache(PhotonView photonView) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) object? value = removeFilterFieldInfo.GetValue(null); Hashtable val = (Hashtable)((value is Hashtable) ? value : null); object value2 = keyByteSevenFieldInfo.GetValue(null); object? value3 = serverCleanOptionsFieldInfo.GetValue(null); RaiseEventOptions val2 = (RaiseEventOptions)((value3 is RaiseEventOptions) ? value3 : null); val[value2] = photonView.InstantiationId; val2.CachingOption = (EventCaching)6; raiseEventInternalMethodInfo.Invoke(null, new object[4] { (byte)202, val, val2, SendOptions.SendReliable }); } private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) logger.LogDebug((object)"Hooking `RunManager.ChangeLevel`"); new Hook((MethodBase)AccessTools.Method(typeof(RunManager), "ChangeLevel", (Type[])null, (Type[])null), (Delegate)new Action<Action<RunManager, bool, bool, ChangeLevelType>, RunManager, bool, bool, ChangeLevelType>(RunManager_ChangeLevelHook)); logger.LogDebug((object)"Hooking `PlayerAvatar.Spawn`"); new Hook((MethodBase)AccessTools.Method(typeof(PlayerAvatar), "Spawn", (Type[])null, (Type[])null), (Delegate)new Action<Action<PlayerAvatar, Vector3, Quaternion>, PlayerAvatar, Vector3, Quaternion>(PlayerAvatar_SpawnHook)); logger.LogDebug((object)"Hooking `LevelGenerator.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(LevelGenerator), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<LevelGenerator>, LevelGenerator>(LevelGenerator_StartHook)); logger.LogDebug((object)"Hooking `PlayerAvatar.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(PlayerAvatar), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<PlayerAvatar>, PlayerAvatar>(PlayerAvatar_StartHook)); } } }