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 NoSecondChances v1.0.0
NoSecondChances.dll
Decompiled 9 months agousing System; 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.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; 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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoSecondChances")] [assembly: AssemblyTitle("NoSecondChances")] [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 Omniscye.CursedHardcore { internal static class HardcoreConfig { internal static readonly HashSet<int> AlreadyBooted = new HashSet<int>(); internal static readonly Random Rng = new Random(); internal static string LastRoomName = null; private static readonly string[] Quips = new string[30] { "{player} discovered the speedrun to main menu.", "{player} ordered a one-way ticket to LobbyLand.", "{player} got outplayed by gravity.", "{player} collected the rare 'skill issue' debuff.", "{player} failed the vibe check.", "{player} respawned in menu. Legend.", "{player} touched grass (kicked).", "{player} became a cautionary tale.", "{player} challenged the floor and lost.", "{player} tried living. Patch notes say: not today.", "{player} forgot their parachute.", "{player} met the floor at terminal velocity.", "{player} got de-partied for science.", "{player} found the surrender button.", "{player} alt-F4'd via reality.", "{player} achieved the rare 'spectator' role.", "{player} took a vacation to Title Screen.", "{player} was voted off by physics.", "{player} experienced sudden lobby syndrome.", "{player} ate a damage sandwich.", "{player} got clowned by an NPC.", "{player} failed the tutorial called 'don't die'.", "{player} rolled credits, unskippable.", "{player} went to time-out with the menu music.", "{player} got combo'd by lag and hubris.", "{player} has left the chat, violently.", "{player} speedran the exit category.", "{player} became a patch note.", "{player} unlocked the lobby wallpaper.", "{player} was last seen in Main Menu." }; internal static string Quip(string playerDisplay) { try { int num = Rng.Next(Quips.Length); return Quips[num].Replace("{player}", playerDisplay ?? "Someone"); } catch { return (playerDisplay ?? "Someone") + " died and got kicked."; } } } internal static class Loader { private const string HarmonyId = "omniscye.hardcore.cursed"; [RuntimeInitializeOnLoadMethod(/*Could not decode attribute arguments.*/)] private static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown try { Harmony val = new Harmony("omniscye.hardcore.cursed"); val.PatchAll(typeof(Loader).Assembly); PhotonNetwork.AddCallbackTarget((object)HardcorePhotonCallbacks.Instance); Debug.Log((object)"[OMNISCYE-HARDCORE] LOADED. IF YOU DIE, YOU FLY. HOST IS UNTOUCHABLE. <3 (Callbacks armed)"); } catch (Exception ex) { Debug.LogError((object)("[OMNISCYE-HARDCORE] FAILED TO PATCH BECAUSE GREMLINS: " + ex)); } } } internal sealed class HardcorePhotonCallbacks : IMatchmakingCallbacks { internal static readonly HardcorePhotonCallbacks Instance = new HardcorePhotonCallbacks(); private HardcorePhotonCallbacks() { } public void OnJoinedRoom() { HardcoreConfig.AlreadyBooted.Clear(); Debug.Log((object)"[OMNISCYE-HARDCORE] RESET BOOT CACHE — NEW ROOM, NEW SINS."); } public void OnLeftRoom() { HardcoreConfig.AlreadyBooted.Clear(); Debug.Log((object)"[OMNISCYE-HARDCORE] PURGED BOOT CACHE ON LEAVE — CLEAN SLATE."); } public void OnCreatedRoom() { } public void OnCreateRoomFailed(short returnCode, string message) { } public void OnFriendListUpdate(List<FriendInfo> friendList) { } public void OnJoinRandomFailed(short returnCode, string message) { } public void OnJoinRoomFailed(short returnCode, string message) { } } [HarmonyPatch(typeof(PlayerAvatar), "PlayerDeathRPC")] internal static class Patch_PlayerAvatar_PlayerDeathRPC_KickOnDeath { private static void Postfix(PlayerAvatar __instance) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) try { if (!PhotonNetwork.IsConnected || !PhotonNetwork.InRoom || !PhotonNetwork.IsMasterClient) { return; } PhotonView val = __instance?.photonView; if ((Object)(object)val == (Object)null) { return; } int ownerActorNr = val.OwnerActorNr; if (ownerActorNr <= 0) { return; } if (PhotonNetwork.MasterClient != null && ownerActorNr == PhotonNetwork.MasterClient.ActorNumber) { Debug.Log((object)"[OMNISCYE-HARDCORE] LOL NICE TRY — HOST IS IMMUNE TO KICKS."); return; } try { string text = ((PhotonNetwork.CurrentRoom != null) ? PhotonNetwork.CurrentRoom.Name : null); if (!string.Equals(text, HardcoreConfig.LastRoomName, StringComparison.Ordinal)) { HardcoreConfig.AlreadyBooted.Clear(); HardcoreConfig.LastRoomName = text ?? string.Empty; Debug.Log((object)"[OMNISCYE-HARDCORE] DETECTED NEW ROOM — RESET BOOT CACHE."); } } catch { } if (!HardcoreConfig.AlreadyBooted.Add(ownerActorNr)) { return; } RaiseEventOptions val2 = new RaiseEventOptions(); val2.TargetActors = new int[1] { ownerActorNr }; RaiseEventOptions val3 = val2; PhotonNetwork.RaiseEvent((byte)199, (object)null, val3, SendOptions.SendReliable); Debug.Log((object)$"[OMNISCYE-HARDCORE] PLAYER #{ownerActorNr} DIED AND GOT YEETED. SKILL ISSUE."); try { string playerDisplay = ((val.Owner != null && !string.IsNullOrEmpty(val.Owner.NickName)) ? val.Owner.NickName : $"Player #{ownerActorNr}"); string text2 = HardcoreConfig.Quip(playerDisplay); ChatManager instance = ChatManager.instance; if (instance != null) { instance.ForceSendMessage("[Hardcore] " + text2); } } catch { } } catch (Exception ex) { Debug.LogError((object)("[OMNISCYE-HARDCORE] DEATH-KICK GREMLIN: " + ex)); } } } [HarmonyPatch(typeof(NetworkManager), "OnEventReceivedCustom")] internal static class Patch_NetworkManager_OnEventReceivedCustom_HostImmunity { private static bool Prefix(EventData photonEvent) { try { if (photonEvent == null) { return true; } if (photonEvent.Code == 199 && PhotonNetwork.IsMasterClient) { Debug.Log((object)"[OMNISCYE-HARDCORE] BLOCKED A KICK EVENT TARGETING HOST. NICE TRY, JESTER."); return false; } } catch (Exception ex) { Debug.LogError((object)("[OMNISCYE-HARDCORE] HOST IMMUNITY GREMLIN: " + ex)); } return true; } } } namespace NoSecondChances { [BepInPlugin("Omniscye.NoSecondChances", "NoSecondChances", "1.0")] public class NoSecondChances : BaseUnityPlugin { internal static NoSecondChances Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } }