Decompiled source of TheFoundingFarters CustomMoons v1.5.56
plugins/AtlasAbyss.dll
Decompiled 2 months agousing System; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AtlasAbyss.Patches; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; [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("AtlasAbyss")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("AtlasAbyss")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+d0f52e14bf546cdcac0b95a0f3af45400e14dd87")] [assembly: AssemblyProduct("AtlasAbyss")] [assembly: AssemblyTitle("AtlasAbyss")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AtlasAbyss { [Serializable] public class Config : SyncedInstance<Config> { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } public bool customPriceEnabled; public int moonPrice; public Config(ConfigFile cfg) { InitInstance(this); customPriceEnabled = cfg.Bind<bool>("General", "CustomPriceEnabled", false, "Enable this if you wish to configure the moons route price below.").Value; moonPrice = cfg.Bind<int>("General", "MoonPrice", 300, "The route price of the Atlas Abyss moon.").Value; } public static void RequestSync() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { SyncedInstance<Config>.MessageManager.SendNamedMessage("AtlasAbyss_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsHost) { return; } byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance<Config>.MessageManager.SendNamedMessage("AtlasAbyss_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { Plugin.Logger.LogDebug((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize)) { Plugin.Logger.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.Logger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<Config>.SyncInstance(data); Plugin.Logger.LogDebug((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //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 if (SyncedInstance<Config>.IsHost) { CustomMessagingManager messageManager = SyncedInstance<Config>.MessageManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("AtlasAbyss_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); SyncedInstance<Config>.Synced = true; return; } SyncedInstance<Config>.Synced = false; CustomMessagingManager messageManager2 = SyncedInstance<Config>.MessageManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } messageManager2.RegisterNamedMessageHandler("AtlasAbyss_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); RequestSync(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance<Config>.RevertSync(); } } [Serializable] public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; set; } public static T Instance { get; set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } } [BepInPlugin("AtlasAbyss", "AtlasAbyss", "1.0.0")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; public static ManualLogSource Logger; public static Config Config { get; internal set; } private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("AtlasAbyss"); Config = new Config(((BaseUnityPlugin)this).Config); _harmony.PatchAll(typeof(RoutePatches)); _harmony.PatchAll(typeof(Config)); Logger.LogDebug((object)"Plugin AtlasAbyss is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "AtlasAbyss"; public const string PLUGIN_NAME = "AtlasAbyss"; public const string PLUGIN_VERSION = "1.0.0"; } public static class MyPluginInfo { public const string PLUGIN_GUID = "AtlasAbyss"; public const string PLUGIN_NAME = "AtlasAbyss"; public const string PLUGIN_VERSION = "0.1.0"; } } namespace AtlasAbyss.Patches { [HarmonyPatch(typeof(Terminal))] public class RoutePatches { [HarmonyPatch("LoadNewNode")] [HarmonyPrefix] private static void LoadNewNodePatchBefore(ref TerminalNode node) { if (!SyncedInstance<Config>.Instance.customPriceEnabled) { return; } Terminal obj = Object.FindObjectOfType<Terminal>(); Plugin.Logger.LogDebug((object)((Object)node).name); CompatibleNoun[] compatibleNouns = obj.terminalNodes.allKeywords.First((TerminalKeyword terminalKeyword) => terminalKeyword.word == "route").compatibleNouns; foreach (CompatibleNoun val in compatibleNouns) { if (!((Object)(object)val.result == (Object)null) && ((Object)val.result).name == "atlas abyssRoute") { val.result.itemCost = SyncedInstance<Config>.Instance.moonPrice; } } } [HarmonyPatch("LoadNewNodeIfAffordable")] [HarmonyPrefix] private static void LoadNewNodeIfAffordablePatch(ref TerminalNode node) { if (SyncedInstance<Config>.Instance.customPriceEnabled) { Plugin.Logger.LogDebug((object)((Object)node).name); if (!((Object)(object)node == (Object)null) && !(((Object)node).name != "atlas abyssRouteConfirm")) { node.itemCost = Math.Abs(SyncedInstance<Config>.Instance.moonPrice); } } } } }
plugins/MentalHospital.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Graph; using HarmonyLib; using LethalLevelLoader; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering.HighDefinition; [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("MentalHospital")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MentalHospital")] [assembly: AssemblyTitle("MentalHospital")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MentalHospital { [BepInPlugin("MentalHospital", "MentalHospital", "1.0.0")] public class MentalHospitalDunGen : BaseUnityPlugin { [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPrefix] private static bool SetItemSpawnPoints(ref RuntimeDungeon ___dungeonGenerator) { string name = ((Object)DungeonManager.CurrentExtendedDungeonFlow).name; if (name != "HospitalExtendedDungeonFlow") { return true; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { Instance.mls.LogError((object)"Failed to get start of round instance. Scrap spawns may not work correctly."); return true; } Item val = instance.allItemsList.itemsList.Find((Item x) => x.itemName == "Bottles"); if ((Object)(object)val == (Object)null) { Instance.mls.LogError((object)"Failed to find bottle bin item for reference snatching; scrap spawn may be significantly lower than expected."); return true; } Item val2 = instance.allItemsList.itemsList.Find((Item x) => x.itemName == "Golden cup"); int num = 0; int num2 = 0; int num3 = 0; ItemGroup spawnableItems = val.spawnPositionTypes.Find((ItemGroup x) => ((Object)x).name == "GeneralItemClass"); ItemGroup val3 = val.spawnPositionTypes.Find((ItemGroup x) => ((Object)x).name == "TabletopItems"); ItemGroup spawnableItems2 = (ItemGroup)(((Object)(object)val2 == (Object)null) ? ((object)val3) : ((object)val2.spawnPositionTypes.Find((ItemGroup x) => ((Object)x).name == "SmallItems"))); RandomScrapSpawn[] array = Object.FindObjectsOfType<RandomScrapSpawn>(); RandomScrapSpawn[] array2 = array; foreach (RandomScrapSpawn val4 in array2) { switch (((Object)val4.spawnableItems).name) { case "GeneralItemClassDUMMY": val4.spawnableItems = spawnableItems; num++; break; case "TabletopItemsDUMMY": val4.spawnableItems = val3; num2++; break; case "SmallItemsDUMMY": val4.spawnableItems = spawnableItems2; num3++; break; } } Instance.mls.LogInfo((object)$"Totals for scrap replacement: General: {num}, Tabletop: {num2}, Small: {num3}"); if (num + num2 + num3 < 10) { Instance.mls.LogWarning((object)"Unusually low scrap spawn count; scrap may be sparse."); } return true; } } [HarmonyPatch(typeof(SteamValveHazard))] [HarmonyPatch("BurstValve")] public class BurstValveColorPatch { private static void Postfix(SteamValveHazard __instance) { //IL_0076: 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) string name = ((Object)DungeonManager.CurrentExtendedDungeonFlow).name; if (!(name == "HospitalExtendedDungeonFlow") || !configGreenFog.Value) { return; } string text = "749B3B"; Color albedo = default(Color); if (ColorUtility.TryParseHtmlString("#" + text, ref albedo)) { LocalVolumetricFog component = ((Component)__instance.fogAnimator).GetComponent<LocalVolumetricFog>(); if ((Object)(object)component != (Object)null) { ((Component)__instance.fogAnimator).GetComponent<LocalVolumetricFog>().parameters.albedo = albedo; } else { Debug.LogError((object)"LocalVolumetricFog component not found on fogAnimator."); } } else { Debug.LogError((object)("Invalid hexadecimal color value: " + text)); } } } [HarmonyPatch(typeof(SteamValveHazard))] [HarmonyPatch("Update")] public class SteamValveHazard_Update_Patch { private class SteamValveState { public float timeInsideFog = 0f; public float damageTimer = 0f; public bool isInsideFog = false; } private static readonly FieldInfo valveHasBurstField = AccessTools.Field(typeof(SteamValveHazard), "valveHasBurst"); private static readonly FieldInfo valveHasBeenRepairedField = AccessTools.Field(typeof(SteamValveHazard), "valveHasBeenRepaired"); private static Dictionary<int, SteamValveState> valveStates = new Dictionary<int, SteamValveState>(); [HarmonyPrefix] public static bool Prefix(SteamValveHazard __instance) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) bool flag = (bool)valveHasBurstField.GetValue(__instance); int instanceID = ((Object)__instance).GetInstanceID(); bool flag2 = (bool)valveHasBeenRepairedField.GetValue(__instance); string name = ((Object)DungeonManager.CurrentExtendedDungeonFlow).name; if (flag && name == "HospitalExtendedDungeonFlow" && !flag2 && configFogDamage.Value) { if (!valveStates.ContainsKey(instanceID)) { valveStates[instanceID] = new SteamValveState(); } SteamValveState steamValveState = valveStates[instanceID]; if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)__instance.valveAudio).transform.position) < 10f) { steamValveState.timeInsideFog += Time.deltaTime; if (steamValveState.timeInsideFog >= 5f && !steamValveState.isInsideFog) { steamValveState.isInsideFog = true; steamValveState.damageTimer = 0f; } if (steamValveState.isInsideFog) { steamValveState.damageTimer += Time.deltaTime; if (steamValveState.damageTimer >= 1f) { steamValveState.damageTimer = 0f; ApplyDamageToPlayer(); } } } else { steamValveState.timeInsideFog = 0f; steamValveState.damageTimer = 0f; steamValveState.isInsideFog = false; } return true; } return true; } private static void ApplyDamageToPlayer() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) GameNetworkManager.Instance.localPlayerController.DamagePlayer(5, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } private const string modGUID = "DantorMentalHospital"; private const string modName = "Dantor's Mental Hospital"; private const string modVersion = "1.2.0"; private static MentalHospitalDunGen Instance; private readonly Harmony harmony = new Harmony("Dantor's Mental Hospital"); public static ConfigEntry<int> configRarity; public static ConfigEntry<string> configMoons; public static ConfigEntry<bool> configGuaranteed; public static ConfigEntry<float> configMinSize; public static ConfigEntry<float> configMaxSize; public static ConfigEntry<float> configDynamicValue; public static ConfigEntry<bool> configDynamicToggle; public static ConfigEntry<bool> configGreenFog; public static ConfigEntry<bool> configFogDamage; internal ManualLogSource mls; public static AssetBundle Assets; private void Awake() { //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Expected O, but got Unknown //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Expected O, but got Unknown //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Expected O, but got Unknown //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Expected O, but got Unknown //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Expected O, but got Unknown //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Expected O, but got Unknown //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Expected O, but got Unknown //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Expected O, but got Unknown //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Expected O, but got Unknown //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } mls = Logger.CreateLogSource("MentalHospital"); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Assets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "hospitalbundle")); if ((Object)(object)Assets == (Object)null) { mls.LogError((object)"Failed to load DantorsMentalHospital assets."); return; } DungeonFlow val = Assets.LoadAsset<DungeonFlow>("Assets/Abandoned_Psychiatric_Hospitals/DunGen Data/HospitalFlow.asset"); if ((Object)(object)val == (Object)null) { mls.LogError((object)"Failed to load DantorsMentalHospital Dungeon Flow."); return; } configRarity = ((BaseUnityPlugin)this).Config.Bind<int>("General", "HospitalDefaultRarity", 100, new ConfigDescription("How rare it is for the mental hospital to be chosen. Higher values increases the chance of spawning the mental hospital. Vanillas' main dungeons use a value of 300. Google Weighted Random if you don't know how it works, as that's how Lethal Company rarities function.", (AcceptableValueBase)null, Array.Empty<object>())); configMoons = ((BaseUnityPlugin)this).Config.Bind<string>("General", "HospitalMoonsList", "Assurance@100,Vow@100,Offense@100,March@100,Rend@100,Dine@100,Titan@100,PsychSanctum@9999", new ConfigDescription("The moon(s) that the hospital can spawn on, in the form of a comma separated list of selectable level names and optionally a weight value by using an '@' and weight value after it (e.g. \"Titan@300,Dine,Rend@10,PsychSanctum@9999\")\nThe name matching is lenient and should pick it up if you use the terminal name or internal mod name. If no rarity is specified, the HospitalRarity parameter is used.\nThe following strings: \"all\", \"vanilla\", \"modded\", \"paid\", \"free\" are dynamic presets which add the dungeon to that specified group (string must only contain one of these, or a manual moon name list).\n", (AcceptableValueBase)null, Array.Empty<object>())); configGuaranteed = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "HospitalGuaranteed", false, new ConfigDescription("\nSet it to true to guarantee the interior to spawn on any moon you visit. It works in any case except when if you use list mode", (AcceptableValueBase)null, Array.Empty<object>())); configDynamicToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Size", "DynamicScaleToggle", true, new ConfigDescription("Enables the next 3 options. \nATTENTION: READ CAREFULLY HOW IT WORKS. This adjust the dungeon size accordingly to which moon you visit, it is recommended to let it on true\nDefault: true", (AcceptableValueBase)null, Array.Empty<object>())); configDynamicValue = ((BaseUnityPlugin)this).Config.Bind<float>("Size", "DynamicScaleValue", 0.8f, new ConfigDescription("If the DungeonMinSize/DungeonMaxSize is above or below the next two settings, the dungeon size multiplier will aproximate to the value between the moon's specific dungeon size and this value.\nExample 1: If set to 0, the dungeon size will not be higher than DungeonMaxSize.\nExample 2: If set to 0.5, the dungeon size will be between the DungeonMaxSize and the moon's dungeon size multiplier.\nExample 3: If Set To 1, the dungeon size will be the moon's dungeon size multiplier with no restrictions.\nATTENTION: It is recommended to let it at default value or lower, the closer to 1 the bigger the dungeon.\nDefault: 0.8", (AcceptableValueBase)null, Array.Empty<object>())); configMinSize = ((BaseUnityPlugin)this).Config.Bind<float>("Size", "DungeonMinSize", 0.5f, new ConfigDescription("Input the minimum's dungeon size multiplier.\nDefault: 0.5", (AcceptableValueBase)null, Array.Empty<object>())); configMaxSize = ((BaseUnityPlugin)this).Config.Bind<float>("Size", "DungeonMaxSize", 0.65f, new ConfigDescription("Input the maximum's dungeon size multiplier.\nDefault: 0.65", (AcceptableValueBase)null, Array.Empty<object>())); configGreenFog = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior Settings", "GreenFogToggle", true, new ConfigDescription("Sets the Hospital fog from steams valves to green, this is just an aesthetic change", (AcceptableValueBase)null, Array.Empty<object>())); configFogDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("Interior Settings", "FogDamageToggle", true, new ConfigDescription("Enables the damage over time if you are inside the fog for too long (It only works in the Mental Hospital)", (AcceptableValueBase)null, Array.Empty<object>())); ExtendedDungeonFlow val2 = ScriptableObject.CreateInstance<ExtendedDungeonFlow>(); val2.contentSourceName = "Dantors Mental Hospital"; val2.dungeonFlow = val; val2.dungeonDefaultRarity = configRarity.Value; int num = (configGuaranteed.Value ? 99999 : configRarity.Value); switch (configMoons.Value.ToLower()) { case "all": val2.dynamicLevelTagsList.Add(new StringWithRarity("Vanilla", num)); val2.dynamicLevelTagsList.Add(new StringWithRarity("Custom", num)); mls.LogInfo((object)"Registered DantorsMentalHospital dungeon for all moons."); break; case "vanilla": val2.manualContentSourceNameReferenceList.Add(new StringWithRarity("Lethal Company", num)); mls.LogInfo((object)"Registered DantorsMentalHospital dungeon for all vanilla moons."); break; case "modded": val2.manualContentSourceNameReferenceList.Add(new StringWithRarity("Custom", num)); mls.LogInfo((object)"Registered DantorsMentalHospital dungeon for all modded moons."); break; case "paid": val2.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(1f, 9999f), num)); mls.LogInfo((object)"Registered DantorsMentalHospital dungeon for all paid moons."); break; case "free": val2.dynamicRoutePricesList.Add(new Vector2WithRarity(new Vector2(0f, 0f), num)); mls.LogInfo((object)"Registered DantorsMentalHospital dungeon for all free moons."); break; default: { mls.LogInfo((object)"Registering DantorsMentalHospital dungeon for predefined moon list."); string[] array3 = configMoons.Value.Split(',', StringSplitOptions.RemoveEmptyEntries); List<StringWithRarity> list = new List<StringWithRarity>(); for (int k = 0; k < array3.Length; k++) { string[] array4 = array3[k].Split('@', StringSplitOptions.RemoveEmptyEntries); int num2 = array4.Length; int result; if (num2 > 2) { mls.LogError((object)("Invalid setup for moon rarity config: " + array3[k] + ". Skipping.")); } else if (num2 == 1) { mls.LogInfo((object)$"Registering DantorsMentalHospital dungeon for moon {array3[k]} at default rarity {num}"); list.Add(new StringWithRarity(array3[k], num)); } else if (!int.TryParse(array4[1], out result)) { mls.LogError((object)("Failed to parse rarity value for moon " + array4[0] + ": " + array4[1] + ". Skipping.")); } else { mls.LogInfo((object)$"Registering DantorsMentalHospital dungeon for moon {array3[k]} at rarity {result}"); list.Add(new StringWithRarity(array4[0], result)); } } val2.manualPlanetNameReferenceList = list; break; } } val2.dungeonDisplayName = "Mental Hospital"; val2.dungeonSizeMin = configMinSize.Value; val2.dungeonSizeMax = configMaxSize.Value; val2.dungeonSizeLerpPercentage = configDynamicValue.Value; val2.enableDynamicDungeonSizeRestriction = configDynamicToggle.Value; PatchedContent.RegisterExtendedDungeonFlow(val2); harmony.PatchAll(typeof(MentalHospitalDunGen)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(BurstValveColorPatch)); harmony.PatchAll(typeof(SteamValveHazard_Update_Patch)); mls.LogInfo((object)"DantorsMentalHospital DunGen for Lethal Company [Version 1.0.0] successfully loaded."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MentalHospital is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "MentalHospital"; public const string PLUGIN_NAME = "MentalHospital"; public const string PLUGIN_VERSION = "1.0.0"; } }
plugins/SCPCBDunGen.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; 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.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using LethalLevelLoader; using LobbyCompatibility.Attributes; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using On; using PiggyVarietyMod; using SCPCBDunGen.NetcodePatcher; using SCPCBDunGen.Patches; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SCPCBDunGen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("4.3.2.0")] [assembly: AssemblyInformationalVersion("4.3.2+d9a5728c48b5bd1ea41b9ff279e69953ce6e183f")] [assembly: AssemblyProduct("SCPCBDunGen")] [assembly: AssemblyTitle("SCPCBDunGen")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.3.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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 SCPCBDunGen { public class SCP914InputStore : NetworkBehaviour { public List<GameObject> lContainedObjects; private SCP914InputStore() { lContainedObjects = new List<GameObject>(); } private void OnTriggerEnter(Collider other) { if (((NetworkBehaviour)this).NetworkManager.IsServer) { SCPCBDunGen.Logger.LogInfo((object)("New thing entered input trigger: " + ((Object)((Component)other).gameObject).name + ".")); lContainedObjects.Add(((Component)other).gameObject); } } private void OnTriggerExit(Collider other) { if (((NetworkBehaviour)this).NetworkManager.IsServer) { SCPCBDunGen.Logger.LogInfo((object)("Thing has left input trigger: " + ((Object)((Component)other).gameObject).name + ".")); lContainedObjects.Remove(((Component)other).gameObject); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SCP914InputStore"; } } public class SCP914Converter : NetworkBehaviour { public enum SCP914Setting { ROUGH, COARSE, ONETOONE, FINE, VERYFINE } public SCP914InputStore InputStore; public Collider colliderOutput; public InteractTrigger SettingKnobTrigger; public GameObject SettingKnobPivot; public AudioSource SettingKnobSoundSrc; public InteractTrigger ActivateTrigger; public AudioSource ActivateAudioSrc; public AudioSource RefineAudioSrc; public Animator DoorIn; public Animator DoorOut; private readonly (SCP914Setting, float)[] SCP914SettingRotations = new(SCP914Setting, float)[5] { (SCP914Setting.ROUGH, 90f), (SCP914Setting.COARSE, 45f), (SCP914Setting.ONETOONE, 0f), (SCP914Setting.FINE, -45f), (SCP914Setting.VERYFINE, -90f) }; private Dictionary<Item, List<Item>>[] arItemMappings = new Dictionary<Item, List<Item>>[5] { new Dictionary<Item, List<Item>>(), new Dictionary<Item, List<Item>>(), new Dictionary<Item, List<Item>>(), new Dictionary<Item, List<Item>>(), new Dictionary<Item, List<Item>>() }; private Dictionary<EnemyType, List<EnemyType>>[] arEnemyMappings = new Dictionary<EnemyType, List<EnemyType>>[5] { new Dictionary<EnemyType, List<EnemyType>>(), new Dictionary<EnemyType, List<EnemyType>>(), new Dictionary<EnemyType, List<EnemyType>>(), new Dictionary<EnemyType, List<EnemyType>>(), new Dictionary<EnemyType, List<EnemyType>>() }; private Dictionary<Item, List<EnemyType>>[] arItemEnemyMappings = new Dictionary<Item, List<EnemyType>>[5] { new Dictionary<Item, List<EnemyType>>(), new Dictionary<Item, List<EnemyType>>(), new Dictionary<Item, List<EnemyType>>(), new Dictionary<Item, List<EnemyType>>(), new Dictionary<Item, List<EnemyType>>() }; private Dictionary<EnemyType, List<Item>>[] arEnemyItemMappings = new Dictionary<EnemyType, List<Item>>[5] { new Dictionary<EnemyType, List<Item>>(), new Dictionary<EnemyType, List<Item>>(), new Dictionary<EnemyType, List<Item>>(), new Dictionary<EnemyType, List<Item>>(), new Dictionary<EnemyType, List<Item>>() }; private int iCurrentState; private bool bActive; private Transform ScrapTransform; private RoundManager roundManager; private StartOfRound StartOfRound; private EnemyType MaskedType; public void AddConversion(SCP914Setting setting, Item itemInput, List<Item> lItemOutputs) { Dictionary<Item, List<Item>> dictionary = arItemMappings[(int)setting]; if (dictionary.TryGetValue(itemInput, out var value)) { value.AddRange(lItemOutputs); } else { arItemMappings[(int)setting].Add(itemInput, lItemOutputs); } } public void AddConversion(SCP914Setting setting, EnemyType enemyInput, List<EnemyType> lEnemyOutputs) { Dictionary<EnemyType, List<EnemyType>> dictionary = arEnemyMappings[(int)setting]; if (dictionary.TryGetValue(enemyInput, out var value)) { value.AddRange(lEnemyOutputs); } else { arEnemyMappings[(int)setting].Add(enemyInput, lEnemyOutputs); } } public void AddConversion(SCP914Setting setting, Item itemInput, List<EnemyType> lEnemyOutputs) { Dictionary<Item, List<EnemyType>> dictionary = arItemEnemyMappings[(int)setting]; if (dictionary.TryGetValue(itemInput, out var value)) { value.AddRange(lEnemyOutputs); } else { arItemEnemyMappings[(int)setting].Add(itemInput, lEnemyOutputs); } } public void AddConversion(SCP914Setting setting, EnemyType enemyInput, List<Item> lItemOutputs) { Dictionary<EnemyType, List<Item>> dictionary = arEnemyItemMappings[(int)setting]; if (dictionary.TryGetValue(enemyInput, out var value)) { value.AddRange(lItemOutputs); } else { arEnemyItemMappings[(int)setting].Add(enemyInput, lItemOutputs); } } private Dictionary<Item, List<Item>> GetItemMapping() { return arItemMappings[iCurrentState]; } private Dictionary<EnemyType, List<EnemyType>> GetEnemyMapping() { return arEnemyMappings[iCurrentState]; } private Dictionary<Item, List<EnemyType>> GetItemEnemyMapping() { return arItemEnemyMappings[iCurrentState]; } private Dictionary<EnemyType, List<Item>> GetEnemyItemMapping() { return arEnemyItemMappings[iCurrentState]; } private Vector3 GetRandomNavMeshPositionInCollider(Collider collider) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = collider.bounds; Vector3 center = ((Bounds)(ref bounds)).center; bounds = collider.bounds; float x = ((Bounds)(ref bounds)).extents.x; bounds = collider.bounds; float num = Math.Min(x, ((Bounds)(ref bounds)).extents.z); center.x += Random.Range(0f - num, num); center.z += Random.Range(0f - num, num); ref float y = ref center.y; float num2 = y; bounds = collider.bounds; y = num2 - ((Bounds)(ref bounds)).extents.y / 2f; NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(center, ref val, 5f, -1)) { return ((NavMeshHit)(ref val)).position; } return center; } private Vector3 GetRandomPositionInCollider(Collider collider) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = collider.bounds; Vector3 center = ((Bounds)(ref bounds)).center; bounds = collider.bounds; float x = ((Bounds)(ref bounds)).extents.x; bounds = collider.bounds; float num = Math.Min(x, ((Bounds)(ref bounds)).extents.z); center.x += Random.Range(0f - num, num); center.z += Random.Range(0f - num, num); return center; } [ServerRpc(RequireOwnership = false)] public void TurnStateServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2627837757u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2627837757u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { int iNewState = (iCurrentState + 1) % 5; TurnStateClientRpc(iNewState); } } } [ClientRpc] public void TurnStateClientRpc(int iNewState) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(301590527u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, iNewState); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 301590527u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { iCurrentState = iNewState; Quaternion rotation = SettingKnobPivot.transform.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; eulerAngles.z = SCP914SettingRotations[iCurrentState].Item2; SettingKnobPivot.transform.rotation = Quaternion.Euler(eulerAngles); SettingKnobSoundSrc.Play(); } } } [ServerRpc(RequireOwnership = false)] public void ActivateServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1051910848u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1051910848u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !bActive) { bActive = true; ActivateClientRpc(); ((MonoBehaviour)this).StartCoroutine(ConversionProcess()); } } } [ClientRpc] public void ActivateClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3833341719u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3833341719u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ActivateTrigger.interactable = false; SettingKnobTrigger.interactable = false; ActivateAudioSrc.Play(); DoorIn.SetBoolString("open", false); DoorOut.SetBoolString("open", false); } } } [ClientRpc] public void RefineFinishClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4143732333u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4143732333u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ActivateTrigger.interactable = true; SettingKnobTrigger.interactable = true; DoorIn.SetBoolString("open", true); DoorOut.SetBoolString("open", true); } } } [ClientRpc] public void SpawnItemsClientRpc(NetworkObjectReference[] arNetworkObjectReferences, int[] arScrapValues, bool bChargeBattery) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4044311993u, val, (RpcDelivery)0); bool flag = arNetworkObjectReferences != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(arNetworkObjectReferences, default(ForNetworkSerializable)); } bool flag2 = arScrapValues != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(arScrapValues, default(ForPrimitives)); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref bChargeBattery, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4044311993u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } NetworkObject val3 = default(NetworkObject); for (int i = 0; i < arNetworkObjectReferences.Length; i++) { SCPCBDunGen.Logger.LogInfo((object)$"Item conversion scrap value {i}: {arScrapValues[i]}"); if (((NetworkObjectReference)(ref arNetworkObjectReferences[i])).TryGet(ref val3, (NetworkManager)null)) { GrabbableObject component = ((Component)val3).GetComponent<GrabbableObject>(); if (component.itemProperties.isScrap) { component.SetScrapValue(arScrapValues[i]); } if (component.itemProperties.requiresBattery) { component.insertedBattery.charge = (bChargeBattery ? 1f : 0f); } } } } private IEnumerator ConversionProcess() { RefineAudioSrc.Play(); yield return (object)new WaitForSeconds(7f); if ((Object)(object)roundManager == (Object)null) { SCPCBDunGen.Logger.LogInfo((object)"Getting round manager"); roundManager = Object.FindObjectOfType<RoundManager>(); if ((Object)(object)roundManager == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to find round manager."); yield break; } } if ((Object)(object)ScrapTransform == (Object)null) { SCP914Converter sCP914Converter = this; GameObject obj = GameObject.FindGameObjectWithTag("MapPropsContainer"); sCP914Converter.ScrapTransform = ((obj != null) ? obj.transform : null); if ((Object)(object)ScrapTransform == (Object)null) { SCPCBDunGen.Logger.LogError((object)"SCPCB Failed to find props container."); yield break; } } List<NetworkObjectReference> list = new List<NetworkObjectReference>(); List<int> list2 = new List<int>(); bool bChargeBattery = iCurrentState > 1; SCPCBDunGen.Logger.LogInfo((object)$"Contained item count: {InputStore.lContainedObjects.Count}"); foreach (GameObject lContainedObject in InputStore.lContainedObjects) { GrabbableObject component = lContainedObject.GetComponent<GrabbableObject>(); if ((Object)(object)component != (Object)null) { ConvertItem(list, list2, component); continue; } PlayerControllerB component2 = lContainedObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component2 != (Object)null) { ConvertPlayer(component2); continue; } EnemyAI componentInParent = lContainedObject.GetComponentInParent<EnemyAI>(); if ((Object)(object)componentInParent != (Object)null) { ConvertEnemy(list, list2, componentInParent); } } SCPCBDunGen.Logger.LogInfo((object)"Finished spawning scrap, syncing with clients"); SpawnItemsClientRpc(list.ToArray(), list2.ToArray(), bChargeBattery); InputStore.lContainedObjects.Clear(); yield return (object)new WaitForSeconds(7f); RefineFinishClientRpc(); bActive = false; } private void ConvertItemToItem(List<NetworkObjectReference> lNetworkObjectReferences, List<int> lScrapValues, GrabbableObject grabbable) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) Vector3 randomPositionInCollider = GetRandomPositionInCollider(colliderOutput); GameObject val = null; NetworkObject val2 = null; GrabbableObject val3 = null; if (GetItemMapping().TryGetValue(grabbable.itemProperties, out List<Item> value)) { SCPCBDunGen.Logger.LogInfo((object)"Mapping found"); Item val4 = value[roundManager.AnomalyRandom.Next(value.Count)]; if ((Object)(object)val4 != (Object)null) { SCPCBDunGen.Logger.LogInfo((object)"Conversion found"); val = Object.Instantiate<GameObject>(val4.spawnPrefab, randomPositionInCollider, Quaternion.identity, ScrapTransform); val2 = val.GetComponent<NetworkObject>(); val3 = val.GetComponent<GrabbableObject>(); } } else { SCPCBDunGen.Logger.LogInfo((object)"No conversion, making new item copy with new scrap value"); val = Object.Instantiate<GameObject>(grabbable.itemProperties.spawnPrefab, randomPositionInCollider, Quaternion.identity, ScrapTransform); val2 = val.GetComponent<NetworkObject>(); val3 = val.GetComponent<GrabbableObject>(); } SCPCBDunGen.Logger.LogInfo((object)"Preprocessing done"); if ((Object)(object)val3 == (Object)null) { SCPCBDunGen.Logger.LogInfo((object)"Conversion was null, item is intended to be destroyed in process."); return; } Item itemProperties = val3.itemProperties; if (itemProperties.isScrap) { SCPCBDunGen.Logger.LogInfo((object)"Item is scrap or null, generating a copy with new value"); GrabbableObject component = val.GetComponent<GrabbableObject>(); int num = (int)((float)roundManager.AnomalyRandom.Next(itemProperties.minValue, itemProperties.maxValue) * roundManager.scrapValueMultiplier); component.SetScrapValue(num); SCPCBDunGen.Logger.LogInfo((object)$"new scrap value: {num}"); lScrapValues.Add(num); } else { SCPCBDunGen.Logger.LogInfo((object)"Item is not scrap, adding empty scrap value"); lScrapValues.Add(0); } val2.Spawn(true); lNetworkObjectReferences.Add(NetworkObjectReference.op_Implicit(val2)); } private void ConvertItemToEnemy(GrabbableObject grabbable, EnemyType enemyType) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector3 randomNavMeshPositionInCollider = GetRandomNavMeshPositionInCollider(colliderOutput); roundManager.SpawnEnemyGameObject(randomNavMeshPositionInCollider, 0f, -1, enemyType); } private void ConvertItem(List<NetworkObjectReference> lNetworkObjectReferences, List<int> lScrapValues, GrabbableObject grabbable) { if (grabbable.isHeld) { return; } SCPCBDunGen.Logger.LogInfo((object)("Found grabbable item " + ((Object)grabbable.itemProperties).name)); Dictionary<Item, List<Item>> itemMapping = GetItemMapping(); Dictionary<Item, List<EnemyType>> itemEnemyMapping = GetItemEnemyMapping(); if (itemEnemyMapping.TryGetValue(grabbable.itemProperties, out var value)) { if (roundManager.AnomalyRandom.Next(2) == 0 && itemMapping.ContainsKey(grabbable.itemProperties)) { ConvertItemToItem(lNetworkObjectReferences, lScrapValues, grabbable); } else { ConvertItemToEnemy(grabbable, value[roundManager.AnomalyRandom.Next(value.Count)]); } } else { ConvertItemToItem(lNetworkObjectReferences, lScrapValues, grabbable); } Object.Destroy((Object)(object)((Component)grabbable).gameObject); } [ClientRpc] private void ConvertPlayerTeleportClientRpc(NetworkBehaviourReference netBehaviourRefPlayer, Vector3 vPosition) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3018499267u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref vPosition); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3018499267u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkBehaviour val3 = null; ((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val3, (NetworkManager)null); if ((Object)(object)val3 == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to get player controller."); return; } PlayerControllerB val4 = (PlayerControllerB)val3; val4.TeleportPlayer(vPosition, false, 0f, false, true); } } [ClientRpc] private void ConvertPlayerKillClientRpc(NetworkBehaviourReference netBehaviourRefPlayer) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1252059581u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1252059581u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkBehaviour val3 = null; ((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val3, (NetworkManager)null); if ((Object)(object)val3 == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to get player controller."); return; } PlayerControllerB val4 = (PlayerControllerB)val3; val4.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 0, default(Vector3)); } } [ClientRpc] private void ConvertPlayerAlterHealthClientRpc(NetworkBehaviourReference netBehaviourRefPlayer, int iHealthDelta) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(527346026u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, iHealthDelta); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 527346026u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkBehaviour val3 = null; ((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val3, (NetworkManager)null); if ((Object)(object)val3 == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to get player controller."); return; } PlayerControllerB val4 = (PlayerControllerB)val3; val4.DamagePlayer(iHealthDelta, true, true, (CauseOfDeath)8, 0, false, default(Vector3)); } } [ClientRpc] private void ConvertPlayerRandomSkinClientRpc(NetworkBehaviourReference netBehaviourRefPlayer, int iSuitID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1669287785u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, iSuitID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1669287785u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } if ((Object)(object)StartOfRound == (Object)null) { StartOfRound = Object.FindObjectOfType<StartOfRound>(); if ((Object)(object)StartOfRound == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to find StartOfRound."); return; } } NetworkBehaviour val3 = null; ((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val3, (NetworkManager)null); if ((Object)(object)val3 == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to get player controller."); return; } PlayerControllerB val4 = (PlayerControllerB)val3; int num = 0; foreach (UnlockableItem unlockable in StartOfRound.unlockablesList.unlockables) { if ((Object)(object)unlockable.suitMaterial != (Object)null) { SCPCBDunGen.Logger.LogInfo((object)$"Found suit at index {num}"); } num++; } UnlockableItem val5 = StartOfRound.unlockablesList.unlockables[iSuitID]; if (val5 == null) { SCPCBDunGen.Logger.LogError((object)$"Invalid suit ID: {iSuitID}"); return; } Material suitMaterial = val5.suitMaterial; ((Renderer)val4.thisPlayerModel).material = suitMaterial; ((Renderer)val4.thisPlayerModelLOD1).material = suitMaterial; ((Renderer)val4.thisPlayerModelLOD2).material = suitMaterial; ((Renderer)val4.thisPlayerModelArms).material = suitMaterial; val4.currentSuitID = iSuitID; } private void ConvertPlayerRandomSkin(PlayerControllerB playerController) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound == (Object)null) { StartOfRound = Object.FindObjectOfType<StartOfRound>(); if ((Object)(object)StartOfRound == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to find StartOfRound."); return; } } List<int> list = new List<int>(); int num = 0; foreach (UnlockableItem unlockable in StartOfRound.unlockablesList.unlockables) { if ((Object)(object)unlockable.suitMaterial != (Object)null && num != playerController.currentSuitID) { list.Add(num); } num++; } int count = list.Count; if (count == 0) { SCPCBDunGen.Logger.LogError((object)"No suits to swap to found."); return; } int index = roundManager.AnomalyRandom.Next(0, count); NetworkBehaviourReference netBehaviourRefPlayer = NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController); ConvertPlayerRandomSkinClientRpc(netBehaviourRefPlayer, list[index]); } private IEnumerator ConvertPlayerMaskedWaitForSpawn(NetworkObjectReference netObjRefMasked, NetworkBehaviourReference netBehaviourRefPlayer) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) NetworkObject netObjMasked = null; NetworkBehaviour netBehaviourPlayer = null; float fStartTime = Time.realtimeSinceStartup; yield return (object)new WaitUntil((Func<bool>)(() => Time.realtimeSinceStartup - fStartTime > 20f || ((NetworkObjectReference)(ref netObjRefMasked)).TryGet(ref netObjMasked, (NetworkManager)null))); yield return (object)new WaitUntil((Func<bool>)(() => Time.realtimeSinceStartup - fStartTime > 20f || ((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref netBehaviourPlayer, (NetworkManager)null))); PlayerControllerB playerController = (PlayerControllerB)netBehaviourPlayer; if ((Object)(object)playerController.deadBody == (Object)null) { yield return (object)new WaitUntil((Func<bool>)(() => Time.realtimeSinceStartup - fStartTime > 20f || (Object)(object)playerController.deadBody != (Object)null)); } if ((Object)(object)playerController.deadBody != (Object)null) { playerController.deadBody.DeactivateBody(false); if ((Object)(object)netObjMasked != (Object)null) { MaskedPlayerEnemy component = ((Component)netObjMasked).GetComponent<MaskedPlayerEnemy>(); component.mimickingPlayer = playerController; component.SetSuit(playerController.currentSuitID); ((EnemyAI)component).SetEnemyOutside(false); playerController.redirectToEnemy = (EnemyAI)(object)component; } } } [ClientRpc] private void ConvertPlayerMaskedClientRpc(NetworkObjectReference netObjRefMasked, NetworkBehaviourReference netBehaviourRefPlayer) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(358260797u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRefMasked, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 358260797u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } NetworkBehaviour val3 = null; ((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val3, (NetworkManager)null); if ((Object)(object)val3 == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to get player controller."); return; } PlayerControllerB val4 = (PlayerControllerB)val3; val4.KillPlayer(Vector3.zero, true, (CauseOfDeath)5, 0, default(Vector3)); if ((Object)(object)val4.deadBody != (Object)null) { val4.deadBody.DeactivateBody(false); } ((MonoBehaviour)this).StartCoroutine(ConvertPlayerMaskedWaitForSpawn(netObjRefMasked, netBehaviourRefPlayer)); } private void ConvertPlayerMasked(NetworkBehaviourReference netBehaviourRefPlayer, Vector3 vMaskedPosition) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) NetworkBehaviour val = null; ((NetworkBehaviourReference)(ref netBehaviourRefPlayer)).TryGet(ref val, (NetworkManager)null); if ((Object)(object)val == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to get player controller."); return; } PlayerControllerB val2 = (PlayerControllerB)val; val2.KillPlayer(Vector3.zero, true, (CauseOfDeath)5, 0, default(Vector3)); if ((Object)(object)StartOfRound == (Object)null) { StartOfRound = Object.FindObjectOfType<StartOfRound>(); if ((Object)(object)StartOfRound == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to find StartOfRound."); return; } } if ((Object)(object)MaskedType == (Object)null) { SelectableLevel val3 = Array.Find(StartOfRound.levels, (SelectableLevel x) => x.PlanetName == "8 Titan"); if ((Object)(object)val3 == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to get Titan level data."); return; } MaskedType = val3.Enemies.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == "Masked")?.enemyType; if ((Object)(object)MaskedType == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to get masked enemy type."); return; } } NetworkObjectReference netObjRefMasked = roundManager.SpawnEnemyGameObject(vMaskedPosition, 0f, -1, MaskedType); NetworkObject val4 = default(NetworkObject); if (((NetworkObjectReference)(ref netObjRefMasked)).TryGet(ref val4, (NetworkManager)null)) { SCPCBDunGen.Logger.LogInfo((object)"Got network object for mask enemy"); MaskedPlayerEnemy component = ((Component)val4).GetComponent<MaskedPlayerEnemy>(); component.SetSuit(val2.currentSuitID); component.mimickingPlayer = val2; ((EnemyAI)component).SetEnemyOutside(false); val2.redirectToEnemy = (EnemyAI)(object)component; if ((Object)(object)val2.deadBody != (Object)null) { val2.deadBody.DeactivateBody(false); } } ConvertPlayerMaskedClientRpc(netObjRefMasked, netBehaviourRefPlayer); } private void ConvertPlayer(PlayerControllerB playerController) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) SCPCBDunGen.Logger.LogInfo((object)"Player detected, doing player conversion"); SCP914Setting sCP914Setting = (SCP914Setting)iCurrentState; Vector3 randomNavMeshPositionInCollider = GetRandomNavMeshPositionInCollider(colliderOutput); NetworkBehaviourReference netBehaviourRefPlayer = NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController); ConvertPlayerTeleportClientRpc(netBehaviourRefPlayer, randomNavMeshPositionInCollider); switch (sCP914Setting) { case SCP914Setting.ROUGH: ConvertPlayerKillClientRpc(netBehaviourRefPlayer); break; case SCP914Setting.COARSE: ConvertPlayerAlterHealthClientRpc(netBehaviourRefPlayer, 50); break; case SCP914Setting.ONETOONE: ConvertPlayerRandomSkin(playerController); break; case SCP914Setting.FINE: ConvertPlayerAlterHealthClientRpc(netBehaviourRefPlayer, -50); break; case SCP914Setting.VERYFINE: if (!playerController.AllowPlayerDeath()) { SCPCBDunGen.Logger.LogInfo((object)"Refined player with Very Fine, but player death is prevented. Doing nothing."); } else { ConvertPlayerMasked(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController), randomNavMeshPositionInCollider); } break; default: SCPCBDunGen.Logger.LogError((object)"Invalid SCP 914 setting when attempting to convert player."); break; } } [ClientRpc] private void TeleportEnemyClientRpc(NetworkBehaviourReference netBehaviourRefEnemy, Vector3 vPosition) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0111: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2839432350u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref netBehaviourRefEnemy, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref vPosition); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2839432350u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { NetworkBehaviour val3 = null; ((NetworkBehaviourReference)(ref netBehaviourRefEnemy)).TryGet(ref val3, (NetworkManager)null); if ((Object)(object)val3 == (Object)null) { SCPCBDunGen.Logger.LogError((object)"Failed to get enemy AI."); return; } EnemyAI val4 = (EnemyAI)val3; val4.serverPosition = vPosition; } } private void MoveEnemy(EnemyAI enemy, Vector3 NavPosition) { //IL_0015: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) SCPCBDunGen.Logger.LogInfo((object)$"No conversions for enemy: {enemy.enemyType.enemyName}. Teleporting to {NavPosition}"); NetworkBehaviourReference netBehaviourRefEnemy = NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)enemy); TeleportEnemyClientRpc(netBehaviourRefEnemy, NavPosition); enemy.agent.Warp(NavPosition); enemy.SyncPositionToClients(); if (iCurrentState == 0) { enemy.KillEnemyOnOwnerClient(false); } } private void ConvertEnemyToEnemy(EnemyAI enemy) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) Dictionary<EnemyType, List<EnemyType>> enemyMapping = GetEnemyMapping(); Vector3 randomNavMeshPositionInCollider = GetRandomNavMeshPositionInCollider(colliderOutput); if (enemyMapping.TryGetValue(enemy.enemyType, out var value) && value.Count != 0) { EnemyType val = value[roundManager.AnomalyRandom.Next(value.Count)]; roundManager.SpawnEnemyGameObject(randomNavMeshPositionInCollider, 0f, -1, val); Object.Destroy((Object)(object)((Component)enemy).gameObject); } MoveEnemy(enemy, randomNavMeshPositionInCollider); } private void ConvertEnemyToItem(List<NetworkObjectReference> lNetworkObjectReferences, List<int> lScrapValues, EnemyAI enemy) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) Vector3 randomPositionInCollider = GetRandomPositionInCollider(colliderOutput); GameObject val = null; NetworkObject val2 = null; GrabbableObject val3 = null; if (GetEnemyItemMapping().TryGetValue(enemy.enemyType, out List<Item> value)) { SCPCBDunGen.Logger.LogInfo((object)"Mapping found"); Item val4 = value[roundManager.AnomalyRandom.Next(value.Count)]; Object.Destroy((Object)(object)((Component)enemy).gameObject); if ((Object)(object)val4 != (Object)null) { SCPCBDunGen.Logger.LogInfo((object)"Conversion found"); val = Object.Instantiate<GameObject>(val4.spawnPrefab, randomPositionInCollider, Quaternion.identity, ScrapTransform); val2 = val.GetComponent<NetworkObject>(); val3 = val.GetComponent<GrabbableObject>(); } } else { SCPCBDunGen.Logger.LogInfo((object)"No conversion, teleporting enemy"); Vector3 randomNavMeshPositionInCollider = GetRandomNavMeshPositionInCollider(colliderOutput); MoveEnemy(enemy, randomNavMeshPositionInCollider); } SCPCBDunGen.Logger.LogInfo((object)"Preprocessing done"); if ((Object)(object)val3 == (Object)null) { SCPCBDunGen.Logger.LogInfo((object)"Conversion was null, item is intended to be destroyed in process."); return; } Item itemProperties = val3.itemProperties; if (itemProperties.isScrap) { SCPCBDunGen.Logger.LogInfo((object)"Item is scrap or null, generating a copy with new value"); GrabbableObject component = val.GetComponent<GrabbableObject>(); int num = (int)((float)roundManager.AnomalyRandom.Next(itemProperties.minValue, itemProperties.maxValue) * roundManager.scrapValueMultiplier); component.SetScrapValue(num); SCPCBDunGen.Logger.LogInfo((object)$"new scrap value: {num}"); lScrapValues.Add(num); } else { SCPCBDunGen.Logger.LogInfo((object)"Item is not scrap, adding empty scrap value"); lScrapValues.Add(0); } val2.Spawn(true); lNetworkObjectReferences.Add(NetworkObjectReference.op_Implicit(val2)); } private void ConvertEnemy(List<NetworkObjectReference> lNetworkObjectReferences, List<int> lScrapValues, EnemyAI enemy) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) Dictionary<EnemyType, List<Item>> enemyItemMapping = GetEnemyItemMapping(); Dictionary<EnemyType, List<EnemyType>> enemyMapping = GetEnemyMapping(); if (GetEnemyMapping().TryGetValue(enemy.enemyType, out List<EnemyType> _)) { if (roundManager.AnomalyRandom.Next(2) == 0 && GetEnemyItemMapping().ContainsKey(enemy.enemyType)) { ConvertEnemyToItem(lNetworkObjectReferences, lScrapValues, enemy); } else { ConvertEnemyToEnemy(enemy); } } else if (GetEnemyItemMapping().ContainsKey(enemy.enemyType)) { ConvertEnemyToItem(lNetworkObjectReferences, lScrapValues, enemy); } else { Vector3 randomNavMeshPositionInCollider = GetRandomNavMeshPositionInCollider(colliderOutput); MoveEnemy(enemy, randomNavMeshPositionInCollider); } Object.Destroy((Object)(object)((Component)enemy).gameObject); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_SCP914Converter() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2627837757u, new RpcReceiveHandler(__rpc_handler_2627837757)); NetworkManager.__rpc_func_table.Add(301590527u, new RpcReceiveHandler(__rpc_handler_301590527)); NetworkManager.__rpc_func_table.Add(1051910848u, new RpcReceiveHandler(__rpc_handler_1051910848)); NetworkManager.__rpc_func_table.Add(3833341719u, new RpcReceiveHandler(__rpc_handler_3833341719)); NetworkManager.__rpc_func_table.Add(4143732333u, new RpcReceiveHandler(__rpc_handler_4143732333)); NetworkManager.__rpc_func_table.Add(4044311993u, new RpcReceiveHandler(__rpc_handler_4044311993)); NetworkManager.__rpc_func_table.Add(3018499267u, new RpcReceiveHandler(__rpc_handler_3018499267)); NetworkManager.__rpc_func_table.Add(1252059581u, new RpcReceiveHandler(__rpc_handler_1252059581)); NetworkManager.__rpc_func_table.Add(527346026u, new RpcReceiveHandler(__rpc_handler_527346026)); NetworkManager.__rpc_func_table.Add(1669287785u, new RpcReceiveHandler(__rpc_handler_1669287785)); NetworkManager.__rpc_func_table.Add(358260797u, new RpcReceiveHandler(__rpc_handler_358260797)); NetworkManager.__rpc_func_table.Add(2839432350u, new RpcReceiveHandler(__rpc_handler_2839432350)); } private static void __rpc_handler_2627837757(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((SCP914Converter)(object)target).TurnStateServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_301590527(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int iNewState = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref iNewState); target.__rpc_exec_stage = (__RpcExecStage)2; ((SCP914Converter)(object)target).TurnStateClientRpc(iNewState); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1051910848(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((SCP914Converter)(object)target).ActivateServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3833341719(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((SCP914Converter)(object)target).ActivateClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4143732333(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((SCP914Converter)(object)target).RefineFinishClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4044311993(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); NetworkObjectReference[] arNetworkObjectReferences = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref arNetworkObjectReferences, default(ForNetworkSerializable)); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); int[] arScrapValues = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref arScrapValues, default(ForPrimitives)); } bool bChargeBattery = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref bChargeBattery, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((SCP914Converter)(object)target).SpawnItemsClientRpc(arNetworkObjectReferences, arScrapValues, bChargeBattery); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3018499267(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference netBehaviourRefPlayer = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable)); Vector3 vPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref vPosition); target.__rpc_exec_stage = (__RpcExecStage)2; ((SCP914Converter)(object)target).ConvertPlayerTeleportClientRpc(netBehaviourRefPlayer, vPosition); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1252059581(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference netBehaviourRefPlayer = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((SCP914Converter)(object)target).ConvertPlayerKillClientRpc(netBehaviourRefPlayer); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_527346026(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference netBehaviourRefPlayer = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable)); int iHealthDelta = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref iHealthDelta); target.__rpc_exec_stage = (__RpcExecStage)2; ((SCP914Converter)(object)target).ConvertPlayerAlterHealthClientRpc(netBehaviourRefPlayer, iHealthDelta); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1669287785(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference netBehaviourRefPlayer = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable)); int iSuitID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref iSuitID); target.__rpc_exec_stage = (__RpcExecStage)2; ((SCP914Converter)(object)target).ConvertPlayerRandomSkinClientRpc(netBehaviourRefPlayer, iSuitID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_358260797(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netObjRefMasked = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRefMasked, default(ForNetworkSerializable)); NetworkBehaviourReference netBehaviourRefPlayer = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefPlayer, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((SCP914Converter)(object)target).ConvertPlayerMaskedClientRpc(netObjRefMasked, netBehaviourRefPlayer); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2839432350(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkBehaviourReference netBehaviourRefEnemy = default(NetworkBehaviourReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref netBehaviourRefEnemy, default(ForNetworkSerializable)); Vector3 vPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref vPosition); target.__rpc_exec_stage = (__RpcExecStage)2; ((SCP914Converter)(object)target).TeleportEnemyClientRpc(netBehaviourRefEnemy, vPosition); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SCP914Converter"; } } public class SCPDoorMover : NetworkBehaviour { public NavMeshObstacle navObstacle; public Animator doors; public List<AudioClip> doorAudioClips; public AudioClip doorAudioClipFast; public AudioSource doorSFXSource; public InteractTrigger ButtonA; public InteractTrigger ButtonB; private bool bDoorOpen; private bool bDoorWaiting; private List<EnemyAICollisionDetect> EnemiesInCollider = new List<EnemyAICollisionDetect>(); private void OnTriggerEnter(Collider other) { if (!((Object)(object)NetworkManager.Singleton == (Object)null) && ((NetworkBehaviour)this).IsServer && ((Component)other).CompareTag("Enemy")) { EnemyAICollisionDetect component = ((Component)other).GetComponent<EnemyAICollisionDetect>(); if (!((Object)(object)component == (Object)null)) { SCPCBDunGen.Logger.LogInfo((object)("Enemy entered trigger: " + ((Object)component.mainScript.enemyType).name)); EnemiesInCollider.Add(component); } } } private void OnTriggerExit(Collider other) { if (!((Object)(object)NetworkManager.Singleton == (Object)null) && ((NetworkBehaviour)this).IsServer && ((Component)other).CompareTag("Enemy")) { EnemyAICollisionDetect component = ((Component)other).GetComponent<EnemyAICollisionDetect>(); if (!((Object)(object)component == (Object)null) && !EnemiesInCollider.Remove(component)) { SCPCBDunGen.Logger.LogWarning((object)"Enemy left door trigger but somehow wasn't detected in trigger entry."); } } } private void Update() { if ((Object)(object)NetworkManager.Singleton == (Object)null || !((NetworkBehaviour)this).IsServer || bDoorOpen || bDoorWaiting || EnemiesInCollider.Count == 0) { return; } SCPCBDunGen.Logger.LogInfo((object)"Enemy attempting to open door..."); float num = 0f; foreach (EnemyAICollisionDetect item in EnemiesInCollider) { EnemyAI mainScript = item.mainScript; if (!mainScript.isEnemyDead) { SCPCBDunGen.Logger.LogInfo((object)$"Enemy {((Object)mainScript.enemyType).name} with open mult {mainScript.openDoorSpeedMultiplier}"); float val = mainScript.openDoorSpeedMultiplier; if (((Object)mainScript.enemyType).name == "MaskedPlayerEnemy") { val = 1f; } if (((Object)mainScript.enemyType).name == "Crawler") { val = 2f; } num = Math.Max(num, val); } } SCPCBDunGen.Logger.LogInfo((object)$"Highest multiplier is {num}."); if (num != 0f) { SCPCBDunGen.Logger.LogInfo((object)"Door being opened."); if (num > 1.5f) { OpenDoorFastServerRpc(); } else { ToggleDoorServerRpc(); } } } [ServerRpc] public void OpenDoorFastServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(289563691u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 289563691u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SCPCBDunGen.Logger.LogInfo((object)"Opening door fast [SERVER]."); bDoorWaiting = true; bDoorOpen = true; ((Behaviour)navObstacle).enabled = false; OpenDoorFastClientRpc(); ((MonoBehaviour)this).StartCoroutine(DoorToggleButtonUsable()); } } [ClientRpc] public void OpenDoorFastClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1678254293u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1678254293u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SCPCBDunGen.Logger.LogInfo((object)"Opening door fast [CLIENT]."); bDoorWaiting = true; bDoorOpen = true; ButtonA.interactable = false; ButtonB.interactable = false; ((Behaviour)navObstacle).enabled = false; doorSFXSource.PlayOneShot(doorAudioClipFast); doors.SetTrigger("openfast"); } } } private IEnumerator DoorToggleButtonUsable() { yield return (object)new WaitForSeconds(1f); bDoorWaiting = false; yield return (object)new WaitForSeconds(1f); EnableDoorButtonClientRpc(); } [ServerRpc(RequireOwnership = false)] public void ToggleDoorServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(40313670u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 40313670u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !bDoorWaiting) { bool flag = !bDoorOpen; string text = (flag ? "opening" : "closing"); SCPCBDunGen.Logger.LogInfo((object)("Door is " + text + ".")); bDoorWaiting = true; bDoorOpen = flag; ((Behaviour)navObstacle).enabled = !flag; ToggleDoorClientRpc(bDoorOpen); ((MonoBehaviour)this).StartCoroutine(DoorToggleButtonUsable()); } } } [ClientRpc] public void ToggleDoorClientRpc(bool _bDoorOpen) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(659555206u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref _bDoorOpen, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 659555206u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { bDoorOpen = _bDoorOpen; ButtonA.interactable = false; ButtonB.interactable = false; ((Behaviour)navObstacle).enabled = !_bDoorOpen; doorSFXSource.PlayOneShot(doorAudioClips[Random.Range(0, doorAudioClips.Count)]); doors.SetTrigger(bDoorOpen ? "open" : "close"); } } } [ClientRpc] public void EnableDoorButtonClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1538705838u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1538705838u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ButtonA.interactable = true; ButtonB.interactable = true; } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_SCPDoorMover() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(289563691u, new RpcReceiveHandler(__rpc_handler_289563691)); NetworkManager.__rpc_func_table.Add(1678254293u, new RpcReceiveHandler(__rpc_handler_1678254293)); NetworkManager.__rpc_func_table.Add(40313670u, new RpcReceiveHandler(__rpc_handler_40313670)); NetworkManager.__rpc_func_table.Add(659555206u, new RpcReceiveHandler(__rpc_handler_659555206)); NetworkManager.__rpc_func_table.Add(1538705838u, new RpcReceiveHandler(__rpc_handler_1538705838)); } private static void __rpc_handler_289563691(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((SCPDoorMover)(object)target).OpenDoorFastServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1678254293(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((SCPDoorMover)(object)target).OpenDoorFastClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_40313670(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((SCPDoorMover)(object)target).ToggleDoorServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_659555206(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((SCPDoorMover)(object)target).ToggleDoorClientRpc(flag); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1538705838(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((SCPDoorMover)(object)target).EnableDoorButtonClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SCPDoorMover"; } } public struct SCP914Conversion { public string ItemName; public List<string> RoughResults { get; set; } public List<string> CoarseResults { get; set; } public List<string> OneToOneResults { get; set; } public List<string> FineResults { get; set; } public List<string> VeryFineResults { get; set; } } public class SCP914ConversionSet : KeyedCollection<string, SCP914Conversion> { protected override string GetKeyForItem(SCP914Conversion conversion) { return conversion.ItemName; } } [BepInPlugin("SCPCBDunGen", "SCPCBDunGen", "4.3.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [LobbyCompatibility(/*Could not decode attribute arguments.*/)] public class SCPCBDunGen : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Func<string, bool> <0>__Exists; public static Func<string, IEnumerable<string>> <1>__GetFiles; public static hook_SpawnScrapInLevel <2>__SetItemSpawnPoints; public static hook_SpawnScrapInLevel <3>__SCP914Configuration; } public static AssetBundle? SCPCBAssets; public SCP914ConversionSet SCP914Conversions = new SCP914ConversionSet(); public static SCPCBDunGen Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } private void Awake() { //IL_0289: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Instance = this; NetcodePatcher(); Hook(); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); SCPCBAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "scpcb_dungeon")); if ((Object)(object)SCPCBAssets == (Object)null) { Logger.LogError((object)"Failed to load SCPCB Dungeon assets."); return; } ExtendedDungeonFlow val = SCPCBAssets.LoadAsset<ExtendedDungeonFlow>("assets/Mods/SCP/data/SCPCBDunGenExtFlow.asset"); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"Failed to load SCP:CB Extended Dungeon Flow."); return; } ConfigEntry<bool> val2 = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Default914Recipes", true, new ConfigDescription("If false, any custom 914 Json files named \"default.json\" will be ignored (i.e. the default 914 config will not be loaded).\nSome custom 914 implementations may want to fully override the default settings, in which case this can be set to false.", (AcceptableValueBase)null, Array.Empty<object>())); ConfigEntry<bool> val3 = ((BaseUnityPlugin)this).Config.Bind<bool>("Mod Compatibility", "PiggysVarietyMod", true, new ConfigDescription("If Piggys Variety Mod is present and this setting is enabled, tesla gates can spawn in the SCP Foundation.\nWARNING: Ensure this value matches across all clients or desync will occur.", (AcceptableValueBase)null, Array.Empty<object>())); if (val3.Value && Chainloader.PluginInfos.ContainsKey("Piggy.PiggyVarietyMod")) { CompatPVM(val); } PatchedContent.RegisterExtendedDungeonFlow(val); foreach (string item in DiscoverConfiguredRecipeFiles()) { if (!val2.Value && Path.GetFileName(item) == "default.json") { continue; } StreamReader streamReader = new StreamReader(item); string text = streamReader.ReadToEnd(); try { List<SCP914Conversion> list = JsonConvert.DeserializeObject<List<SCP914Conversion>>(text); foreach (SCP914Conversion item2 in list) { if (SCP914Conve
plugins/SecretLabs.dll
Decompiled 2 months agousing System; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using SecretLabs.Patches; using Unity.Collections; using Unity.Netcode; using UnityEngine; [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("SecretLabs")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("SecretLabs")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SecretLabs")] [assembly: AssemblyTitle("SecretLabs")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SecretLabs { [Serializable] public class Config : SyncedInstance<Config> { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } public bool customPriceEnabled; public int moonPrice; public Config(ConfigFile cfg) { InitInstance(this); customPriceEnabled = cfg.Bind<bool>("General", "CustomPriceEnabled", false, "Enable this if you wish to configure the moons route price below.").Value; moonPrice = cfg.Bind<int>("General", "MoonPrice", 700, "The route price of the Secret Labs moon.").Value; } public static void RequestSync() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { SyncedInstance<Config>.MessageManager.SendNamedMessage("SecretLabs_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsHost) { return; } byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance<Config>.MessageManager.SendNamedMessage("SecretLabs_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { Plugin.Logger.LogDebug((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize)) { Plugin.Logger.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.Logger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<Config>.SyncInstance(data); Plugin.Logger.LogDebug((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //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 if (SyncedInstance<Config>.IsHost) { CustomMessagingManager messageManager = SyncedInstance<Config>.MessageManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("SecretLabs_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); SyncedInstance<Config>.Synced = true; return; } SyncedInstance<Config>.Synced = false; CustomMessagingManager messageManager2 = SyncedInstance<Config>.MessageManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } messageManager2.RegisterNamedMessageHandler("SecretLabs_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); RequestSync(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance<Config>.RevertSync(); } } [Serializable] public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; set; } public static T Instance { get; set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } } [BepInPlugin("SecretLabs", "SecretLabs", "1.0.0")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; public static ManualLogSource Logger; public static Config Config { get; internal set; } private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("SecretLabs"); Config = new Config(((BaseUnityPlugin)this).Config); _harmony.PatchAll(typeof(RoutePatches)); _harmony.PatchAll(typeof(Config)); Logger.LogDebug((object)"Plugin SecretLabs is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "SecretLabs"; public const string PLUGIN_NAME = "SecretLabs"; public const string PLUGIN_VERSION = "1.0.0"; } public static class MyPluginInfo { public const string PLUGIN_GUID = "SecretLabs"; public const string PLUGIN_NAME = "SecretLabs"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace SecretLabs.Patches { [HarmonyPatch(typeof(Terminal))] public class RoutePatches { [HarmonyPatch("LoadNewNode")] [HarmonyPrefix] private static void LoadNewNodePatchBefore(ref TerminalNode node) { if (!SyncedInstance<Config>.Instance.customPriceEnabled) { return; } Terminal obj = Object.FindObjectOfType<Terminal>(); Plugin.Logger.LogDebug((object)((Object)node).name); CompatibleNoun[] compatibleNouns = obj.terminalNodes.allKeywords.First((TerminalKeyword terminalKeyword) => terminalKeyword.word == "route").compatibleNouns; foreach (CompatibleNoun val in compatibleNouns) { if (!((Object)(object)val.result == (Object)null) && ((Object)val.result).name == "secret labsRoute") { val.result.itemCost = SyncedInstance<Config>.Instance.moonPrice; } } } [HarmonyPatch("LoadNewNodeIfAffordable")] [HarmonyPrefix] private static void LoadNewNodeIfAffordablePatch(ref TerminalNode node) { if (SyncedInstance<Config>.Instance.customPriceEnabled) { Plugin.Logger.LogDebug((object)((Object)node).name); if (!((Object)(object)node == (Object)null) && !(((Object)node).name != "secret labsRouteConfirm")) { node.itemCost = Math.Abs(SyncedInstance<Config>.Instance.moonPrice); } } } } }